public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jiri Kosina <jkosina@suse.cz>,
	Stephen Hemminger <shemminger@vyatta.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jens Axboe <axboe@kernel.dk>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] floppy: convert to delayed work and single-thread wq
Date: Thu, 17 May 2012 07:55:19 -0700	[thread overview]
Message-ID: <20120517145519.GF21275@google.com> (raw)
In-Reply-To: <CA+55aFyX3OgdcWuYQO+YuS3fF_Wt1p8w-G33C5MCkiR-3ncfVA@mail.gmail.com>

Hello, Linus.

On Wed, May 16, 2012 at 01:42:36PM -0700, Linus Torvalds wrote:
> On Wed, May 16, 2012 at 1:29 PM, Tejun Heo <tj@kernel.org> wrote:
> >
> > Ummm... still confused.  flush_work_sync() is fine too.  If you have
> > two, two calls to flush_work_sync() are equivalent to flushing the
> > workqueue in effect.  You just need to avoid flush_workqueue() because
> > system workqueues may be hosting work items which can run arbitrarily
> > long.
> 
> Umm. If there are abritrarily long things and these are serialized,
> then that workqueue is not good for putting floppy work on it either,
> is it? I don't think you can have it both ways.

They're not being serialized.  system_nrt_wq like any other system wqs
has 256 as max_active - so upto 256 work items per cpu can be
executing (ie. assigned to an active worker) at any given time and
because it's a large shared pool, some of them are allowed to take
long time.

> Either it's "good enough" for putting floppy_work, fd_timeout and
> fd_timer on, or it's not. If it's good enough, then flush_workqueue()
> should damn well be timely enough. And if flush_workqueue() isn't
> timely enough, then it doesn't sound like system_nrt_wq is the wrong
> choice.

So, per-work item, it's timely enough.  It shouldn't be different from
using a dedicated workqueue.  Different work items don't interact with
each other differently whether they belong to the same workqueue or
different ones as long as the workqueue's max_active limit isn't
reached.  flush_workqueue() is a different story as it forces all work
items belonging to the workqueue to be related.  That's why one of the
valid reasons to create a workqueue is to have a separate flush
(workqueue) domain - e.g. when the caller doesn't know which work
items need to be flushed because they're dynamically allocated and
freed on work item execution.

Thanks.

-- 
tejun

  reply	other threads:[~2012-05-17 14:55 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-16  7:36 [PATCH] floppy: convert to delayed work and single-thread wq Jiri Kosina
2012-05-16 14:57 ` Stephen Hemminger
2012-05-16 15:25 ` Linus Torvalds
2012-05-16 17:01 ` Tejun Heo
2012-05-16 19:37   ` Jiri Kosina
2012-05-16 19:43     ` Linus Torvalds
2012-05-16 19:47     ` Linus Torvalds
2012-05-16 19:51       ` Jiri Kosina
2012-05-16 19:53       ` Tejun Heo
2012-05-16 19:57         ` Jiri Kosina
2012-05-16 20:01           ` Tejun Heo
2012-05-16 20:24             ` Jiri Kosina
2012-05-16 20:29               ` Tejun Heo
2012-05-16 20:42                 ` Linus Torvalds
2012-05-17 14:55                   ` Tejun Heo [this message]
2012-05-17 15:03                     ` Linus Torvalds
2012-05-17 15:06                     ` Jiri Kosina
2012-05-17 15:09                       ` Tejun Heo
2012-05-17 15:46                         ` Jiri Kosina
2012-05-17 16:02                           ` Tejun Heo
2012-05-16 20:44                 ` Jiri Kosina
2012-05-17 15:06                   ` Tejun Heo
2012-05-17  7:56                 ` Jiri Kosina

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=20120517145519.GF21275@google.com \
    --to=tj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=jkosina@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    --cc=torvalds@linux-foundation.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