Re: [PATCH] sched: Move level 'again' after get_cpu() insched_exec.

From: Peter Zijlstra
Date: Tue Jan 12 2010 - 05:50:46 EST


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@xxxxxxxxx>
> ---
>
> --- 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();


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/