Re: [PATCH 2.6.32-rc6] workqueue: fix race condition inschedule_on_each_cpu()

From: Ingo Molnar
Date: Fri Nov 13 2009 - 04:34:16 EST



* Tejun Heo <tj@xxxxxxxxxx> wrote:

> Commit 65a64464349883891e21e74af16c05d6e1eeb4e9 which allows
> schedule_on_each_cpu() to be called from keventd added a race
> condition. schedule_on_each_cpu() may race with cpu hotplug and end
> up executing the function twice on a cpu.
>
> Fix it by moving direct execution into the section protected with
> get/put_online_cpus(). While at it, update code such that direct
> execution is done after works have been scheduled for all other cpus
> and drop unnecessary cpu != orig test from flush loop.
>
> Signed-off-by: Tejun Heo <tj@xxxxxxxxxx>
> Cc: Andi Kleen <ak@xxxxxxxxxxxxxxx>
> Cc: Oleg Nesterov <oleg@xxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> ---
> Andi, Oleg, this patch tested fine on my machine but it would be great
> if you guys can ack it. Ingo, upon ack, can you please route this
> patch?
>
> Thanks.

Andrew's doing workqueue patches - i've Cc:-ed him.

Looks good to me. Btw., 65a644643 should have been done via -mm, or at
least it should have gathered proper Acks from interested parties before
pushing the change upstream.

Ingo
--
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/