lkml.org 
[lkml]   [2012]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 14/24] sched: Update rq clock on tickless CPUs before calling check_preempt_curr()
Date
check_preempt_wakeup() of fair class needs an uptodate sched clock
value to update runtime stats of the current task.

When a task is woken up, activate_task() is usually called right before
ttwu_do_wakeup() unless the task is already in the runqueue. In this
case we need to update the rq clock manually in case the CPU runs
tickless because ttwu_do_wakeup() calls check_preempt_wakeup().

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Alessio Igor Bogani <abogani@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Avi Kivity <avi@redhat.com>
Cc: Chris Metcalf <cmetcalf@tilera.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Geoff Levand <geoff@infradead.org>
Cc: Gilad Ben Yossef <gilad@benyossef.com>
Cc: Hakan Akkan <hakanakkan@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
kernel/sched/core.c | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 5d9060a..9cbace7 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1323,6 +1323,12 @@ static int ttwu_remote(struct task_struct *p, int wake_flags)

rq = __task_rq_lock(p);
if (p->on_rq) {
+ /*
+ * Ensure check_preempt_curr() won't deal with a stale value
+ * of rq clock if the CPU is tickless. BTW do we actually need
+ * check_preempt_curr() to be called here?
+ */
+ update_nohz_rq_clock(rq);
ttwu_do_wakeup(rq, p, wake_flags);
ret = 1;
}
@@ -1500,8 +1506,17 @@ static void try_to_wake_up_local(struct task_struct *p)
if (!(p->state & TASK_NORMAL))
goto out;

- if (!p->on_rq)
+ if (!p->on_rq) {
ttwu_activate(rq, p, ENQUEUE_WAKEUP);
+ } else {
+ /*
+ * Even if the task is on the runqueue we still
+ * need to ensure check_preempt_curr() won't
+ * deal with a stale rq clock value on a tickless
+ * CPU
+ */
+ update_nohz_rq_clock(rq);
+ }

ttwu_do_wakeup(rq, p, 0);
ttwu_stat(p, smp_processor_id(), 0);
--
1.7.5.4


\
 
 \ /
  Last update: 2012-12-20 20:21    [W:0.200 / U:0.812 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site