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
This commit is contained in:
parent
3fe1698b7f
commit
a8e4f2eaec
|
@ -1273,6 +1273,7 @@ struct task_struct {
|
||||||
|
|
||||||
/* Revert to default priority/policy when forking */
|
/* Revert to default priority/policy when forking */
|
||||||
unsigned sched_reset_on_fork:1;
|
unsigned sched_reset_on_fork:1;
|
||||||
|
unsigned sched_contributes_to_load:1;
|
||||||
|
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
pid_t tgid;
|
pid_t tgid;
|
||||||
|
|
|
@ -2519,18 +2519,7 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state,
|
||||||
if (unlikely(task_running(rq, p)))
|
if (unlikely(task_running(rq, p)))
|
||||||
goto out_activate;
|
goto out_activate;
|
||||||
|
|
||||||
/*
|
p->sched_contributes_to_load = !!task_contributes_to_load(p);
|
||||||
* In order to handle concurrent wakeups and release the rq->lock
|
|
||||||
* we put the task in TASK_WAKING state.
|
|
||||||
*
|
|
||||||
* First fix up the nr_uninterruptible count:
|
|
||||||
*/
|
|
||||||
if (task_contributes_to_load(p)) {
|
|
||||||
if (likely(cpu_online(orig_cpu)))
|
|
||||||
rq->nr_uninterruptible--;
|
|
||||||
else
|
|
||||||
this_rq()->nr_uninterruptible--;
|
|
||||||
}
|
|
||||||
p->state = TASK_WAKING;
|
p->state = TASK_WAKING;
|
||||||
|
|
||||||
if (p->sched_class->task_waking) {
|
if (p->sched_class->task_waking) {
|
||||||
|
@ -2555,6 +2544,9 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state,
|
||||||
WARN_ON(task_cpu(p) != cpu);
|
WARN_ON(task_cpu(p) != cpu);
|
||||||
WARN_ON(p->state != TASK_WAKING);
|
WARN_ON(p->state != TASK_WAKING);
|
||||||
|
|
||||||
|
if (p->sched_contributes_to_load)
|
||||||
|
rq->nr_uninterruptible--;
|
||||||
|
|
||||||
out_activate:
|
out_activate:
|
||||||
#endif /* CONFIG_SMP */
|
#endif /* CONFIG_SMP */
|
||||||
ttwu_activate(rq, p, en_flags);
|
ttwu_activate(rq, p, en_flags);
|
||||||
|
|
Loading…
Reference in New Issue