* [PATCH] sched: Move level 'again' after get_cpu() in sched_exec.
@ 2010-01-12 10:42 Rakib Mullick
2010-01-12 10:50 ` Peter Zijlstra
0 siblings, 1 reply; 2+ messages in thread
From: Rakib Mullick @ 2010-01-12 10:42 UTC (permalink / raw)
To: LKML; +Cc: Ingo Molnar, Peter Zijlstra
sched: move level again after get_cpu().
We can get this_cpu by calling get_cpu() once and it remains
same. We don't need to call it again.
Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
---
--- linus/kernel/sched.c 2010-01-06 20:11:10.000000000 +0600
+++ rakib/kernel/sched.c 2010-01-12 16:01:54.000000000 +0600
@@ -3143,8 +3143,8 @@ void sched_exec(void)
unsigned long flags;
struct rq *rq;
-again:
this_cpu = get_cpu();
+again:
dest_cpu = select_task_rq(p, SD_BALANCE_EXEC, 0);
if (dest_cpu == this_cpu) {
put_cpu();
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] sched: Move level 'again' after get_cpu() in sched_exec.
2010-01-12 10:42 [PATCH] sched: Move level 'again' after get_cpu() in sched_exec Rakib Mullick
@ 2010-01-12 10:50 ` Peter Zijlstra
0 siblings, 0 replies; 2+ messages in thread
From: Peter Zijlstra @ 2010-01-12 10:50 UTC (permalink / raw)
To: Rakib Mullick; +Cc: LKML, Ingo Molnar
On Tue, 2010-01-12 at 16:42 +0600, Rakib Mullick wrote:
> sched: move level again after get_cpu().
>
> We can get this_cpu by calling get_cpu() once and it remains
> same. We don't need to call it again.
Yes we do... get_cpu() needs to be paired with put_cpu() and they
disable/enable preemption.
Since there's an unconditional put_cpu() before the goto again, we need
to do the get_cpu().
Plenty of kernel debug options would have informed you of this if you'd
tried running it.
> Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
> ---
>
> --- linus/kernel/sched.c 2010-01-06 20:11:10.000000000 +0600
> +++ rakib/kernel/sched.c 2010-01-12 16:01:54.000000000 +0600
> @@ -3143,8 +3143,8 @@ void sched_exec(void)
> unsigned long flags;
> struct rq *rq;
>
> -again:
> this_cpu = get_cpu();
> +again:
> dest_cpu = select_task_rq(p, SD_BALANCE_EXEC, 0);
> if (dest_cpu == this_cpu) {
> put_cpu();
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-01-12 10:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-12 10:42 [PATCH] sched: Move level 'again' after get_cpu() in sched_exec Rakib Mullick
2010-01-12 10:50 ` Peter Zijlstra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox