Skip to contentSkip to conversation

nohz: More Kconfig and Rcu improvements

GIT PULL New Frederic Weisbecker 2 participants 7 messages Apr 15, 2013 – Apr 16, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Ingo,

Please pull the latest timers/nohz branch that can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git
timers/nohz

HEAD: 65d798f0f9339ae2c4ebe9480e3260b33382a584

This fixes some of the issues you've reported. There is still the dependency on CONFIG_VIRT_CPU_ACCOUNTING_GEN to fix, probably in the Kconfig side. Stay tuned.

Thanks.

---
Frederic Weisbecker (4):
nohz: Fix old dynticks idle Kconfig backward compatibility
nohz: Switch from "extended nohz" to "full nohz" based naming
nohz: Align periodic tick Kconfig with other choices' naming
convention
nohz: Improve a bit the full dynticks Kconfig documentation

Paul E. McKenney (1):
rcu: Kick adaptive-ticks CPUs that are holding up RCU grace periods

 Documentation/kernel-parameters.txt |    4 +-
 include/linux/tick.h                |    6 ++--
 kernel/rcutree.c                    |   10 ++++++
 kernel/rcutree.h                    |    1 +
 kernel/rcutree_plugin.h             |   18 +++++++++++
 kernel/sched/core.c                 |    6 ++--
 kernel/time/Kconfig                 |   26 ++++++++++------
 kernel/time/tick-broadcast.c        |    2 +-
 kernel/time/tick-common.c           |    2 +-
 kernel/time/tick-sched.c            |   54 +++++++++++++++++-----------------
 10 files changed, 82 insertions(+), 47 deletions(-)
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/5 nohz: Fix old dynticks idle Kconfig backward compatibility

In order to enforce backward compatibility with older config files, we want the new dynticks-idle Kconfig entry to default its value to the one of the old CONFIG_NO_HZ symbol if present.

Namely we want:

config NO_HZ # old obsolete dynticks idle symbol
bool

config NO_HZ_IDLE # new dynticks idle symbol
default NO_HZ

However Kconfig prevents this to work if the old symbol is not visible. And this is currently the case because NO_HZ lacks a title in order to show it in make oldconfig and alike.

To fix this, bring a minimal title and help text to the obsolete Kconfig entry that explains its purpose. This makes the "defaulting" to work.

Cc Chris Metcalf <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc Geoff Levand <[email protected]>
Cc Gilad Ben Yossef <[email protected]>
Cc Hakan Akkan <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Li Zhong <[email protected]>
Cc Paul E. McKenney <[email protected]>
Cc Paul Gortmaker <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 kernel/time/Kconfig |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
kernel/time/Kconfig +8 -4
index 27cc404..cbe64be 100644
@@ -75,10 +75,6 @@ config NO_HZ_COMMON
 	depends on !ARCH_USES_GETTIMEOFFSET && GENERIC_CLOCKEVENTS
 	select TICK_ONESHOT
 
-# Kept around for compatibility, maps to NO_HZ_IDLE
-config NO_HZ
-	bool
-
 choice
 	prompt "Timer tick handling"
 	default NO_HZ_IDLE if NO_HZ
@@ -130,6 +126,14 @@ config NO_HZ_EXTENDED
 
 endchoice
 
+config NO_HZ
+	bool "Old Idle dynticks config"
+	depends on !ARCH_USES_GETTIMEOFFSET && GENERIC_CLOCKEVENTS
+	help
+	  This is the old config entry that enables dynticks idle.
+	  We keep it around for a little while to enforce backward
+	  compatibility with older config files.
+
 config HIGH_RES_TIMERS
 	bool "High Resolution Timer Support"
 	depends on !ARCH_USES_GETTIMEOFFSET && GENERIC_CLOCKEVENTS
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH 2/5 nohz: Switch from "extended nohz" to "full nohz" based naming

In reply to Frederic Weisbecker

"Extended nohz" was used as a naming base for the full dynticks API and Kconfig symbols. It reflects the fact the system tries to stop the tick in more places than just idle.

But that "extended" name is a bit opaque and vague. Rename it to "full" makes it clearer what the system tries to do under this
config: try to shutdown the tick anytime it can. The various constraints that prevent that to happen shouldn't be considered as fundamental properties of this feature but rather technical issues that may be solved in the future.

