Skip to contentSkip to conversation

timers update for 3.15

GIT PULL New Frederic Weisbecker 2 participants 5 messages Feb 26, 2014 – Feb 27, 2014

lore
Share & tools
lore
#0 lore raw

Ingo,

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

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

* The patch from Viresh removes some unecessary scheduler IPIs that wake up the CPUs when deferrable timers are enqueued on remote targets.

In practice I have seen on boot some of these IPIs from various
sources: MCE, vmstat/SLAB, cpufreq. They happen either on initcall or cpu hotplug. Since these timers are enqueued on all CPUs, there are some potential big rounds of IPIs that are spared with this patch.

But it's just what I've seen on my own machine on boot. I expect some more scenarios where a few IPIs will be avoided depending on configs and usecases because we have some more users of deferrable timers.

* Kconfig text made clearer for full dynticks by Paul Gortmaker.

Thanks,
Frederic
---

Paul Gortmaker (1):
nohz: ensure users are aware boot CPU is not NO_HZ_FULL

Viresh Kumar (1):
timer: Spare IPI when deferrable timer is queued on idle remote targets

 kernel/time/Kconfig | 2 +-
 kernel/timer.c      | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
#1 lore raw

PATCH 1/2 timer: Spare IPI when deferrable timer is queued on idle remote targets

From: Viresh Kumar <[email protected]>

When a timer is enqueued or modified on a remote target, the latter is expected to see and handle this timer on its next tick. However if the target is idle and CONFIG_NO_HZ_IDLE=y, the CPU may be sleeping tickless and the timer may be ignored.

wake_up_nohz_cpu() takes care of that by setting TIF_NEED_RESCHED and sending an IPI to idle targets so that the tick is reevaluated on the idle loop through the tick_nohz_idle_*() APIs.

Now this is all performed regardless of the power properties of the timer. If the timer is deferrable, idle targets don't need to be woken up. Only the next buzy tick needs to care about it, and no IPI kick is needed for that to happen.

So lets spare the IPI on idle targets when the timer is deferrable.

Meanwhile we keep the current behaviour on full dynticks targets. We can spare IPIs on idle full dynticks targets as well but some tricky races against idle_cpu() must be dealt all along to make sure that the timer is well handled after idle exit. We can deal with that later since NO_HZ_FULL already has more important powersaving issues.

---
 kernel/timer.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
kernel/timer.c +8 -1
index accfd24..b75e789 100644
@@ -939,8 +939,15 @@ void add_timer_on(struct timer_list *timer, int cpu)
 	 * with the timer by holding the timer base lock. This also
 	 * makes sure that a CPU on the way to stop its tick can not
 	 * evaluate the timer wheel.
+	 *
+	 * Spare the IPI for deferrable timers on idle targets though.
+	 * The next busy ticks will take care of it. Except full dynticks
+	 * require special care against races with idle_cpu(), lets deal
+	 * with that later.
 	 */
-	wake_up_nohz_cpu(cpu);
+	if (!tbase_get_deferrable(timer->base) || tick_nohz_full_cpu(cpu))
+		wake_up_nohz_cpu(cpu);
+
 	spin_unlock_irqrestore(&base->lock, flags);
 }
 EXPORT_SYMBOL_GPL(add_timer_on);
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 2/2 nohz: ensure users are aware boot CPU is not NO_HZ_FULL

In reply to Frederic Weisbecker

From: Paul Gortmaker <[email protected]>

This bit of information is in the Kconfig help text:

"Note the boot CPU will still be kept outside the range to handle the timekeeping duty."

However neither the variable NO_HZ_FULL_ALL, or the prompt convey this important detail, so lets add it to the prompt to make it more explicitly obvious to the average user.

---
 kernel/time/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/Kconfig +1 -1
index 3ce6e8c..f448513 100644
@@ -124,7 +124,7 @@ config NO_HZ_FULL
 endchoice
 
 config NO_HZ_FULL_ALL
-       bool "Full dynticks system on all CPUs by default"
+       bool "Full dynticks system on all CPUs by default (except CPU 0)"
        depends on NO_HZ_FULL
        help
          If the user doesn't pass the nohz_full boot option to
Signature · 1 line
1.8.3.1
#3 lore raw
In reply to Frederic Weisbecker
Quoted 29 lines · Frederic Weisbecker

Ingo,

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

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

* The patch from Viresh removes some unecessary scheduler IPIs that wake up the CPUs when deferrable timers are enqueued on remote targets.

In practice I have seen on boot some of these IPIs from various
sources: MCE, vmstat/SLAB, cpufreq. They happen either on initcall or cpu hotplug. Since these timers are enqueued on all CPUs, there are some potential big rounds of IPIs that are spared with this patch.

But it's just what I've seen on my own machine on boot. I expect some more scenarios where a few IPIs will be avoided depending on configs and usecases because we have some more users of deferrable timers.

* Kconfig text made clearer for full dynticks by Paul Gortmaker.

Thanks,
Frederic
---

Paul Gortmaker (1):
nohz: ensure users are aware boot CPU is not NO_HZ_FULL

Quoted 7 lines

Viresh Kumar (1):
timer: Spare IPI when deferrable timer is queued on idle remote targets

 kernel/time/Kconfig | 2 +-
 kernel/timer.c      | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

So I wanted to pull this fine set of commits, just to discover that Thomas already pulled it into timers/core :-)

Ingo

#4 lore raw
Quoted 36 lines · Ingo Molnar
Quoted 33 lines · Frederic Weisbecker

Ingo,

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

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

* The patch from Viresh removes some unecessary scheduler IPIs that wake up the CPUs when deferrable timers are enqueued on remote targets.

In practice I have seen on boot some of these IPIs from various
sources: MCE, vmstat/SLAB, cpufreq. They happen either on initcall or cpu hotplug. Since these timers are enqueued on all CPUs, there are some potential big rounds of IPIs that are spared with this patch.

But it's just what I've seen on my own machine on boot. I expect some more scenarios where a few IPIs will be avoided depending on configs and usecases because we have some more users of deferrable timers.

* Kconfig text made clearer for full dynticks by Paul Gortmaker.

Thanks,
Frederic
---

Paul Gortmaker (1):
nohz: ensure users are aware boot CPU is not NO_HZ_FULL

Viresh Kumar (1):
timer: Spare IPI when deferrable timer is queued on idle remote targets

Quoted 6 lines
Quoted 3 lines
 kernel/time/Kconfig | 2 +-
 kernel/timer.c      | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

So I wanted to pull this fine set of commits, just to discover that Thomas already pulled it into timers/core :-)

Ah! Now I understand why it was pulled silently in the evening ;)