sched/nohz: Affine unpinned timers to housekeepers
Subsystems (2)
Ingo,
Please pull the sched/core branch that can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git
sched/core
HEAD: f0673808f014ae18ae4cd8cdc7daf7b3b6c0a144
---
* Move unpinned timers out of full dynticks CPUs that don't want to be disturbed (testing showed great results).
* Enforce assertion to make sure that we have housekeepers to handle unbound timers, workqueues, timekeepers. Also improve the related comments.
---
Thanks,
Frederic
---
Frederic Weisbecker (1):
nohz: Assert existing housekeepers when nohz full enabled
Vatika Harlalka (1):
nohz: Affine unpinned timers to housekeepers
include/linux/tick.h | 9 +++++++++ kernel/sched/core.c | 7 +++++-- kernel/time/tick-sched.c | 15 +++++++++++---- 3 files changed, 25 insertions(+), 6 deletions(-)
PATCH 1/2 nohz: Affine unpinned timers to housekeepers
From: Vatika Harlalka <[email protected]>
The problem addressed in this patch is about affining unpinned timers. Adaptive or Full Dynticks CPUs are currently disturbed by unnecessary jitter due to firing of such timers on them.
This patch will affine timers to online CPUs which are not full dynticks in NOHZ_FULL configured systems. It should not introduce overhead in nohz full off case due to static keys.
Signed-off by: Vatika Harlalka <[email protected]>
--- include/linux/tick.h | 9 +++++++++ kernel/sched/core.c | 7 +++++-- 2 files changed, 14 insertions(+), 2 deletions(-)
include/linux/tick.h +9 -0
@@ -147,11 +147,20 @@ static inline void tick_nohz_full_add_cpus_to(struct cpumask *mask) cpumask_or(mask, mask, tick_nohz_full_mask); } +static inline int housekeeping_any_cpu (void ) +{ +return cpumask_any_and (housekeeping_mask, cpu_online_mask); +} +extern void tick_nohz_full_kick (void );extern void tick_nohz_full_kick_cpu (int cpu);extern void tick_nohz_full_kick_all (void );extern void __tick_nohz_task_switch (void );#else +static inline int housekeeping_any_cpu (void ) +{ +return smp_processor_id (); +}static inline bool tick_nohz_full_enabled (void ) {return false; }static inline bool tick_nohz_full_cpu (int cpu) {return false; }static inline void tick_nohz_full_add_cpus_to (struct cpumask *mask) { }
kernel/sched/core.c +5 -2
@@ -623,18 +623,21 @@ int get_nohz_timer_target(void)int i, cpu =smp_processor_id ();struct sched_domain *sd; -if (!idle_cpu (cpu)) +if (!idle_cpu (cpu) &&is_housekeeping_cpu (cpu))return cpu;rcu_read_lock ();for_each_domain (cpu, sd) {for_each_cpu (i,sched_domain_span (sd)) { -if (!idle_cpu (i)) { +if (!idle_cpu (i) &&is_housekeeping_cpu (cpu)) { cpu = i; goto unlock; } } } + +if (!is_housekeeping_cpu (cpu)) + cpu =housekeeping_any_cpu (); unlock:rcu_read_unlock ();return cpu;
Signature · 1 line
2.1.4
RE: [PATCH 1/2] nohz: Affine unpinned timers to housekeepers
Quoted 66 lines
-----Original Message-----
From: [email protected] [mailto:linux-kernel- [email protected]] On Behalf Of Frederic Weisbecker
Sent: Tuesday, September 1, 2015 7:51 AM
To: Ingo Molnar; Peter Zijlstra
Cc: LKML; Vatika Harlalka; Chris Metcalf; Thomas Gleixner; Preeti U Murthy; Christoph Lameter; Frederic Weisbecker; Paul E . McKenney
Subject: [PATCH 1/2] nohz: Affine unpinned timers to housekeepersFrom: Vatika Harlalka <[email protected]>
The problem addressed in this patch is about affining unpinned timers. Adaptive or Full Dynticks CPUs are currently disturbed by unnecessary jitter due to firing of such timers on them.
This patch will affine timers to online CPUs which are not full dynticks in
NOHZ_FULLconfigured systems. It should not introduce overhead in nohz full off case due to static keys.Reviewed-by Preeti U Murthy <[email protected]>Signed-off by: Vatika Harlalka <[email protected]>
Cc Ingo Molnar <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Christoph Lameter <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Paul E. McKenney <[email protected]>Cc Chris Metcalf <[email protected]>Signed-off-by Frederic Weisbecker <[email protected]>--- include/linux/tick.h | 9 +++++++++ kernel/sched/core.c | 7 +++++-- 2 files changed, 14 insertions(+), 2 deletions(-)include/linux/tick.h +9
-0@@ -147,11 +147,20 @@ static inline void tick_nohz_full_add_cpus_to(struct cpumask *mask) cpumask_or(mask, mask, tick_nohz_full_mask); } +static inline int housekeeping_any_cpu (void ) +{ +return cpumask_any_and (housekeeping_mask, cpu_online_mask); +} +extern void tick_nohz_full_kick (void );extern void tick_nohz_full_kick_cpu (int cpu);extern void tick_nohz_full_kick_all (void );extern void __tick_nohz_task_switch (void );#else +static inline int housekeeping_any_cpu (void ) +{ +return smp_processor_id (); +}static inline bool tick_nohz_full_enabled (void ) {return false; }static inline bool tick_nohz_full_cpu (int cpu) {return false; }static inline void
tick_nohz_full_add_cpus_to(struct cpumask *mask){ }kernel/sched/core.c +0
-0@@ -623,18 +623,21 @@ int get_nohz_timer_target(void)int i, cpu =smp_processor_id ();struct sched_domain *sd;
kernel/sched/core.c int get_nohz_timer_target(void) · line 632
Quoted 10 lines
kernel/sched/core.c +2
-2-if (!idle_cpu (cpu)) +if (!idle_cpu (cpu) &&is_housekeeping_cpu (cpu))return cpu;rcu_read_lock ();for_each_domain (cpu, sd) {for_each_cpu (i,sched_domain_span (sd)) { -if (!idle_cpu (i)) { +if (!idle_cpu (i) &&is_housekeeping_cpu (cpu)) {
Hi, Frederic, sorry for a naive question. Per my understanding, the tick_nohz_full_mask is added to cpu_isolated_map in sched_init_smp(), and the cpu_isolated_map is excluded from sched_domain in init_sched_domains(), so why check here?
Thanks
--jyh
Re: [PATCH 1/2] nohz: Affine unpinned timers to housekeepers
Quoted 12 lines · Yunhong
Quoted 12 lines
kernel/sched/core.c +1
-1@@ -623,18 +623,21 @@ int get_nohz_timer_target(void)int i, cpu =smp_processor_id ();struct sched_domain *sd; -if (!idle_cpu (cpu)) +if (!idle_cpu (cpu) &&is_housekeeping_cpu (cpu))return cpu;
Quoted 8 lines
kernel/sched/core.c int get_nohz_timer_target(void) · line 632
Quoted 5 lines
kernel/sched/core.c +1
-1rcu_read_lock ();for_each_domain (cpu, sd) {for_each_cpu (i,sched_domain_span (sd)) { -if (!idle_cpu (i)) { +if (!idle_cpu (i) &&is_housekeeping_cpu (cpu)) {Hi, Frederic, sorry for a naive question. Per my understanding, the
tick_nohz_full_maskis added tocpu_isolated_mapinsched_init_smp(), and thecpu_isolated_mapis excluded fromsched_domainininit_sched_domains(), so why check here?
Very good observation! But it's better to keep this check in the domain loop in case things change in the future such as removing that cpu_isolated_map inclusion or other suprises.
Re: [PATCH 1/2] nohz: Affine unpinned timers to housekeepers
Quoted 22 lines · Frederic Weisbecker
Quoted 12 lines · Yunhong
Quoted 12 lines
kernel/sched/core.c +1
-1@@ -623,18 +623,21 @@ int get_nohz_timer_target(void)int i, cpu =smp_processor_id ();struct sched_domain *sd; -if (!idle_cpu (cpu)) +if (!idle_cpu (cpu) &&is_housekeeping_cpu (cpu))return cpu;Quoted 8 lines
kernel/sched/core.c int get_nohz_timer_target(void) · line 632
Quoted 5 lines
kernel/sched/core.c +1
-1rcu_read_lock ();for_each_domain (cpu, sd) {for_each_cpu (i,sched_domain_span (sd)) { -if (!idle_cpu (i)) { +if (!idle_cpu (i) &&is_housekeeping_cpu (cpu)) {Hi, Frederic, sorry for a naive question. Per my understanding, the
tick_nohz_full_maskis added tocpu_isolated_mapinsched_init_smp(), and thecpu_isolated_mapis excluded fromsched_domainininit_sched_domains(), so why check here?
Quoted 3 lines
Very good observation! But it's better to keep this check in the domain loop in case things change in the future such as removing that
cpu_isolated_mapinclusion or other suprises.
IMHO, nohz_full -> cpu_isolated_map removal really wants to happen. NO_HZ_FULL_ALL currently means "Woohoo, next stop NR_CPUS=0".
-Mike
Re: [PATCH 1/2] nohz: Affine unpinned timers to housekeepers
Quoted 23 lines · Mike Galbraith
Quoted 22 lines · Frederic Weisbecker
Quoted 20 lines · Yunhong
Quoted 7 lines
kernel/sched/core.c +0
-0@@ -623,18 +623,21 @@ int get_nohz_timer_target(void)int i, cpu =smp_processor_id ();struct sched_domain *sd;kernel/sched/core.c int get_nohz_timer_target(void) · line 632
Quoted 10 lines
kernel/sched/core.c +2
-2-if (!idle_cpu (cpu)) +if (!idle_cpu (cpu) &&is_housekeeping_cpu (cpu))return cpu;rcu_read_lock ();for_each_domain (cpu, sd) {for_each_cpu (i,sched_domain_span (sd)) { -if (!idle_cpu (i)) { +if (!idle_cpu (i) &&is_housekeeping_cpu (cpu)) {Hi, Frederic, sorry for a naive question. Per my understanding, the
tick_nohz_full_maskis added tocpu_isolated_mapinsched_init_smp(), and thecpu_isolated_mapis excluded fromsched_domainininit_sched_domains(), so why check here?
Quoted 6 lines
Quoted 3 lines
Very good observation! But it's better to keep this check in the domain loop in case things change in the future such as removing that
cpu_isolated_mapinclusion or other suprises.IMHO,
nohz_full->cpu_isolated_mapremoval really wants to happen.NO_HZ_FULL_ALLcurrently means "Woohoo, next stop NR_CPUS=0".
(which surprises folks who have [had] it enabled [and may even have been using and/or testing it])
Re: [PATCH 1/2] nohz: Affine unpinned timers to housekeepers
In reply to Mike GalbraithQuoted 2 lines · Mike Galbraith
IMHO,
nohz_full->cpu_isolated_mapremoval really wants to happen.NO_HZ_FULL_ALLcurrently means "Woohoo, next stop NR_CPUS=0".
Yeah, the problem seems to be folks who use it as a kind of "hey, maybe this gives me some optimization boost somewhere" kind of setting. Did we ever hear actual use cases for people who benefited from running nohz_full on cpus with an active scheduler, i.e. no isolcpus for that core? I find it hard to imagine, but, maybe...?
If we don't have such use cases, what should we do here? I'm slightly sympathetic to these folks who are going "Gee, my machine suddenly got way slower", but only in the same sense as people who shoot themselves in the foot and then say "Gee, my foot is bleeding". But maybe I'm being too hard core :-)
Signature · 2 lines
Chris Metcalf, EZChip Semiconductor http://www.ezchip.com
RE: [PATCH 1/2] nohz: Affine unpinned timers to housekeepers
Quoted 9 lines
-----Original Message-----
From: Chris Metcalf [mailto:[email protected]]
Sent: Wednesday, September 2, 2015 9:17 AM
To: Mike Galbraith; Frederic Weisbecker
Cc: Jiang, Yunhong; Ingo Molnar; Peter Zijlstra; LKML; Vatika Harlalka; Thomas Gleixner; Preeti U Murthy; Christoph Lameter; Paul E . McKenney
Subject: Re: [PATCH 1/2] nohz: Affine unpinned timers to housekeepersOn 09/02/2015 05:38 AM, Mike Galbraith wrote:
Quoted 9 lines
Quoted 2 lines
IMHO,
nohz_full->cpu_isolated_mapremoval really wants to happen.NO_HZ_FULL_ALLcurrently means "Woohoo, next stop NR_CPUS=0".Yeah, the problem seems to be folks who use it as a kind of "hey, maybe this gives me some optimization boost somewhere" kind of setting. Did we ever hear actual use cases for people who benefited from running
nohz_fullon cpus with an active scheduler, i.e. no isolcpus for that core? I find it hard to imagine, but, maybe...?
I think they can use cpuset instead of isolcpus, like Viresh stated https://lkml.org/lkml/2014/4/14/199 . This patch in fact removes one gap between cpuset and isolcpus.
Thanks
--jyh ���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Re: [PATCH 1/2] nohz: Affine unpinned timers to housekeepers
In reply to Chris MetcalfQuoted 9 lines · Chris Metcalf
Quoted 2 lines · Mike Galbraith
IMHO,
nohz_full->cpu_isolated_mapremoval really wants to happen.NO_HZ_FULL_ALLcurrently means "Woohoo, next stop NR_CPUS=0".Yeah, the problem seems to be folks who use it as a kind of "hey, maybe this gives me some optimization boost somewhere" kind of setting. Did we ever hear actual use cases for people who benefited from running
nohz_fullon cpus with an active scheduler, i.e. no isolcpus for that core? I find it hard to imagine, but, maybe...?
The only sane usage atm is my entire box (small, big likely won't boot) is a dedicated specialist. Previously, you could also have had the feature is valuable enough that I'm willing to pay the quite high price to have this feature available for whenever I feel like using it.
Quoted 5 lines
If we don't have such use cases, what should we do here? I'm slightly sympathetic to these folks who are going "Gee, my machine suddenly got way slower", but only in the same sense as people who shoot themselves in the foot and then say "Gee, my foot is bleeding". But maybe I'm being too hard core :-)
I think it's bloody stupid to declare nohz_full cpus dead when they can in fact do generic work. There's no reason to do so... unless maybe we really do need to hold the hand of poor ole Aunt Tilly... the hapless HPC administrator who can't figure out how to use cpusets or such.
When the overhead goes away, dynamic usage will become a lot more _practical_, but you can do it in the here and now modulo the cost and that bogus death certificate. They ain't dead, two patches combined to bury the poor things alive.
-Mike
Re: [PATCH 1/2] nohz: Affine unpinned timers to housekeepers
In reply to Frederic WeisbeckerQuoted 22 lines · On Tue, 1 Sep 2015 22:47:24 +0200 Frederic Weisbecker <[email protected]>…
Quoted 12 lines · Yunhong
Quoted 12 lines
kernel/sched/core.c +1
-1@@ -623,18 +623,21 @@ int get_nohz_timer_target(void)int i, cpu =smp_processor_id ();struct sched_domain *sd; -if (!idle_cpu (cpu)) +if (!idle_cpu (cpu) &&is_housekeeping_cpu (cpu))return cpu;Quoted 8 lines
kernel/sched/core.c int get_nohz_timer_target(void) · line 632
Quoted 5 lines
kernel/sched/core.c +1
-1rcu_read_lock ();for_each_domain (cpu, sd) {for_each_cpu (i,sched_domain_span (sd)) { -if (!idle_cpu (i)) { +if (!idle_cpu (i) &&is_housekeeping_cpu (cpu)) {Hi, Frederic, sorry for a naive question. Per my understanding, the
tick_nohz_full_maskis added tocpu_isolated_mapinsched_init_smp(), and thecpu_isolated_mapis excluded fromsched_domainininit_sched_domains(), so why check here?
Quoted 3 lines
Very good observation! But it's better to keep this check in the domain loop in case things change in the future such as removing that
cpu_isolated_mapinclusion or other suprises.
I have another observation.
As nohz_full cores are already excluded from the sched domains, this patch boils down to migrating timers which are queued by the nohz_full core itself. However, it only fully works for lowres timers. hrtimers may still fire on nohz_full cores, because hrtimers are only migrated if the core returned by get_nohz_timer_target() has a queued timer expiring before than the timer being migrated.
Re: [PATCH 1/2] nohz: Affine unpinned timers to housekeepers
Quoted 29 lines · Luiz Capitulino
Quoted 22 lines · On Tue, 1 Sep 2015 22:47:24 +0200 Frederic Weisbecker <[email protected]>…
Quoted 12 lines · Yunhong
Quoted 12 lines
kernel/sched/core.c +1
-1@@ -623,18 +623,21 @@ int get_nohz_timer_target(void)int i, cpu =smp_processor_id ();struct sched_domain *sd; -if (!idle_cpu (cpu)) +if (!idle_cpu (cpu) &&is_housekeeping_cpu (cpu))return cpu;Quoted 8 lines
kernel/sched/core.c int get_nohz_timer_target(void) · line 632
Quoted 5 lines
kernel/sched/core.c +1
-1rcu_read_lock ();for_each_domain (cpu, sd) {for_each_cpu (i,sched_domain_span (sd)) { -if (!idle_cpu (i)) { +if (!idle_cpu (i) &&is_housekeeping_cpu (cpu)) {Hi, Frederic, sorry for a naive question. Per my understanding, the
tick_nohz_full_maskis added tocpu_isolated_mapinsched_init_smp(), and thecpu_isolated_mapis excluded fromsched_domainininit_sched_domains(), so why check here?Quoted 3 lines
Very good observation! But it's better to keep this check in the domain loop in case things change in the future such as removing that
cpu_isolated_mapinclusion or other suprises.
Quoted 8 lines
I have another observation.
As
nohz_fullcores are already excluded from the sched domains, this patch boils down to migrating timers which are queued by thenohz_fullcore itself. However, it only fully works for lowres timers. hrtimers may still fire onnohz_fullcores, because hrtimers are only migrated if the core returned byget_nohz_timer_target()has a queued timer expiring before than the timer being migrated.
That's right. Probably some of them may never move to another CPU if they have very small delays (smaller than those of hrtimer enqueued on other housekeepers). And if they reach a housekeeper they can still move back to nohz full CPUs later if they are modified from them.
The only safe solution is to always drive unbound hrtimers from housekeepers.
tip-bot for Vatika Harlalka
merge bot[tip:sched/urgent] nohz: Affine unpinned timers to housekeepers
In reply to Frederic Weisbeckernohz: Affine unpinned timers to housekeepers
Commit-ID: 9642d18eee2cd169b60c6ac0f20bda745b5a3d1e Gitweb: http://git.kernel.org/tip/9642d18eee2cd169b60c6ac0f20bda745b5a3d1e Author: Vatika Harlalka <[email protected]> AuthorDate: Tue, 1 Sep 2015 16:50:59 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 2 Sep 2015 10:33:22 +0200
nohz: Affine unpinned timers to housekeepers
The problem addressed in this patch is about affining unpinned timers. Adaptive or Full Dynticks CPUs are currently disturbed by unnecessary jitter due to firing of such timers on them.
This patch will affine timers to online CPUs which are not full dynticks in NOHZ_FULL configured systems. It should not introduce overhead in nohz full off case due to static keys.
--- include/linux/tick.h | 9 +++++++++ kernel/sched/core.c | 7 +++++-- 2 files changed, 14 insertions(+), 2 deletions(-)
include/linux/tick.h +9 -0
@@ -147,11 +147,20 @@ static inline void tick_nohz_full_add_cpus_to(struct cpumask *mask) cpumask_or(mask, mask, tick_nohz_full_mask); } +static inline int housekeeping_any_cpu (void ) +{ +return cpumask_any_and (housekeeping_mask, cpu_online_mask); +} +extern void tick_nohz_full_kick (void );extern void tick_nohz_full_kick_cpu (int cpu);extern void tick_nohz_full_kick_all (void );extern void __tick_nohz_task_switch (void );#else +static inline int housekeeping_any_cpu (void ) +{ +return smp_processor_id (); +}static inline bool tick_nohz_full_enabled (void ) {return false; }static inline bool tick_nohz_full_cpu (int cpu) {return false; }static inline void tick_nohz_full_add_cpus_to (struct cpumask *mask) { }
kernel/sched/core.c +5 -2
@@ -623,18 +623,21 @@ int get_nohz_timer_target(void)int i, cpu =smp_processor_id ();struct sched_domain *sd; -if (!idle_cpu (cpu)) +if (!idle_cpu (cpu) &&is_housekeeping_cpu (cpu))return cpu;rcu_read_lock ();for_each_domain (cpu, sd) {for_each_cpu (i,sched_domain_span (sd)) { -if (!idle_cpu (i)) { +if (!idle_cpu (i) &&is_housekeeping_cpu (cpu)) { cpu = i; goto unlock; } } } + +if (!is_housekeeping_cpu (cpu)) + cpu =housekeeping_any_cpu (); unlock:rcu_read_unlock ();return cpu;
PATCH 2/2 nohz: Assert existing housekeepers when nohz full enabled
In reply to Frederic WeisbeckerThe code ensures that when nohz full is running, at least the boot CPU serves as a housekeeper and it can't be later offlined.
Let's assert this assumption to make sure that we have CPUs to handle unbound jobs like workqueues and timers while nohz full CPUs run undisturbed.
Also improve the comments on housekeeper offlining prevention.
--- kernel/time/tick-sched.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
kernel/time/tick-sched.c +11 -4
@@ -290,16 +290,17 @@ static int __init tick_nohz_full_setup(char *str)__setup ("nohz_full=" , tick_nohz_full_setup);static int tick_nohz_cpu_down_callback (struct notifier_block *nfb, -unsigned long action, -void *hcpu) +unsigned long action, +void *hcpu) {unsigned int cpu = (unsigned long )hcpu;switch (action & ~CPU_TASKS_FROZEN ) {case CPU_DOWN_PREPARE :/* -* If we handle the timekeeping duty for full dynticks CPUs, -* we can't safely shutdown that CPU. +* The boot CPU handles housekeeping duty (unbound timers, +* workqueues, timekeeping, ...) on behalf of full dynticks +* CPUs. It must remain online when nohz full is enabled. */ if (tick_nohz_full_running && tick_do_timer_cpu == cpu)return NOTIFY_BAD ;
@@ -370,6 +371,12 @@ void __init tick_nohz_init(void)cpu_notifier (tick_nohz_cpu_down_callback,0 );pr_info ("NO_HZ: Full dynticks CPUs: %*pbl.\n" ,cpumask_pr_args (tick_nohz_full_mask)); + +/* +* We need at least one CPU to handle housekeeping work such +* as timekeeping, unbound timers, workqueues, ... +*/ + WARN_ON_ONCE(cpumask_empty(housekeeping_mask)); }#endif
Signature · 1 line
2.1.4
tip-bot for Frederic Weisbecker
merge bot[tip:sched/urgent] nohz: Assert existing housekeepers when nohz full enabled
nohz: Assert existing housekeepers when nohz full enabled
Commit-ID: 7c8bb6cb95061b3143759459ed6c6b0c73bcfecb Gitweb: http://git.kernel.org/tip/7c8bb6cb95061b3143759459ed6c6b0c73bcfecb Author: Frederic Weisbecker <[email protected]> AuthorDate: Tue, 1 Sep 2015 16:51:00 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 2 Sep 2015 10:33:22 +0200
nohz: Assert existing housekeepers when nohz full enabled
The code ensures that when nohz full is running, at least the boot CPU serves as a housekeeper and it can't be later offlined.
Let's assert this assumption to make sure that we have CPUs to handle unbound jobs like workqueues and timers while nohz full CPUs run undisturbed.
Also improve the comments on housekeeper offlining prevention.
--- kernel/time/tick-sched.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
kernel/time/tick-sched.c +11 -4
@@ -290,16 +290,17 @@ static int __init tick_nohz_full_setup(char *str)__setup ("nohz_full=" , tick_nohz_full_setup);static int tick_nohz_cpu_down_callback (struct notifier_block *nfb, -unsigned long action, -void *hcpu) +unsigned long action, +void *hcpu) {unsigned int cpu = (unsigned long )hcpu;switch (action & ~CPU_TASKS_FROZEN ) {case CPU_DOWN_PREPARE :/* -* If we handle the timekeeping duty for full dynticks CPUs, -* we can't safely shutdown that CPU. +* The boot CPU handles housekeeping duty (unbound timers, +* workqueues, timekeeping, ...) on behalf of full dynticks +* CPUs. It must remain online when nohz full is enabled. */ if (tick_nohz_full_running && tick_do_timer_cpu == cpu)return NOTIFY_BAD ;
@@ -370,6 +371,12 @@ void __init tick_nohz_init(void)cpu_notifier (tick_nohz_cpu_down_callback,0 );pr_info ("NO_HZ: Full dynticks CPUs: %*pbl.\n" ,cpumask_pr_args (tick_nohz_full_mask)); + +/* +* We need at least one CPU to handle housekeeping work such +* as timekeeping, unbound timers, workqueues, ... +*/ + WARN_ON_ONCE(cpumask_empty(housekeeping_mask)); }#endif