Commit 7ef7145a authored by Ingo Molnar's avatar Ingo Molnar

sched/nohz: Update idle load-balancing (ILB) comments

 - Fix incorrect/misleading comments,

 - clarify some others,

 - fix typos & grammar,

 - and use more consistent style throughout.
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Reviewed-by: default avatarJoel Fernandes (Google) <joel@joelfernandes.org>
Link: https://lore.kernel.org/r/20231006102518.2452758-2-mingo@kernel.org
parent bc87127a
...@@ -11503,14 +11503,15 @@ static inline int on_null_domain(struct rq *rq) ...@@ -11503,14 +11503,15 @@ static inline int on_null_domain(struct rq *rq)
#ifdef CONFIG_NO_HZ_COMMON #ifdef CONFIG_NO_HZ_COMMON
/* /*
* idle load balancing details * NOHZ idle load balancing (ILB) details:
* - When one of the busy CPUs notice that there may be an idle rebalancing *
* - When one of the busy CPUs notices that there may be an idle rebalancing
* needed, they will kick the idle load balancer, which then does idle * needed, they will kick the idle load balancer, which then does idle
* load balancing for all the idle CPUs. * load balancing for all the idle CPUs.
* - HK_TYPE_MISC CPUs are used for this task, because HK_TYPE_SCHED not set *
* - HK_TYPE_MISC CPUs are used for this task, because HK_TYPE_SCHED is not set
* anywhere yet. * anywhere yet.
*/ */
static inline int find_new_ilb(void) static inline int find_new_ilb(void)
{ {
int ilb; int ilb;
...@@ -11531,8 +11532,10 @@ static inline int find_new_ilb(void) ...@@ -11531,8 +11532,10 @@ static inline int find_new_ilb(void)
} }
/* /*
* Kick a CPU to do the nohz balancing, if it is time for it. We pick any * Kick a CPU to do the NOHZ balancing, if it is time for it, via a cross-CPU
* idle CPU in the HK_TYPE_MISC housekeeping set (if there is one). * SMP function call (IPI).
*
* We pick the first idle CPU in the HK_TYPE_MISC housekeeping set (if there is one).
*/ */
static void kick_ilb(unsigned int flags) static void kick_ilb(unsigned int flags)
{ {
...@@ -11560,7 +11563,7 @@ static void kick_ilb(unsigned int flags) ...@@ -11560,7 +11563,7 @@ static void kick_ilb(unsigned int flags)
/* /*
* This way we generate an IPI on the target CPU which * This way we generate an IPI on the target CPU which
* is idle. And the softirq performing nohz idle load balance * is idle, and the softirq performing NOHZ idle load balancing
* will be run before returning from the IPI. * will be run before returning from the IPI.
*/ */
smp_call_function_single_async(ilb_cpu, &cpu_rq(ilb_cpu)->nohz_csd); smp_call_function_single_async(ilb_cpu, &cpu_rq(ilb_cpu)->nohz_csd);
...@@ -11589,7 +11592,7 @@ static void nohz_balancer_kick(struct rq *rq) ...@@ -11589,7 +11592,7 @@ static void nohz_balancer_kick(struct rq *rq)
/* /*
* None are in tickless mode and hence no need for NOHZ idle load * None are in tickless mode and hence no need for NOHZ idle load
* balancing. * balancing:
*/ */
if (likely(!atomic_read(&nohz.nr_cpus))) if (likely(!atomic_read(&nohz.nr_cpus)))
return; return;
...@@ -11611,9 +11614,8 @@ static void nohz_balancer_kick(struct rq *rq) ...@@ -11611,9 +11614,8 @@ static void nohz_balancer_kick(struct rq *rq)
sd = rcu_dereference(rq->sd); sd = rcu_dereference(rq->sd);
if (sd) { if (sd) {
/* /*
* If there's a CFS task and the current CPU has reduced * If there's a runnable CFS task and the current CPU has reduced
* capacity; kick the ILB to see if there's a better CPU to run * capacity, kick the ILB to see if there's a better CPU to run on:
* on.
*/ */
if (rq->cfs.h_nr_running >= 1 && check_cpu_capacity(rq, sd)) { if (rq->cfs.h_nr_running >= 1 && check_cpu_capacity(rq, sd)) {
flags = NOHZ_STATS_KICK | NOHZ_BALANCE_KICK; flags = NOHZ_STATS_KICK | NOHZ_BALANCE_KICK;
...@@ -11665,11 +11667,11 @@ static void nohz_balancer_kick(struct rq *rq) ...@@ -11665,11 +11667,11 @@ static void nohz_balancer_kick(struct rq *rq)
if (sds) { if (sds) {
/* /*
* If there is an imbalance between LLC domains (IOW we could * If there is an imbalance between LLC domains (IOW we could
* increase the overall cache use), we need some less-loaded LLC * increase the overall cache utilization), we need a less-loaded LLC
* domain to pull some load. Likewise, we may need to spread * domain to pull some load from. Likewise, we may need to spread
* load within the current LLC domain (e.g. packed SMT cores but * load within the current LLC domain (e.g. packed SMT cores but
* other CPUs are idle). We can't really know from here how busy * other CPUs are idle). We can't really know from here how busy
* the others are - so just get a nohz balance going if it looks * the others are - so just get a NOHZ balance going if it looks
* like this LLC domain has tasks we could move. * like this LLC domain has tasks we could move.
*/ */
nr_busy = atomic_read(&sds->nr_busy_cpus); nr_busy = atomic_read(&sds->nr_busy_cpus);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment