Re: [PATCH 1/2] workqueue: pin the pool while it is managing
From: Lai Jiangshan
Date: Thu May 28 2020 - 04:36:12 EST
On Thu, May 28, 2020 at 4:08 PM Sebastian Andrzej Siewior
> 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?
I think we can just wait until Tejun reviews them.
If there is something wrong that I missed in my patch, your patches
are the best choice.
If I need to update my patch, I will repost the 3 patches
(2 of mine, the 2/2 of yours). At least I forgot to add
"Reported-by Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>"
in the patch.
If Tejun queues my patches right away, you can rebase the 2/2
of yours and repost it.