From: riel@redhat.com (Rik van Riel)
Subject: RFC: Allow block drivers to poll for I/O instead of sleeping
Date: Thu, 27 Jun 2013 14:42:33 -0400 [thread overview]
Message-ID: <51CC8799.9070909@redhat.com> (raw)
In-Reply-To: <20130620201713.GV8211@linux.intel.com>
On 06/20/2013 04:17 PM, Matthew Wilcox wrote:
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -4527,6 +4527,36 @@ long __sched io_schedule_timeout(long timeout)
> return ret;
> }
>
> +/*
> + * Wait for an I/O to complete against this backing_dev_info. If the
> + * task exhausts its timeslice polling for completions, call io_schedule()
> + * anyway. If a signal comes pending, return so the task can handle it.
> + * If the io_poll returns an error, give up and call io_schedule(), but
> + * swallow the error. We may miss an I/O completion (eg if the interrupt
> + * handler gets to it first). Guard against this possibility by returning
> + * if we've been set back to TASK_RUNNING.
> + */
> +void io_wait(struct backing_dev_info *bdi)
> +{
I would like something a little more generic in the
scheduler code, that could also be used by other
things in the kernel (say, KVM with message passing
workloads).
Maybe something looking a little like this?
void idle_poll(struct idle_poll_info *ipi)
struct idle_poll_info {
int (*idle_poll_func)(void *data);
int (*idle_poll_preempt)(void *data);
void *data;
}
That way the kernel can:
1) mark the current thread as having idle priority,
allowing the scheduler to preempt it if something
else wants to run
2) switch to asynchronous mode if something else wants
to run, or if the average wait for the process is
so long that it is better to go asynchronous and
avoid polling
3) poll for completion if nothing else wants to run
Does that make sense?
Did I forget something you need?
Did I forget something KVM could need?
Is this insane? If so, is it too insane? :)
next prev parent reply other threads:[~2013-06-27 18:42 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
2013-06-25 3:01 ` Matthew Wilcox
2013-06-25 14:55 ` Jens Axboe
2013-06-27 18:42 ` Rik van Riel [this message]
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=51CC8799.9070909@redhat.com \
--to=riel@redhat.com \
/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).