[PATCH 3/7] sched/isolation: Use HKR_TYPE_SCHED in find_new_ilb()

Pierre Gondois posted 7 patches 1 year, 10 months ago
[PATCH 3/7] sched/isolation: Use HKR_TYPE_SCHED in find_new_ilb()
Posted by Pierre Gondois 1 year, 10 months ago
Replace the HK_TYPE_MISC isolation mask with HKR_TYPE_SCHED in
find_new_ilb(). This ultimately resolves [1], i.e. selecting
a CPU for the nohz idle balance which cannot pull tasks
through:
sched_balance_trigger()
\-nohz_balancer_kick()
  \-kick_ilb()
    \-find_new_ilb()
      \-smp_call_function_single_async()
        \-nohz_csd_cpu()
          \-raise_softirq_irqoff()
sched_balance_softirq()
\-_nohz_idle_balance()
  \-sched_balance_domains()

Indeed, a following patch will add/remove CPUs with a NULL sched
domain to the HKR_TYPE_SCHED cpumask.

[1] https://lore.kernel.org/all/20230804090858.7605-1-rui.zhang@intel.com/

Reported-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
---
 kernel/sched/fair.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index e3d707243ca7..0665f5eb4703 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -11842,16 +11842,13 @@ static inline int on_null_domain(struct rq *rq)
  * - 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
  *   load balancing for all the idle CPUs.
- *
- * - HK_TYPE_MISC CPUs are used for this task, because HK_TYPE_SCHED is not set
- *   anywhere yet.
  */
 static inline int find_new_ilb(void)
 {
 	const struct cpumask *hk_mask;
 	int ilb_cpu;
 
-	hk_mask = housekeeping_cpumask(HK_TYPE_MISC);
+	hk_mask = housekeeping_runtime_cpumask(HKR_TYPE_SCHED);
 
 	for_each_cpu_and(ilb_cpu, nohz.idle_cpus_mask, hk_mask) {
 
-- 
2.25.1