mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Peter Hurley <peter@hurleysoftware.com>
Cc: Ben Hutchings <ben@decadent.org.uk>,
	linux-kernel@vger.kernel.org,
	Stefan Richter <stefanr@s5r6.in-berlin.de>,
	stable@vger.kernel.org
Subject: Re: [PATCH] workqueue: Document exceptions to work item non-reentrancy guarantee
Date: Tue, 18 Feb 2014 10:30:56 -0500	[thread overview]
Message-ID: <20140218153056.GC30043@htj.dyndns.org> (raw)
In-Reply-To: <5302C58E.1070903@hurleysoftware.com>

On Mon, Feb 17, 2014 at 09:29:34PM -0500, Peter Hurley wrote:
> >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

  reply	other threads:[~2014-02-18 15:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-15 19:38 Peter Hurley
2014-02-18  1:43 ` Ben Hutchings
2014-02-18  2:29   ` Peter Hurley
2014-02-18 15:30     ` Tejun Heo [this message]
2014-02-18 16:31       ` Peter Hurley
2014-02-18 16:37         ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140218153056.GC30043@htj.dyndns.org \
    --to=tj@kernel.org \
    --cc=ben@decadent.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter@hurleysoftware.com \
    --cc=stable@vger.kernel.org \
    --cc=stefanr@s5r6.in-berlin.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®