Re: [PATCH 1/7] workqueue: wait on manager_mutex instead ofrebind_hold

From: Tejun Heo
Date: Mon Aug 27 2012 - 14:53:12 EST


Hello, Lai.

On Tue, Aug 28, 2012 at 01:58:21AM +0800, Lai Jiangshan wrote:
> this thread is finally scheduled, .
> sees the WORKER_REBIND is not cleared, .
> go to sleep again waiting for (another) .
> rebind_workers() to wake up me. <--bug-> waiting for the idles' ACK.
>
> The two thread wait each other. It is bug.

Ooh, nice catch. Has this actually happened in the wild? Can you
reproduce it?

> This fix:
> The idle_worker_rebind() don't wait on rebind_hold, it waits on manager_mutex
> instead. When mutex_lock(manager_mutex) returns, the idles know that
> the corresponding rebind_workers() is finish up, the idle_worker_rebind() can
> returns.

Hmm... I can't really see how this change makes any difference tho.
While the exact wait condition changes, the mechanics doesn't.

IDLE WORKER HOTPLUG
- online
- rebind and kicks completion
- wait on manager_mutex
- finishes onlining
- offline
- online again, re-enters rebind_workers()
- wakes up but blocked on
manager_mutex

So, we're just deadlocked on a different thing. It seems what we need
is another interlocked step to make hotplug onlining wait for idle
worker finishes the last step, no?

Thanks.

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