nohz: ignore explicit nohz=off in case of nohz_full running
From: zhengchuan
Date: Mon Nov 12 2018 - 04:03:26 EST
Hi,
It seems "nohz=" is not compatible with "nohz_full=" or "isolcpus=" by now.
when both "nohz=off" and "nohz_full=[cpulist]" or "isolcpus=nohz,domain" is configured in cmdline,
we enter an ambiguous status, that is, we do unbound timers, watchdog, RCU isolation, even show nohz_full cpu in sysfs,
but we never enter tickless mode because one-shot mode is disable by "nohz=off" in tick_nohz_switch_to_nohz().
**************
[How I resolve it]
**************
Since we want to centralize the isolation management by housekeeping subsystem, we regard "nohz_full=" or "isolcpus=" as the controller.
Just ignore explicit nohz=off when nohz_full=[cpulist] or isolcpus=nohz,domain is configured.
---
kernel/time/tick-sched.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 5b33e2f..d30d783 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -414,6 +414,8 @@ void __init tick_nohz_init(void)
if (!tick_nohz_full_running)
return;
+ if (!tick_nohz_enabled)
+ pr_warn("NO_HZ: NOHZ is disable explicitly, ignore it in case of NOHZ_FULL running\n");
/*
* Full dynticks uses irq work to drive the tick rescheduling on safe
* locking contexts. But then we need irq work to raise its own @@ -1182,7 +1184,7 @@ static void tick_nohz_handler(struct clock_event_device *dev)
static inline void tick_nohz_activate(struct tick_sched *ts, int mode) {
- if (!tick_nohz_enabled)
+ if (!tick_nohz_enabled && !tick_nohz_full_enabled())
return;
ts->nohz_mode = mode;
/* One update is enough */
@@ -1198,7 +1200,7 @@ static void tick_nohz_switch_to_nohz(void)
struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched);
ktime_t next;
- if (!tick_nohz_enabled)
+ if (!tick_nohz_enabled && !tick_nohz_full_enabled())
return;
if (tick_switch_to_oneshot(tick_nohz_handler))
--
1.7.12.4