[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4697B056.9080508@redhat.com>
Date: Fri, 13 Jul 2007 19:03:18 +0200
From: Michal Schmidt <mschmidt@...hat.com>
To: Oleg Nesterov <oleg@...sign.ru>
CC: Andrew Morton <akpm@...ux-foundation.org>,
Srivatsa Vaddagiri <vatsa@...ibm.com>, stable@...nel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] destroy_workqueue() can livelock
Oleg Nesterov wrote:
> Pointed out by Michal Schmidt <mschmidt@...hat.com>.
>
> The bug was introduced in 2.6.22 by me.
>
> cleanup_workqueue_thread() does flush_cpu_workqueue(cwq) in a loop until
> ->worklist becomes empty. This is live-lockable, a re-niced caller can
> get CPU after wake_up() and insert a new barrier before the lower-priority
> cwq->thread has a chance to clear ->current_work.
>
> Change cleanup_workqueue_thread() to do flush_cpu_workqueue(cwq) only once.
> We can rely on the fact that run_workqueue() won't return until it flushes
> all works. So it is safe to call kthread_stop() after that, the "should stop"
> request won't be noticed until run_workqueue() returns.
>
> Signed-off-by: Oleg Nesterov <oleg@...sign.ru>
I confirm the patch fixes the bug I was seeing.
Michal
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists