Re: [PATCH 1/2] workqueue: pin the pool while it is managing
From: Sebastian Andrzej Siewior
Date: Thu May 28 2020 - 04:08:49 EST
On 2020-05-28 03:06:55 [+0000], Lai Jiangshan wrote:
> So that put_unbound_pool() can ensure all workers in idle,
> no unfinished manager. And it doens't need to wait any manager
> and can go to delete all the idle workers straight away.
>
> Also removes manager waitqueue, because it is unneeded and as
> Sebastian Andrzej Siewior said:
>
> The workqueue code has it's internal spinlock (pool::lock) and also
> implicit spinlock usage in the wq_manager waitqueue. These spinlocks
> are converted to 'sleeping' spinlocks on a RT-kernel.
>
> Workqueue functions can be invoked from contexts which are truly atomic
> even on a PREEMPT_RT enabled kernel. Taking sleeping locks from such
> contexts is forbidden.
>
> pool::lock can be converted to a raw spinlock as the lock held times
> are short. But the workqueue manager waitqueue is handled inside of
> pool::lock held regions which again violates the lock nesting rules
> of raw and regular spinlocks.
This seems to work for my test case I had test my chance. And lockdep
didn't complain soâ
If you prefer this over my 1/2 what do we do about 2/2? Do you want me
to repost it?
Sebastian