sched: Remove rq argument from ttwu_stat()

In order to call ttwu_stat() without holding rq->lock we must remove
its rq argument. Since we need to change rq stats, account to the
local rq instead of the task rq, this is safe since we have IRQs
disabled.

Reviewed-by: Frank Rowand <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Nick Piggin <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Andrew Morton <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
This commit is contained in:
Peter Zijlstra authored and Ingo Molnar committed 2011-04-14 08:52:40 +02:00
1 parent e4a52bcb9a
commit b84cb5df1f
1 file changed
+6 -3
+6 -3
View File
@@ -2410,9 +2410,11 @@ static void update_avg(u64 *avg, u64 sample)
#endif
static void
ttwu_stat(struct rq *rq, struct task_struct *p, int cpu, int wake_flags)
ttwu_stat(struct task_struct *p, int cpu, int wake_flags)
{
#ifdef CONFIG_SCHEDSTATS
struct rq *rq = this_rq();
#ifdef CONFIG_SMP
int this_cpu = smp_processor_id();
@@ -2561,9 +2563,10 @@ out_activate:
ttwu_activate(rq, p, ENQUEUE_WAKEUP | ENQUEUE_WAKING);
out_running:
ttwu_post_activation(p, rq, wake_flags);
ttwu_stat(rq, p, cpu, wake_flags);
success = 1;
__task_rq_unlock(rq);
ttwu_stat(p, cpu, wake_flags);
out:
raw_spin_unlock_irqrestore(&p->pi_lock, flags);
put_cpu();
@@ -2600,7 +2603,7 @@ static void try_to_wake_up_local(struct task_struct *p)
ttwu_activate(rq, p, ENQUEUE_WAKEUP);
ttwu_post_activation(p, rq, 0);
ttwu_stat(rq, p, smp_processor_id(), 0);
ttwu_stat(p, smp_processor_id(), 0);
out:
raw_spin_unlock(&p->pi_lock);
}