Re: [PATCH v4 07/11] tick/nohz: add runtime tick_nohz_full_mask update for CPU isolation
From: Frederic Weisbecker
Date: Wed Sep 23 2026 - 13:37:36 EST
Le Fri, Jul 10, 2026 at 11:28:18AM +0800, Jing Wu a écrit :
> When kernel-noise isolation is requested for a CPU at runtime via a
> cpuset isolated partition, tick suppression must be activated on the
> affected CPU without requiring nohz_full= at boot.
>
> tick_nohz_full_mask and tick_nohz_full_running are currently set only
> during boot by tick_nohz_full_setup(). There is no runtime path to add
> or remove CPUs from the full-dynticks set.
>
> Add tick_nohz_cpu_isolate() and tick_nohz_cpu_deisolate(), both called
> with the target CPU offline (between remove_cpu and add_cpu in the
> hotplug cycling path):
>
> tick_nohz_cpu_isolate(cpu) - lazily allocates tick_nohz_full_mask
> if it was never set up at boot, sets the CPU's bit in the mask,
> sets tick_nohz_full_running, and calls ct_cpu_track_user() to
> activate per-CPU context tracking so kernel/user transitions
> suppress the scheduler tick.
>
> tick_nohz_cpu_deisolate(cpu) - reverses the above: deactivates
> context tracking via ct_cpu_untrack_user(), clears the CPU's bit,
> and clears tick_nohz_full_running when the mask becomes empty.
>
> A per-function mutex guards the lazy allocation and running flag
> updates against concurrent isolation requests.
>
> Co-developed-by: Qiliang Yuan <yuanql9@xxxxxxxxxxxxxxx>
> Signed-off-by: Qiliang Yuan <yuanql9@xxxxxxxxxxxxxxx>
> Signed-off-by: Jing Wu <realwujing@xxxxxxxxx>
> ---
> include/linux/tick.h | 4 ++++
> kernel/time/tick-sched.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
tick_nohz_full_running is essentially a duplicate of
~housekeeping_cpumask(HK_TYPE_KERNEL_NOISE) and tick_nohz_full_running a
duplicate of housekeeping_enabled(HK_TYPE_KERNEL_NOISE).
Perhaps those two variables should be removed?
Thanks.
--
Frederic Weisbecker
SUSE Labs