Cc Chris Metcalf <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc Geoff Levand <[email protected]>
Cc Gilad Ben Yossef <[email protected]>
Cc Hakan Akkan <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Li Zhong <[email protected]>
Cc Paul E. McKenney <[email protected]>
Cc Paul Gortmaker <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 Documentation/kernel-parameters.txt |    4 +-
 include/linux/tick.h                |    6 ++--
 kernel/sched/core.c                 |    6 ++--
 kernel/time/Kconfig                 |    4 +-
 kernel/time/tick-broadcast.c        |    2 +-
 kernel/time/tick-common.c           |    2 +-
 kernel/time/tick-sched.c            |   54 +++++++++++++++++-----------------
 7 files changed, 39 insertions(+), 39 deletions(-)
Documentation/kernel-parameters.txt +2 -2
index 231698f..82365dd 100644
@@ -1913,8 +1913,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 			Valid arguments: on, off
 			Default: on
 
-	nohz_extended=  [KNL,BOOT]
-			In kernels built with CONFIG_NO_HZ_EXTENDED=y, set
+	nohz_full=	[KNL,BOOT]
+			In kernels built with CONFIG_NO_HZ_FULL=y, set
 			the specified list of CPUs whose tick will be stopped
 			whenever possible. You need to keep at least one online
 			CPU outside the range to maintain the timekeeping.
include/linux/tick.h +3 -3
index 5e40333..b4e3b0c 100644
@@ -157,10 +157,10 @@ static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; }
 static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }
 # endif /* !CONFIG_NO_HZ_COMMON */
 
-#ifdef CONFIG_NO_HZ_EXTENDED
-extern int tick_nohz_extended_cpu(int cpu);
+#ifdef CONFIG_NO_HZ_FULL
+extern int tick_nohz_full_cpu(int cpu);
 #else
-static inline int tick_nohz_extended_cpu(int cpu) { return 0; }
+static inline int tick_nohz_full_cpu(int cpu) { return 0; }
 #endif
 
 
kernel/sched/core.c +3 -3
index 9bb397d..0f0a5b3 100644
@@ -617,9 +617,9 @@ static void wake_up_idle_cpu(int cpu)
 		smp_send_reschedule(cpu);
 }
 
