Re: [PATCH 1/1] [RFC] workqueue: fix ghost PENDING flag while doing MQ IO
From: Tejun Heo
Date: Mon Apr 25 2016 - 13:51:25 EST
Hello, Roman.
On Mon, Apr 25, 2016 at 07:39:52PM +0200, Roman Penyaev wrote:
> Ok, that's clear now. Thanks. I was confused also by a spin lock, which
> is being released just after clear pending:
>
> set_work_pool_and_clear_pending(work, pool->id);
> spin_unlock_irq(&pool->lock);
> ...
> worker->current_func(work);
>
> But seems memory operations of execution can leak-in and appear before
> pended bit is cleared and spin lock is released.
> (according to Documentation/memory-barriers.txt, (6) RELEASE operations)
Yeap, release doesn't prevent following reads from creeping ahead of
it.
> Tejun, do you need an updated patch for that? With a proper smp_mb()?
Yes, can you please also add comment explaining what the mb is
interlocking?
Thanks a lot!
--
tejun