Re: [PATCH 04/19] sched/fair: Introduce a static key to enable cache aware only for multi LLCs
From: Peter Zijlstra
Date: Wed Oct 15 2025 - 07:05:22 EST
On Sat, Oct 11, 2025 at 11:24:41AM -0700, Tim Chen wrote:
> From: Chen Yu <yu.c.chen@xxxxxxxxx>
>
> Enable cache-aware load balancing only if at least 1 NUMA node has
> more than one LLC.
>
> Suggested-by: Libo Chen <libo.chen@xxxxxxxxxx>
> Suggested-by: Adam Li <adamli@xxxxxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Chen Yu <yu.c.chen@xxxxxxxxx>
> Signed-off-by: Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx>
> ---
> kernel/sched/fair.c | 15 ++++++++++++---
> kernel/sched/sched.h | 1 +
> kernel/sched/topology.c | 14 ++++++++++++--
> 3 files changed, 25 insertions(+), 5 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index cd080468ddc9..3d643449c48c 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -1208,6 +1208,14 @@ static s64 update_se(struct rq *rq, struct sched_entity *se)
> __read_mostly unsigned int llc_overload_pct = 50;
> __read_mostly unsigned int llc_imb_pct = 20;
>
> +DEFINE_STATIC_KEY_FALSE(sched_cache_allowed);
> +
> +static inline bool sched_cache_enabled(void)
> +{
> + return sched_feat(SCHED_CACHE) &&
> + static_branch_likely(&sched_cache_allowed);
> +}
Urgh; do we really need _2_ static keys stacked for this? I'm thinking
one should be well enough.