-static bool wake_up_extended_nohz_cpu(int cpu)
+static bool wake_up_full_nohz_cpu(int cpu)
 {
-	if (tick_nohz_extended_cpu(cpu)) {
+	if (tick_nohz_full_cpu(cpu)) {
 		if (cpu != smp_processor_id() ||
 		    tick_nohz_tick_stopped())
 			smp_send_reschedule(cpu);
@@ -631,7 +631,7 @@ static bool wake_up_extended_nohz_cpu(int cpu)
 
 void wake_up_nohz_cpu(int cpu)
 {
-	if (!wake_up_extended_nohz_cpu(cpu))
+	if (!wake_up_full_nohz_cpu(cpu))
 		wake_up_idle_cpu(cpu);
 }
 
kernel/time/Kconfig +2 -2
index cbe64be..4a17b50 100644
@@ -96,7 +96,7 @@ config NO_HZ_IDLE
 
 	  Most of the time you want to say Y here.
 
-config NO_HZ_EXTENDED
+config NO_HZ_FULL
 	bool "Full dynticks system (tickless single task)"
 	# NO_HZ_COMMON dependency
 	depends on !ARCH_USES_GETTIMEOFFSET && GENERIC_CLOCKEVENTS
@@ -115,7 +115,7 @@ config NO_HZ_EXTENDED
 	 task on the CPU. Chances for running tickless are maximized when
 	 the task mostly runs in userspace and has few kernel activity.
 
-	 You need to fill up the nohz_extended boot parameter with the
+	 You need to fill up the nohz_full boot parameter with the
 	 desired range of dynticks CPUs.
 
 	 This is implemented at the expense of some overhead in user <-> kernel
kernel/time/tick-broadcast.c +1 -1
index 8a6875c..a3a3123 100644
@@ -573,7 +573,7 @@ void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
 		bc->event_handler = tick_handle_oneshot_broadcast;
 
 		/* Take the do_timer update */
-		if (!tick_nohz_extended_cpu(cpu))
+		if (!tick_nohz_full_cpu(cpu))
 			tick_do_timer_cpu = cpu;
 
 		/*
kernel/time/tick-common.c +1 -1
index b7dc0cb..83f2bd9 100644
@@ -163,7 +163,7 @@ static void tick_setup_device(struct tick_device *td,
 		 * this cpu:
 		 */
 		if (tick_do_timer_cpu == TICK_DO_TIMER_BOOT) {
-			if (!tick_nohz_extended_cpu(cpu))
+			if (!tick_nohz_full_cpu(cpu))
 				tick_do_timer_cpu = cpu;
 			else
 				tick_do_timer_cpu = TICK_DO_TIMER_NONE;
kernel/time/tick-sched.c +27 -27

128 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#3 lore raw

PATCH 3/5 nohz: Align periodic tick Kconfig with other choices' naming convention

In reply to Frederic Weisbecker

Rename CONFIG_PERIODIC_HZ to CONFIG_HZ_PERIODIC in order to stay consistent with other tick implementation entries:

CONFIG_HZ_PERIODIC
CONFIG_NO_HZ_IDLE
CONFIG_NO_HZ_FULL

Cc Chris Metcalf <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc Geoff Levand <[email protected]>
Cc Gilad Ben Yossef <[email protected]>
Cc Hakan Akkan <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Li Zhong <[email protected]>
Cc Paul E. McKenney <[email protected]>
Cc Paul Gortmaker <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 kernel/time/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/time/Kconfig +1 -1
index 4a17b50..3b68322 100644
@@ -79,7 +79,7 @@ choice
 	prompt "Timer tick handling"
 	default NO_HZ_IDLE if NO_HZ
 
-config PERIODIC_HZ
+config HZ_PERIODIC
 	bool "Periodic timer ticks (constant rate, no dynticks)"
 	help
 	  This option keeps the tick running periodically at a constant
Signature · 1 line
1.7.5.4
#4 lore raw

PATCH 4/5 nohz: Improve a bit the full dynticks Kconfig documentation

In reply to Frederic Weisbecker

Remove the "single task" statement from CONFIG_NO_HZ_FULL title. The constraint can be invalidated when tasks from other sched classes than SCHED_FAIR are running. Moreover it's possible that hrtick join the party in the future.

Also add a line about the dependency on SMP.

Cc Chris Metcalf <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc Geoff Levand <[email protected]>
Cc Gilad Ben Yossef <[email protected]>
Cc Hakan Akkan <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Li Zhong <[email protected]>
Cc Paul E. McKenney <[email protected]>
Cc Paul Gortmaker <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 kernel/time/Kconfig |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
kernel/time/Kconfig +5 -3
index 3b68322..358d601 100644
@@ -97,11 +97,13 @@ config NO_HZ_IDLE
 	  Most of the time you want to say Y here.
 
 config NO_HZ_FULL
-	bool "Full dynticks system (tickless single task)"
+	bool "Full dynticks system (tickless)"
 	# NO_HZ_COMMON dependency
 	depends on !ARCH_USES_GETTIMEOFFSET && GENERIC_CLOCKEVENTS
-	# RCU_USER_QS
-	depends on HAVE_CONTEXT_TRACKING && SMP
+	# We need at least one periodic CPU for timekeeping
+	depends on SMP
+	# RCU_USER_QS dependency
+	depends on HAVE_CONTEXT_TRACKING
 	# RCU_NOCB_CPU dependency
 	depends on TREE_RCU || TREE_PREEMPT_RCU
 	depends on VIRT_CPU_ACCOUNTING_GEN
Signature · 1 line
1.7.5.4
#5 lore raw

PATCH 5/5 rcu: Kick adaptive-ticks CPUs that are holding up RCU grace periods

In reply to Frederic Weisbecker

From: "Paul E. McKenney" <[email protected]>

Adaptive-ticks CPUs inform RCU when they enter kernel mode, but they do not necessarily turn the scheduler-clock tick back on. This state of affairs could result in RCU waiting on an adaptive-ticks CPU running for an extended period in kernel mode. Such a CPU will never run the RCU state machine, and could therefore indefinitely extend the RCU state machine, sooner or later resulting in an OOM condition.

This patch, inspired by an earlier patch by Frederic Weisbecker, therefore causes RCU's force-quiescent-state processing to check for this condition and to send an IPI to CPUs that remain in that state for too long. "Too long" currently means about three jiffies by default, which is quite some time for a CPU to remain in the kernel without blocking. The rcu_tree.jiffies_till_first_fqs and rcutree.jiffies_till_next_fqs sysfs variables may be used to tune "too long" if needed.

Cc Chris Metcalf <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc Geoff Levand <[email protected]>
Cc Gilad Ben Yossef <[email protected]>
Cc Hakan Akkan <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Li Zhong <[email protected]>
Cc Paul E. McKenney <[email protected]>
Cc Paul Gortmaker <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 kernel/rcutree.c        |   10 ++++++++++
 kernel/rcutree.h        |    1 +
 kernel/rcutree_plugin.h |   18 ++++++++++++++++++
 3 files changed, 29 insertions(+), 0 deletions(-)
kernel/rcutree.c +10 -0
index 5b8ad82..f5ab502 100644
@@ -794,6 +794,16 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp)
 		rdp->offline_fqs++;
 		return 1;
 	}
+
+	/*
+	 * There is a possibility that a CPU in adaptive-ticks state
+	 * might run in the kernel with the scheduling-clock tick disabled
+	 * for an extended time period.  Invoke rcu_kick_nohz_cpu() to
+	 * force the CPU to restart the scheduling-clock tick in this
+	 * CPU is in this state.
+	 */
+	rcu_kick_nohz_cpu(rdp->cpu);
+
 	return 0;
 }
 
kernel/rcutree.h +1 -0
index c896b50..f993c0a 100644
@@ -539,6 +539,7 @@ static void rcu_boot_init_nocb_percpu_data(struct rcu_data *rdp);
 static void rcu_spawn_nocb_kthreads(struct rcu_state *rsp);
 static void init_nocb_callback_list(struct rcu_data *rdp);
 static void __init rcu_init_nocb(void);
+static void rcu_kick_nohz_cpu(int cpu);
 
 #endif /* #ifndef RCU_TREE_NONCORE */
 
kernel/rcutree_plugin.h +18 -0
index c1cc7e1..a5745e9 100644
@@ -28,6 +28,7 @@
 #include <linux/gfp.h>
 #include <linux/oom.h>
 #include <linux/smpboot.h>
+#include <linux/tick.h>
 
 #define RCU_KTHREAD_PRIO 1
 
@@ -2502,3 +2503,20 @@ static void __init rcu_init_nocb(void)
 }
 
 #endif /* #else #ifdef CONFIG_RCU_NOCB_CPU */
