Skip to content

Commit

Permalink
sched/balancing: Rename run_rebalance_domains() => sched_balance_soft…
Browse files Browse the repository at this point in the history
…irq()

run_rebalance_domains() is a misnomer, as it doesn't only
run rebalance_domains(), but since the introduction of the
NOHZ code it also runs nohz_idle_balance().

Rename it to sched_balance_softirq(), reflecting its more
generic purpose and that it's a softirq handler.

Signed-off-by: Ingo Molnar <[email protected]>
Reviewed-by: Valentin Schneider <[email protected]>
Reviewed-by: Shrikanth Hegde <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
Ingo Molnar committed Mar 12, 2024
1 parent 33928ed commit 70a27d6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Documentation/scheduler/sched-domains.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ out of balance are tasks moved between groups.
In kernel/sched/core.c, trigger_load_balance() is run periodically on each CPU
through scheduler_tick(). It raises a softirq after the next regularly scheduled
rebalancing event for the current runqueue has arrived. The actual load
balancing workhorse, run_rebalance_domains()->rebalance_domains(), is then run
balancing workhorse, sched_balance_softirq()->rebalance_domains(), is then run
in softirq context (SCHED_SOFTIRQ).

The latter function takes two arguments: the runqueue of current CPU and whether
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ CPU共享。任意两个组的CPU掩码的交集不一定为空,如果是这

在kernel/sched/core.c中,trigger_load_balance()在每个CPU上通过scheduler_tick()
周期执行。在当前运行队列下一个定期调度再平衡事件到达后,它引发一个软中断。负载均衡真正
的工作由run_rebalance_domains()->rebalance_domains()完成,在软中断上下文中执行
的工作由sched_balance_softirq()->rebalance_domains()完成,在软中断上下文中执行
(SCHED_SOFTIRQ)。

后一个函数有两个入参:当前CPU的运行队列、它在scheduler_tick()调用时是否空闲。函数会从
Expand Down
4 changes: 2 additions & 2 deletions kernel/sched/fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -12415,7 +12415,7 @@ static int newidle_balance(struct rq *this_rq, struct rq_flags *rf)
* - indirectly from a remote scheduler_tick() for NOHZ idle balancing
* through the SMP cross-call nohz_csd_func()
*/
static __latent_entropy void run_rebalance_domains(struct softirq_action *h)
static __latent_entropy void sched_balance_softirq(struct softirq_action *h)
{
struct rq *this_rq = this_rq();
enum cpu_idle_type idle = this_rq->idle_balance;
Expand Down Expand Up @@ -13216,7 +13216,7 @@ __init void init_sched_fair_class(void)
#endif
}

open_softirq(SCHED_SOFTIRQ, run_rebalance_domains);
open_softirq(SCHED_SOFTIRQ, sched_balance_softirq);

#ifdef CONFIG_NO_HZ_COMMON
nohz.next_balance = jiffies;
Expand Down

0 comments on commit 70a27d6

Please sign in to comment.