Re: [PATCH] profiling: remove prof_cpu_mask

From: Tetsuo Handa
Date: Mon Jul 29 2024 - 08:58:41 EST


On 2024/07/28 1:54, Linus Torvalds wrote:
> On Sat, 27 Jul 2024 at 04:00, Tetsuo Handa
> <penguin-kernel@xxxxxxxxxxxxxxxxxxx> wrote:
>>
>> We could replace alloc_cpumask_var() with zalloc_cpumask_var() and
>> call cpumask_copy() from create_proc_profile() on only UP kernels, for
>> profile_online_cpu() calls cpumask_set_cpu() as needed via
>> cpuhp_setup_state(CPUHP_AP_ONLINE_DYN) on SMP kernels. But this patch
>> removes prof_cpu_mask because it seems unnecessary.
>
> So I like this one a lot more, but it actually makes me wonder: could
> we just remove the horrid per-cpu profile flip buffers entirely?

I dropped "profiling: initialize prof_cpu_mask from profile_online_cpu()" from
my tree so that someone can take this patch. Andrew, can you take this patch?
Whether somebody notices performance/accuracy problem by removing the horrid
per-cpu profile flip buffers will be attempted by a separate patch.

>
> This code predates the whole "we have _real_ profiling", and dates
> back to literally two decades ago.
>
> It's there due to ancient NUMA concerns on old SGI Altix hardware in 2004:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/commit/?id=ad02973d42f6b538c7ed76c7c0a5ae8560f65913
>
> and I think it's past time to just take all this code out of its misery.
>
> Nobody sane should use the old profile code for any real work any
> more. I'd be more than happy to just remove all the magic code and see
> if anybody even notices..
>
> Linus