Re: [PATCH] sched: Skip useless sched_balance_running acquisition if load balance is not due
From: K Prateek Nayak
Date: Thu Apr 17 2025 - 07:11:18 EST
Hello Shrikanth,
On 4/16/2025 7:44 PM, Shrikanth Hegde wrote:
Slightly different topic: It(kernel parameter) also resets SHCED_BALANCE_WAKE. But is it being used?
I couldn't find out how it is used.
So the usage is very convoluted. SHCED_BALANCE_WAKE is same as WF_TTWU.
kernel/sched/sched.h makes sure of it, with some static asserts. In
select_task_rq_fair(), the for_each_domain() loop has:
if (tmp->flags & sd_flag)
sd = tmp;
where sd_flag is (wake_flags & 0xF)
This boils down to (sd->flags & SD_BALANCE_FORK) for fork (WF_FORK) and
(sd->flags & SHCED_BALANCE_WAKE) for wakeup (WF_TTWU). There is more
convoluted interaction with arch specific "node_reclaim_distance" that
can clear SD_BALANCE_FORK, SD_BALANCE_EXEC, and SD_WAKE_AFFINE if a
node is deemed very far to explore balance on wakeup / fork.
Probably some of these flags can be merged now that things have
evolved but it requires a bit of auditing before jumping in.
--
Thanks and Regards,
Prateek