Thread (6 messages) 6 messages, 3 authors, 2014-02-18

Re: [PATCH] workqueue: Document exceptions to work item non-reentrancy guarantee

From: Tejun Heo <tj@kernel.org>
Date: 2014-02-18 15:33:22
Also in: lkml

On Mon, Feb 17, 2014 at 09:29:34PM -0500, Peter Hurley wrote:
quoted
It never would have occurred to me that you could safely change the
function for a work item that is already scheduled or running.
Especially given that PREPARE_WORK() is just a simple assignment (i.e.
no serialisation).
process_one_work() has an established order that safely allows for
resetting the work function and scheduling the work, and further
guaranteeing that the new work function will run.

Further, existing memory barriers ensure that
1. The new work function is visible on all cpus before testing if
   the work is already pending.
2. The new work function is stored as the worker's current function
   before the work is marked as not pending.

If this wasn't possible, then single-threaded workqueues could
not be used for multiple functions without flushing work.

I wonder if the floppy driver is broken too.
Ugh... I'd just rather remove PREPARE_WORK altogether.  It's a pretty
dumb thing to do anyway.  I'll look into it.

Thanks.

-- 
tejun
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help