summaryrefslogtreecommitdiffstats
path: root/kernel/sched
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2017-02-21 14:36:23 +0100
committerIngo Molnar <mingo@kernel.org>2017-03-16 09:46:24 +0100
commit77558e4d01ac0c7fa8cb1af4a61c2ab508d79f30 (patch)
treeda226c41a6eff545e088fb8a45af973d63e9f3d5 /kernel/sched
parentsched/core: Add ENQUEUE_NOCLOCK to ENQUEUE_RESTORE (diff)
downloadlinux-77558e4d01ac0c7fa8cb1af4a61c2ab508d79f30.tar.xz
linux-77558e4d01ac0c7fa8cb1af4a61c2ab508d79f30.zip
sched/core: Make sched_ttwu_pending() atomic in time
Since all tasks on the wake_list are woken under a single rq->lock avoid calling update_rq_clock() for each task. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched')
-rw-r--r--kernel/sched/core.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 247d0a0c319e..dead90d680fd 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1685,7 +1685,7 @@ static void
ttwu_do_activate(struct rq *rq, struct task_struct *p, int wake_flags,
struct rq_flags *rf)
{
- int en_flags = ENQUEUE_WAKEUP;
+ int en_flags = ENQUEUE_WAKEUP | ENQUEUE_NOCLOCK;
lockdep_assert_held(&rq->lock);
@@ -1737,6 +1737,7 @@ void sched_ttwu_pending(void)
return;
rq_lock_irqsave(rq, &rf);
+ update_rq_clock(rq);
while (llist) {
int wake_flags = 0;
@@ -1849,6 +1850,7 @@ static void ttwu_queue(struct task_struct *p, int cpu, int wake_flags)
#endif
rq_lock(rq, &rf);
+ update_rq_clock(rq);
ttwu_do_activate(rq, p, wake_flags, &rf);
rq_unlock(rq, &rf);
}