[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1335830115-14335-15-git-send-email-fweisbec@gmail.com>
Date: Tue, 1 May 2012 01:54:48 +0200
From: Frederic Weisbecker <fweisbec@...il.com>
To: LKML <linux-kernel@...r.kernel.org>,
linaro-sched-sig@...ts.linaro.org
Cc: Frederic Weisbecker <fweisbec@...il.com>,
Alessio Igor Bogani <abogani@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Avi Kivity <avi@...hat.com>,
Chris Metcalf <cmetcalf@...era.com>,
Christoph Lameter <cl@...ux.com>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Geoff Levand <geoff@...radead.org>,
Gilad Ben Yossef <gilad@...yossef.com>,
Hakan Akkan <hakanakkan@...il.com>,
Ingo Molnar <mingo@...nel.org>, Kevin Hilman <khilman@...com>,
Max Krasnyansky <maxk@...lcomm.com>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Peter Zijlstra <peterz@...radead.org>,
Stephen Hemminger <shemminger@...tta.com>,
Steven Rostedt <rostedt@...dmis.org>,
Sven-Thorsten Dietrich <thebigcorporation@...il.com>,
Thomas Gleixner <tglx@...utronix.de>
Subject: [PATCH 14/41] nohz/cpuset: Restart tick when nohz flag is cleared on cpuset
Issue an IPI to restart the tick on a CPU that belongs
to a cpuset when its nohz flag gets cleared.
Signed-off-by: Frederic Weisbecker <fweisbec@...il.com>
Cc: Alessio Igor Bogani <abogani@...nel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Avi Kivity <avi@...hat.com>
Cc: Chris Metcalf <cmetcalf@...era.com>
Cc: Christoph Lameter <cl@...ux.com>
Cc: Daniel Lezcano <daniel.lezcano@...aro.org>
Cc: Geoff Levand <geoff@...radead.org>
Cc: Gilad Ben Yossef <gilad@...yossef.com>
Cc: Hakan Akkan <hakanakkan@...il.com>
Cc: Ingo Molnar <mingo@...nel.org>
Cc: Kevin Hilman <khilman@...com>
Cc: Max Krasnyansky <maxk@...lcomm.com>
Cc: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Stephen Hemminger <shemminger@...tta.com>
Cc: Steven Rostedt <rostedt@...dmis.org>
Cc: Sven-Thorsten Dietrich <thebigcorporation@...il.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
---
include/linux/cpuset.h | 2 ++
kernel/cpuset.c | 23 +++++++++++++++++++++++
kernel/time/tick-sched.c | 8 ++++++++
3 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 5510708..89ef5f3 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -263,6 +263,8 @@ static inline bool cpuset_adaptive_nohz(void)
return false;
}
+
+extern void cpuset_exit_nohz_interrupt(void *unused);
#else
static inline bool cpuset_cpu_adaptive_nohz(int cpu) { return false; }
static inline bool cpuset_adaptive_nohz(void) { return false; }
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 5a28cf8..00864a0 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1221,6 +1221,14 @@ static void cpuset_change_flag(struct task_struct *tsk,
DEFINE_PER_CPU(int, cpu_adaptive_nohz_ref);
+static void cpu_exit_nohz(int cpu)
+{
+ preempt_disable();
+ smp_call_function_single(cpu, cpuset_exit_nohz_interrupt,
+ NULL, true);
+ preempt_enable();
+}
+
static void update_nohz_cpus(struct cpuset *old_cs, struct cpuset *cs)
{
int cpu;
@@ -1234,6 +1242,21 @@ static void update_nohz_cpus(struct cpuset *old_cs, struct cpuset *cs)
per_cpu(cpu_adaptive_nohz_ref, cpu) += 1;
else
per_cpu(cpu_adaptive_nohz_ref, cpu) -= 1;
+
+ val = per_cpu(cpu_adaptive_nohz_ref, cpu);
+
+ if (!val) {
+ /*
+ * The update to cpu_adaptive_nohz_ref must be
+ * visible right away. So that once we restart the tick
+ * from the IPI, it won't be stopped again due to cache
+ * update lag.
+ * FIXME: We probably need more to ensure this value is really
+ * visible right away.
+ */
+ smp_mb();
+ cpu_exit_nohz(cpu);
+ }
}
}
#else
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index fc35d41..fe31add 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -875,6 +875,14 @@ void tick_nohz_check_adaptive(void)
}
}
+void cpuset_exit_nohz_interrupt(void *unused)
+{
+ struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched);
+
+ if (ts->tick_stopped && !is_idle_task(current))
+ tick_nohz_restart_adaptive();
+}
+
void tick_nohz_post_schedule(void)
{
struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched);
--
1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists