All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yafang Shao <laoar.shao@gmail.com>
To: Valentin Schneider <valentin.schneider@arm.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Benjamin Segall <bsegall@google.com>,
	Mel Gorman <mgorman@suse.de>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH 4/4] sched/core: Do numa balance in cfs_migration
Date: Sat, 6 Nov 2021 15:40:53 +0800	[thread overview]
Message-ID: <CALOAHbDZMiLR-3NQHYPJ707Hk-3X+yjrxk_YA0xyxa40Sj7SEQ@mail.gmail.com> (raw)
In-Reply-To: <878ry2tu1m.mognet@arm.com>

On Sat, Nov 6, 2021 at 1:02 AM Valentin Schneider
<valentin.schneider@arm.com> wrote:
>
> On 04/11/21 14:57, Yafang Shao wrote:
> > Similar to active load balance, the numa balance work is also applied to
> > cfs tasks only and it should't preempt other FIFO tasks. We'd better assign
> > cfs_migration to the numa balance as well.
> >
> > Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> > Cc: Valentin Schneider <valentin.schneider@arm.com>
> > Cc: Vincent Guittot <vincent.guittot@linaro.org>
> > Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
> > ---
> >  kernel/sched/core.c  |  2 +-
> >  kernel/sched/fair.c  | 13 +++++++++++++
> >  kernel/sched/sched.h |  2 ++
> >  3 files changed, 16 insertions(+), 1 deletion(-)
> >
> > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > index 9cb81ef8acc8..4a37b06715f4 100644
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -8724,7 +8724,7 @@ int migrate_task_to(struct task_struct *p, int target_cpu)
> >       /* TODO: This is not properly updating schedstats */
> >
> >       trace_sched_move_numa(p, curr_cpu, target_cpu);
> > -     return stop_one_cpu(curr_cpu, migration_cpu_stop, &arg);
> > +     return wakeup_cfs_migrater(curr_cpu, migration_cpu_stop, &arg);
>
> So that one I find really icky - migration_cpu_stop() really is meant to be
> run from a CPU stopper (cf. cpu_stop suffix). IMO this is the opportunity
> to make NUMA balancing reuse the logic for CFS active balance here, but per
> previous email I'd say it could be done as a second step.
>

Sure.

> >  }
> >
> >  /*
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 932f63baeb82..b7a155e05c98 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -11960,6 +11960,19 @@ static void wakeup_cfs_migrater_nowait(unsigned int cpu, cpu_stop_fn_t fn, void
> >       cfs_migration_queue_work(cpu, work_buf);
> >  }
> >
> > +bool wakeup_cfs_migrater(unsigned int cpu, cpu_stop_fn_t fn, void *arg)
> > +{
> > +     struct cpu_stop_done done;
> > +     struct cpu_stop_work work = { .fn = fn, .arg = arg, .done = &done, .caller = _RET_IP_ };
> > +
> > +     cpu_stop_init_done(&done, 1);
> > +     cfs_migration_queue_work(cpu, &work);
> > +     cond_resched();
> > +     wait_for_completion(&done.completion);
> > +
> > +     return done.ret;
> > +}
> > +
> >  static int cfs_migration_should_run(unsigned int cpu)
> >  {
> >       struct cfs_migrater *migrater = &per_cpu(cfs_migrater, cpu);
> > diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> > index a00fc7057d97..7b242c18a6d8 100644
> > --- a/kernel/sched/sched.h
> > +++ b/kernel/sched/sched.h
> > @@ -3055,6 +3055,8 @@ static inline bool is_per_cpu_kthread(struct task_struct *p)
> >
> >       return true;
> >  }
> > +
> > +bool wakeup_cfs_migrater(unsigned int cpu, cpu_stop_fn_t fn, void *arg);
> >  #endif
> >
> >  extern void swake_up_all_locked(struct swait_queue_head *q);
> > --
> > 2.17.1



-- 
Thanks
Yafang

  reply	other threads:[~2021-11-06  7:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-04 14:57 [RFC PATCH 0/4] sched: Introduce cfs_migration Yafang Shao
2021-11-04 14:57 ` [RFC PATCH 1/4] stop_machine: Move cpu_stop_done into stop_machine.h Yafang Shao
2021-11-05 17:00   ` Valentin Schneider
2021-11-06  7:30     ` Yafang Shao
2021-11-04 14:57 ` [RFC PATCH 2/4] sched/fair: Introduce cfs_migration Yafang Shao
2021-11-04 22:22   ` kernel test robot
2021-11-05  6:48     ` Yafang Shao
2021-11-04 22:22   ` [RFC PATCH] sched/fair: __pcpu_scope_cfs_migrater can be static kernel test robot
2021-11-05  6:45     ` Yafang Shao
2021-11-05 17:01   ` [RFC PATCH 2/4] sched/fair: Introduce cfs_migration Valentin Schneider
2021-11-06  7:40     ` Yafang Shao
2021-11-09 10:47       ` Valentin Schneider
2021-11-10 14:17         ` Yafang Shao
2021-11-07  9:38   ` [sched/fair] 64228563c2: WARNING:at_kernel/kthread.c:#__kthread_bind_mask kernel test robot
2021-11-07  9:38     ` kernel test robot
2021-11-08  3:53     ` Yafang Shao
2021-11-08  3:53       ` Yafang Shao
2021-11-04 14:57 ` [RFC PATCH 3/4] sched/fair: Do active load balance in cfs_migration Yafang Shao
2021-11-04 14:57 ` [RFC PATCH 4/4] sched/core: Do numa " Yafang Shao
2021-11-05 17:02   ` Valentin Schneider
2021-11-06  7:40     ` Yafang Shao [this message]
2021-11-05 17:00 ` [RFC PATCH 0/4] sched: Introduce cfs_migration Valentin Schneider

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALOAHbDZMiLR-3NQHYPJ707Hk-3X+yjrxk_YA0xyxa40Sj7SEQ@mail.gmail.com \
    --to=laoar.shao@gmail.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=valentin.schneider@arm.com \
    --cc=vincent.guittot@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.