Skip to content

Commit b84cb5d

Browse files
Peter ZijlstraIngo Molnar
authored andcommitted
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 <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.394638826@chello.nl
1 parent e4a52bc commit b84cb5d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

kernel/sched.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2410,9 +2410,11 @@ static void update_avg(u64 *avg, u64 sample)
24102410
#endif
24112411

24122412
static void
2413-
ttwu_stat(struct rq *rq, struct task_struct *p, int cpu, int wake_flags)
2413+
ttwu_stat(struct task_struct *p, int cpu, int wake_flags)
24142414
{
24152415
#ifdef CONFIG_SCHEDSTATS
2416+
struct rq *rq = this_rq();
2417+
24162418
#ifdef CONFIG_SMP
24172419
int this_cpu = smp_processor_id();
24182420

@@ -2561,9 +2563,10 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
25612563
ttwu_activate(rq, p, ENQUEUE_WAKEUP | ENQUEUE_WAKING);
25622564
out_running:
25632565
ttwu_post_activation(p, rq, wake_flags);
2564-
ttwu_stat(rq, p, cpu, wake_flags);
25652566
success = 1;
25662567
__task_rq_unlock(rq);
2568+
2569+
ttwu_stat(p, cpu, wake_flags);
25672570
out:
25682571
raw_spin_unlock_irqrestore(&p->pi_lock, flags);
25692572
put_cpu();
@@ -2600,7 +2603,7 @@ static void try_to_wake_up_local(struct task_struct *p)
26002603
ttwu_activate(rq, p, ENQUEUE_WAKEUP);
26012604

26022605
ttwu_post_activation(p, rq, 0);
2603-
ttwu_stat(rq, p, smp_processor_id(), 0);
2606+
ttwu_stat(p, smp_processor_id(), 0);
26042607
out:
26052608
raw_spin_unlock(&p->pi_lock);
26062609
}

0 commit comments

Comments
 (0)