diff options
| author | Waiman Long <longman@redhat.com> | 2026-11-23 23:28:00 -0500 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-11-23 19:59:37 -1000 |
| commit | 884e88175b95a03ea9f4dc8c89acca5d5b33cbd2 (patch) | |
| tree | 8c93941233d258816458b56188c5ec110f82f26f /tools/perf/scripts/python/task-analyzer.py | |
| parent | acec9637e03ca54bd3c3a0c1a6ad5c6dfa07c0df (diff) | |
tick/sched: Make tick_nohz_full_mask and HK_TYPE_KERNEL_NOISE cpumask consistent
When the nohz_full boot parameter is first set, the cpu list parameter is
passed directly to tick_nohz_full_setup() to set up tick_nohz_full_mask
cpumask. Then the HK_TYPE_KERNEL_NOISE cpumask will be set up as the
inverse of given cpu list parameter. Some of the timer code and RCU
uses tick_nohz_full_mask directly while other timer code, scheduler
and other subsystems use the HK_TYPE_KERNEL_NOISE cpumask.
With CONFIG_PM_SLEEP_SMP && !CONFIG_PM_SLEEP_SMP_NONZERO_CPU config
options, the boot CPU will be cleared from tick_nohz_full_mask if set
while the corresponding HK_TYPE_KERNEL_NOISE cpumask isn't touched.
The nohz_full entry in kernel-parameters.txt does state that the boot
CPU will be forced outside the range to maintain the timekeeping. So it
makes sense that the HK_TYPE_KERNEL_NOISE should be modified accordingly.
Fix this inconsistency problem by adding a new cpumask_set_cpu() init
function to be called by tick_nohz_init() when the boot CPU is cleared
from tick_nohz_full_mask.
In the special case that "nohz_full=0" and CPU 0 is cleared in
tick_nohz_init(), tick_nohz_full_running will be set to false. However,
housekeeping_enabled(HK_TYPE_KERNEL_NOISE) will stil be true with
housekeeping_cpumask(HK_TYPE_KERNEL_NOISE) equal to cpu_possible_mask.
So some unneeded code paths will be activated, but no harm will be done
other than wasting some CPU cycles.
Another problem that needs further thought but is not handled in
this patch is when arch_irq_work_has_interrupt() turns out to be
false. When this happens, tick_nohz_full_mask will be cleared and
tick_nohz_full_running will be set back to false in tick_nohz_init().
PM_SLEEP_SMP_NONZERO_CPU depends on ARCH_SUSPEND_NONZERO_CPU which can
only be set for the PowerPC architecture. Moreover CONFIG_PM_SLEEP_SMP is
on by default, it means most kernels will not allow CPU 0 to be set in
the tick_nohz_full_mask and hence should be set in HK_TYPE_KERNEL_NOISE
cpumask.
Fixes: 6f1982fedd59 ("sched/isolation: Handle the nohz_full= parameter")
Signed-off-by: Waiman Long <longman@redhat.com>
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Reviewed-by: Ridong Chen <ridong.chen@linux.dev>
Acked-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
Tested-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/task-analyzer.py')
0 files changed, 0 insertions, 0 deletions
