dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Mikulas Patocka <mpatocka@redhat.com>,
	Mandeep Singh Baines <msb@chromium.org>,
	linux-kernel@vger.kernel.org, dm-devel@redhat.com,
	Alasdair G Kergon <agk@redhat.com>,
	Will Drewry <wad@chromium.org>,
	Elly Jones <ellyjones@chromium.org>,
	Milan Broz <mbroz@redhat.com>,
	Olof Johansson <olofj@chromium.org>,
	Steffen Klassert <steffen.klassert@secunet.com>,
	Rusty Russell <rusty@rustcorp.com.au>
Subject: Re: workqueues and percpu (was: [PATCH] dm: remake of the verity target)
Date: Thu, 8 Mar 2012 16:51:18 -0800	[thread overview]
Message-ID: <20120309005118.GC2968@htj.dyndns.org> (raw)
In-Reply-To: <20120309003309.GB2968@htj.dyndns.org>

Adding a bit..

On Thu, Mar 08, 2012 at 04:33:09PM -0800, Tejun Heo wrote:
> ISTR there was something already broken about having specific CPU
> assumption w/ workqueue even before cmwq when using queue_work_on()
> unless it was explicitly synchronizing using cpu hotplug callback.
> Hmmm... what was it... I think it was that there was no protection
> against queueing on workqueue on dead CPU and workqueue was flushed
> only once during cpu shutdown meaning that queue_work_on() or
> requeueing work items could end up queued on a workqueue of a dead
> CPU.

I think the crux of the problem is that we didn't have the interface
to indicate the intention of workqueue users.  Per-cpu workqueues were
the normal ones and the per-cpuness is used both as optimization
(local queueing is much cheaper and a work item is likely to access
the same stuff its queuer was accessing) and pinning.  Single-threaded
workqueues were used for both non-reentrancy and resource
optimization.

For the short term, the easiest fix would be adding flush_work_sync()
from cpu hotplug callback for the pinned ones.  For the longer term, I
think the most natural fix would be making work items queued with
explicit queue_work_on() handled differently and adding debug code to
enforce it.

Thanks.

-- 
tejun

  reply	other threads:[~2012-03-09  0:51 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-02  0:33 [PATCH] dm: verity target Mandeep Singh Baines
2012-03-02 16:08 ` Mandeep Singh Baines
2012-03-04 19:18 ` [PATCH] dm: remake of the " Mikulas Patocka
2012-03-04 19:35   ` userspace hashing utility for dm-verity Mikulas Patocka
2012-03-06 21:59   ` [PATCH] dm: remake of the verity target Mandeep Singh Baines
2012-03-08 22:21     ` workqueues and percpu (was: [PATCH] dm: remake of the verity target) Mikulas Patocka
2012-03-08 22:39       ` Andrew Morton
2012-03-08 23:15         ` Tejun Heo
2012-03-08 23:30           ` Andrew Morton
2012-03-09  0:33             ` Tejun Heo
2012-03-09  0:51               ` Tejun Heo [this message]
2012-03-09 21:15           ` Mandeep Singh Baines
2012-03-09 21:20             ` Tejun Heo
2012-03-09 22:06               ` Mandeep Singh Baines
2012-08-14 17:54                 ` Tejun Heo
2012-03-13 22:20     ` [PATCH] dm: remake of the verity target Mikulas Patocka
2012-03-14 21:13       ` Will Drewry
2012-03-17  1:16         ` Mikulas Patocka
2012-03-17  3:06           ` Will Drewry
2012-03-14 21:43       ` Mandeep Singh Baines
2012-03-20 15:41       ` Mandeep Singh Baines
2012-03-21  0:54         ` Mikulas Patocka
2012-03-21  3:03           ` Mandeep Singh Baines
2012-03-21  3:11           ` [dm-devel] " Mikulas Patocka
2012-03-21  3:30             ` Mandeep Singh Baines
2012-03-21  3:44               ` Mikulas Patocka
2012-03-21  3:49                 ` Mandeep Singh Baines
2012-03-21 17:08                   ` Mikulas Patocka
2012-03-21 17:09                     ` Mikulas Patocka
2012-03-22 17:41                     ` [dm-devel] " Mandeep Singh Baines
2012-03-22 21:52                       ` Mikulas Patocka
2012-03-23  3:15                         ` Mandeep Singh Baines
2012-03-24  3:48                           ` Mikulas Patocka
2012-03-21  1:10         ` Mikulas Patocka

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=20120309005118.GC2968@htj.dyndns.org \
    --to=tj@kernel.org \
    --cc=agk@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=dm-devel@redhat.com \
    --cc=ellyjones@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbroz@redhat.com \
    --cc=mpatocka@redhat.com \
    --cc=msb@chromium.org \
    --cc=olofj@chromium.org \
    --cc=rusty@rustcorp.com.au \
    --cc=steffen.klassert@secunet.com \
    --cc=wad@chromium.org \
    /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;
as well as URLs for NNTP newsgroup(s).