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:18:38 +0200	[thread overview]
Message-ID: <20130624081838.GB21768@gmail.com> (raw)
In-Reply-To: <20130624071544.GR9422@kernel.dk>


* Jens Axboe <axboe@kernel.dk> wrote:

> - With the former note, the app either needs to opt in (and hence
>   willingly sacrifice CPU cycles of its scheduling slice) or it needs to 
>   be nicer in when it gives up and goes back to irq driven IO.

The scheduler could look at sleep latency averages of the task in question 
- we measure that already in most cases.

If the 'average sleep latency' is below a certain threshold, the 
scheduler, if it sees that the CPU is about to go idle, could delay doing 
the context switch and do "light idle-polling", for say twice the length 
of the expected sleep latency - assuming the CPU is otherwise idle - 
before it really schedules away the task and the CPU goes idle.

This would still require an IRQ and a wakeup to be taken, but would avoid 
the context switch.

Yet I have an ungood feeling about depending on actual latency values so 
explicitly. There will have to be a cutoff value, and if a workload is 
just below or just above that threshold then behavior will change 
markedly. Such schemes rarely worked out nicely in the past. [Might still 
be worth trying it.]

Couldn't the block device driver itself estimate the expected latency of 
IO completion and simply poll if that's expected to be very short [such as 
there's only a single outstanding IO to a RAM backed device]? IO drivers 
doing some polling and waiting in the microseconds range isnt overly 
controversial. I'd even do that if the CPU is busy otherwise: the task 
should see a proportional slowdown as load increases, with no change in IO 
queueing behavior.

Thanks,

	Ingo

  reply	other threads:[~2013-06-24  8:18 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
2013-06-24  7:15   ` Jens Axboe
2013-06-24  8:18     ` Ingo Molnar [this message]
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=20130624081838.GB21768@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).