[PATCH v8 08/14] nohz_full: allow disabling the 1Hz minimum tick at boot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



While the current fallback to 1-second tick is still required for
a number of kernel accounting tasks (e.g. vruntime, load balancing
data, and load accounting), it's useful to be able to disable it
for testing purposes.  Paul McKenney observed that if we provide
a mode where the 1Hz fallback timer is removed, this will provide
an environment where new code that relies on that tick will get
punished, and we won't forgive such assumptions silently.

This option also allows easy testing of nohz_full and task-isolation
modes to determine what functionality needs to be implemented,
and what possibly-spurious timer interrupts are scheduled when
the basic 1Hz tick has been turned off.

Signed-off-by: Chris Metcalf <cmetcalf@xxxxxxxxxx>
---
 kernel/sched/core.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index b79f8e0aeffb..634d5c2ab08a 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2849,6 +2849,19 @@ void scheduler_tick(void)
 }
 
 #ifdef CONFIG_NO_HZ_FULL
+/*
+ * Allow a boot-time option to debug running
+ * without the 1Hz minimum tick on nohz_full cores.
+ */
+static bool debug_1hz_tick;
+
+static __init int set_debug_1hz_tick(char *arg)
+{
+	debug_1hz_tick = true;
+	return 1;
+}
+__setup("debug_1hz_tick", set_debug_1hz_tick);
+
 /**
  * scheduler_tick_max_deferment
  *
@@ -2867,6 +2880,9 @@ u64 scheduler_tick_max_deferment(void)
 	struct rq *rq = this_rq();
 	unsigned long next, now = READ_ONCE(jiffies);
 
+	if (debug_1hz_tick)
+		return KTIME_MAX;
+
 	next = rq->last_sched_tick + HZ;
 
 	if (time_before_eq(next, now))
-- 
2.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux