On Mon, May 26, 2014 at 01:27:55PM +0800, Lai Jiangshan wrote:
> changing pwq:
>       install pwq
>       lock(pool->lock)
>       put_pwq();
>       unlock(pool->lock)
> 
> __queue_work():
>       lock(pool->lock)
>       test ref and find it zero;
>       see the installation here;
>       it is guaranteed to get the installed pwq on the immediate next try.
>       unlock()
>       retry.

The fact that pool->lock locking happens to provide enough barrier for
the above to work is an accidental implementation detail.  We
theoretically can move refcnting out of pool->lock.  Nothing
semantically guarantees that barrier to be there to interlock pwq
qinstallation and the last put.  Removing that cpu_relax() doesn't buy
us *ANYTHING* and removing that with rationale of making it go faster
would easily win pointless micro optimization award of the year.  Just
let it go.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to