[lkml]   [2007]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH, RFC] reimplement flush_workqueue()
    On Thu, Jan 04, 2007 at 05:29:36PM +0300, Oleg Nesterov wrote:
    > Thanks, I need to think about this.
    > However I am not sure I fully understand the problem.
    > First, this deadlock was not introduced by recent changes (including "single
    > threaded flush_workqueue() takes workqueue_mutex too"), yes?

    AFAIK this deadlock originated from Andrew's patch here:

    (Yes, your patches didnt introduce this. I was just reiterating here my
    earlier point that workqueue code is broken of late wrt cpu hotplug).

    > Also, it seems to me we have a much more simple scenario for deadlock.
    > events/0 runs run_workqueue(), work->func() sleeps or takes a preemtion. CPU 0
    > dies, keventd thread migrates to another CPU. CPU_DEAD calls kthread_stop() under
    > workqueue_mutex and waits for until kevents thread exits. Now, if this work (or
    > another work pending on cwq->worklist) takes workqueue_mutex (for example, does
    > flush_workqueue) we have a deadlock.
    > No?

    Yes, the above scenario also will cause a deadlock.

    I supposed one could avoid the deadlock by having a 'workqueue_mutex_held'
    flag and avoid taking the mutex set under some conditions, but IMHO a
    more neater solution is to provide a cpu-hotplug lock which works under
    all these corner cases. One such proposal was made here:

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2007-01-04 17:01    [W:0.021 / U:7.188 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site