Re: [Patch v4 17/22] sched/cache: Avoid cache-aware scheduling for memory-heavy processes

From: Chen Yu

Date: Tue Nov 17 2026 - 07:19:51 EST


On Tue, Nov 17, 2026 at 08:07:52PM +0800, Chen Yu wrote:
>
> if (!ng) {
> @@ -4210,6 +4178,15 @@ void task_numa_fault(int last_cpupid, int mem_node, int pages, int flags)
> p->numa_faults[task_faults_idx(NUMA_MEMBUF, mem_node, priv)] += pages;
> p->numa_faults[task_faults_idx(NUMA_CPUBUF, cpu_node, priv)] += pages;
> p->numa_faults_locality[local] += pages;
> +
> +#ifdef CONFIG_SCHED_CACHE
> + scoped_guard(rcu) {
> + struct sched_cache_group *grp = rcu_dereference(p->sched_cache_grp);
> +
> + if (grp)
> + atomic_long_add(pages, &grp->footprint_cur);
> + }
> +#endif

I forgot the code from Tim that firstly add the footprint into per task buffer total_footprint,
we should add back the following:

+static void sched_cache_footprint_accum(struct task_struct *p, int pages)
+{
+ p->total_footprint += pages;
+
+ if (p->total_footprint >= SCHED_CACHE_FP_THRESHOLD)
+ sched_cache_footprint_flush(p);
+}
...


thanks,
Chenyu