aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2011-04-05 11:23:49 -0400
committerIngo Molnar <mingo@elte.hu>2011-04-14 02:52:37 -0400
commita8e4f2eaecc9bfa4954adf79a04f4f22fddd829c (patch)
treeb470d8a12be46bcc2a6be6a1c26be7028d6af1dd /kernel/sched.c
parent3fe1698b7fe05aeb063564e71e40d09f28d8e80c (diff)
sched: Delay task_contributes_to_load()
In prepratation of having to call task_contributes_to_load() without holding rq->lock, we need to store the result until we do and can update the rq accounting accordingly. Reviewed-by: Frank Rowand <frank.rowand@am.sony.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Nick Piggin <npiggin@kernel.dk> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/20110405152729.151523907@chello.nl
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 7a5eb2620785..fd32b78c123c 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2519,18 +2519,7 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state,
2519 if (unlikely(task_running(rq, p))) 2519 if (unlikely(task_running(rq, p)))
2520 goto out_activate; 2520 goto out_activate;
2521 2521
2522 /* 2522 p->sched_contributes_to_load = !!task_contributes_to_load(p);
2523 * In order to handle concurrent wakeups and release the rq->lock
2524 * we put the task in TASK_WAKING state.
2525 *
2526 * First fix up the nr_uninterruptible count:
2527 */
2528 if (task_contributes_to_load(p)) {
2529 if (likely(cpu_online(orig_cpu)))
2530 rq->nr_uninterruptible--;
2531 else
2532 this_rq()->nr_uninterruptible--;
2533 }
2534 p->state = TASK_WAKING; 2523 p->state = TASK_WAKING;
2535 2524
2536 if (p->sched_class->task_waking) { 2525 if (p->sched_class->task_waking) {
@@ -2555,6 +2544,9 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state,
2555 WARN_ON(task_cpu(p) != cpu); 2544 WARN_ON(task_cpu(p) != cpu);
2556 WARN_ON(p->state != TASK_WAKING); 2545 WARN_ON(p->state != TASK_WAKING);
2557 2546
2547 if (p->sched_contributes_to_load)
2548 rq->nr_uninterruptible--;
2549
2558out_activate: 2550out_activate:
2559#endif /* CONFIG_SMP */ 2551#endif /* CONFIG_SMP */
2560 ttwu_activate(rq, p, en_flags); 2552 ttwu_activate(rq, p, en_flags);