Skip to content

Commit 7c8bb6c

Browse files
fweisbecIngo Molnar
authored andcommitted
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. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Acked-by: Thomas Gleixner <tglx@linutronix.de> Cc: Chris Metcalf <cmetcalf@ezchip.com> Cc: Christoph Lameter <cl@linux.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Preeti U Murthy <preeti@linux.vnet.ibm.com> Cc: Vatika Harlalka <vatikaharlalka@gmail.com> Link: http://lkml.kernel.org/r/1441119060-2230-3-git-send-email-fweisbec@gmail.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 9642d18 commit 7c8bb6c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

kernel/time/tick-sched.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,16 +290,17 @@ static int __init tick_nohz_full_setup(char *str)
290290
__setup("nohz_full=", tick_nohz_full_setup);
291291

292292
static int tick_nohz_cpu_down_callback(struct notifier_block *nfb,
293-
unsigned long action,
294-
void *hcpu)
293+
unsigned long action,
294+
void *hcpu)
295295
{
296296
unsigned int cpu = (unsigned long)hcpu;
297297

298298
switch (action & ~CPU_TASKS_FROZEN) {
299299
case CPU_DOWN_PREPARE:
300300
/*
301-
* If we handle the timekeeping duty for full dynticks CPUs,
302-
* we can't safely shutdown that CPU.
301+
* The boot CPU handles housekeeping duty (unbound timers,
302+
* workqueues, timekeeping, ...) on behalf of full dynticks
303+
* CPUs. It must remain online when nohz full is enabled.
303304
*/
304305
if (tick_nohz_full_running && tick_do_timer_cpu == cpu)
305306
return NOTIFY_BAD;
@@ -370,6 +371,12 @@ void __init tick_nohz_init(void)
370371
cpu_notifier(tick_nohz_cpu_down_callback, 0);
371372
pr_info("NO_HZ: Full dynticks CPUs: %*pbl.\n",
372373
cpumask_pr_args(tick_nohz_full_mask));
374+
375+
/*
376+
* We need at least one CPU to handle housekeeping work such
377+
* as timekeeping, unbound timers, workqueues, ...
378+
*/
379+
WARN_ON_ONCE(cpumask_empty(housekeeping_mask));
373380
}
374381
#endif
375382

0 commit comments

Comments
 (0)