linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mingo@kernel.org (Ingo Molnar)
Subject: RFC: Allow block drivers to poll for I/O instead of sleeping
Date: Mon, 24 Jun 2013 10:21:47 +0200	[thread overview]
Message-ID: <20130624082147.GC21768@gmail.com> (raw)
In-Reply-To: <51C77344.2040907@gmail.com>


* David Ahern <dsahern@gmail.com> wrote:

> On 6/23/13 3:09 AM, Ingo Molnar wrote:
> >If an IO driver is implemented properly then it will batch up requests for
> >the controller, and gets IRQ-notified on a (sub-)batch of buffers
> >completed.
> >
> >If there's any spinning done then it should be NAPI-alike polling: a
> >single "is stuff completed" polling pass per new block of work submitted,
> >to opportunistically interleave completion with submission work.
> >
> >I don't see where active spinning brings would improve performance
> >compared to a NAPI-alike technique. Your numbers obviously show a speedup
> >we'd like to have, I'm just wondering whether the same speedup (or even
> >more) could be implemented via:
> >
> >  - smart batching that rate-limits completion IRQs in essence
> >  + NAPI-alike polling
> >
> >... which would almost never result in IRQ driven completion when we are
> >close to CPU-bound and while not yet saturating the IO controller's
> >capacity.
> >
> >The spinning approach you add has the disadvantage of actively wasting CPU
> >time, which could be used to run other tasks. In general it's much better
> >to make sure the completion IRQs are rate-limited and just schedule. This
> >(combined with a metric ton of fine details) is what the networking code
> >does in essence, and they have no trouble reaching very high throughput.
> 
> Networking code has a similar proposal for low latency sockets using 
> polling: https://lwn.net/Articles/540281/

In that case it might make sense to try the generic approach I suggested 
in the previous mail, which would measure average sleep latencies of 
tasks, and would do light idle-polling instead of the more expensive 
switch-to-the-idle-task context switch plus associated RCU, nohz, etc. 
busy-CPU-tear-down and the symmetric build-up work on idle wakeup.

The IO driver would still have to take an IRQ though, preferably on the 
CPU that runs the IO task ...

Thanks,

	Ingo

  reply	other threads:[~2013-06-24  8:21 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-20 20:17 RFC: Allow block drivers to poll for I/O instead of sleeping Matthew Wilcox
2013-06-23 10:09 ` Ingo Molnar
2013-06-23 18:29   ` Linus Torvalds
2013-06-24  7:17     ` Jens Axboe
2013-06-25  0:11       ` Steven Rostedt
2013-06-25  3:07         ` Matthew Wilcox
2013-06-25 13:57           ` Steven Rostedt
2013-06-25 14:57         ` Jens Axboe
2013-06-24  8:07     ` Ingo Molnar
2013-06-25  3:18       ` Matthew Wilcox
2013-06-25  7:07         ` Bart Van Assche
2013-06-25 15:00         ` Jens Axboe
2013-06-27 18:10     ` Rik van Riel
2013-06-23 22:14   ` David Ahern
2013-06-24  8:21     ` Ingo Molnar [this message]
2013-06-24  7:15   ` Jens Axboe
2013-06-24  8:18     ` Ingo Molnar
2013-06-25  3:01     ` Matthew Wilcox
2013-06-25 14:55       ` Jens Axboe
2013-06-27 18:42 ` Rik van Riel
2013-07-04  1:13 ` Shaohua Li

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=20130624082147.GC21768@gmail.com \
    --to=mingo@kernel.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).