+
+/*
+ * An adaptive-ticks CPU can potentially execute in kernel mode for an
+ * arbitrarily long period of time with the scheduling-clock tick turned
+ * off.  RCU will be paying attention to this CPU because it is in the
+ * kernel, but the CPU cannot be guaranteed to be executing the RCU state
+ * machine because the scheduling-clock tick has been disabled.  Therefore,
+ * if an adaptive-ticks CPU is failing to respond to the current grace
+ * period and has not be idle from an RCU perspective, kick it.
+ */
+static void rcu_kick_nohz_cpu(int cpu)
+{
+#ifdef CONFIG_NO_HZ_FULL
+	if (tick_nohz_full_cpu(cpu))
+		smp_send_reschedule(cpu);
+#endif /* #ifdef CONFIG_NO_HZ_FULL */
+}
Signature · 1 line
1.7.5.4
maintainer
#6 lore raw
In reply to Frederic Weisbecker
Quoted 26 lines · Frederic Weisbecker

Ingo,

Please pull the latest timers/nohz branch that can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git
timers/nohz

HEAD: 65d798f0f9339ae2c4ebe9480e3260b33382a584

This fixes some of the issues you've reported. There is still the dependency on CONFIG_VIRT_CPU_ACCOUNTING_GEN to fix, probably in the Kconfig side. Stay tuned.

Thanks.

---
Frederic Weisbecker (4):
nohz: Fix old dynticks idle Kconfig backward compatibility
nohz: Switch from "extended nohz" to "full nohz" based naming
nohz: Align periodic tick Kconfig with other choices' naming
convention
nohz: Improve a bit the full dynticks Kconfig documentation

Paul E. McKenney (1):
rcu: Kick adaptive-ticks CPUs that are holding up RCU grace periods

Quoted 11 lines
 Documentation/kernel-parameters.txt |    4 +-
 include/linux/tick.h                |    6 ++--
 kernel/rcutree.c                    |   10 ++++++
 kernel/rcutree.h                    |    1 +
 kernel/rcutree_plugin.h             |   18 +++++++++++
 kernel/sched/core.c                 |    6 ++--
 kernel/time/Kconfig                 |   26 ++++++++++------
 kernel/time/tick-broadcast.c        |    2 +-
 kernel/time/tick-common.c           |    2 +-
 kernel/time/tick-sched.c            |   54 +++++++++++++++++-----------------
 10 files changed, 82 insertions(+), 47 deletions(-)

Pulled, thanks Frederic!

Ingo