Re: [PATCH v3] sched/cache: Remove the old cache group footprint on exec

From: Jemmy Wong

Date: Wed Oct 21 2026 - 09:09:44 EST




> On Oct 21, 2026, at 6:12 PM, Chen Yu <yu.c.chen@xxxxxxxxx> wrote:
>
> On Thu, Oct 15, 2026 at 01:36:04PM +0800, Jemmy Wong wrote:
>
> [ ... ]
>
>> @@ -3965,36 +3974,6 @@ static void task_numa_placement(struct task_struct *p)
>> ng->total_faults += diff;
>> group_faults += ng->faults[mem_idx];
>> }
>> -#ifdef CONFIG_SCHED_CACHE
>> - /*
>> - * Per task p->numa_faults[mem_idx] converges,
>> - * so the accumulation of each task's faults
>> - * converges too - Given the number of threads,
>> - * it cannot overflow an unsigned long.
>
> Above comments can be kept for future reference, with minor adjustment:
>
> s/it cannot overflow an unsigned long/it cannot overflow an atomic_long_t
>
> I launched a full hackbench test on a Xeon with multiple LLCs per node. There
> is no obvious difference except for some false-positive regress with large
> run-to-run variance. This patch looks good to me in terms of turning the
> footprint into an accurate counter. Feel free to add:
>
> Reviewed-by: Chen Yu <yu.c.chen@xxxxxxxxx>
> Tested-by: Chen Yu <yu.c.chen@xxxxxxxxx>
>
> thanks,
> Chenyu

Hi Chenyu,

Thanks for the review and testing.

For v4, I've restored the convergence comment next to the batched
footprint update, changed the type to atomic_long_t as suggested, and
rewrapped the text:


+ /*
+ * Per task p->numa_faults[mem_idx] converges, so the accumulation of each
+ * task's faults converges too. Given the number of threads, it cannot
+ * overflow an atomic_long_t.
+ *
+ * Apply the net change once per placement pass to limit cache-line traffic.
+ */
+ sched_cache_footprint_update(p, p->total_numa_faults - old_faults);
+

Does this wording and placement look fine to you?

I'll also include your Reviewed-by and Tested-by tags in v4.

Thanks,
Jemmy