All of lore.kernel.org
 help / color / mirror / Atom feed
From: axboe@kernel.dk (Jens Axboe)
Subject: RFC: Allow block drivers to poll for I/O instead of sleeping
Date: Tue, 25 Jun 2013 16:57:54 +0200	[thread overview]
Message-ID: <20130625145754.GL5594@kernel.dk> (raw)
In-Reply-To: <20130625001102.GA6623@home.goodmis.org>

On Mon, Jun 24 2013, Steven Rostedt wrote:
> On Mon, Jun 24, 2013@09:17:18AM +0200, Jens Axboe wrote:
> > On Sun, Jun 23 2013, Linus Torvalds wrote:
> > > 
> > > You could try to do that either *in* the idle thread (which would take
> > > the context switch overhead - maybe negating some of the advantages),
> > > or alternatively hook into the scheduler idle logic before actually
> > > doing the switch.
> > 
> > It can't happen in the idle thread. If you need to take the context
> > switch, then you've negated pretty much all of the gain of the polled
> > approach.
> 
> What about hooking into the idle_balance code? That happens if we are
> about to go to idle but before the full schedule switch to the idle
> task.
> 
> 
> In __schedule(void):
> 
> 	if (unlikely(!rq->nr_running))
> 		idle_balance(cpu, rq);

If you can avoid the switch (sleep/wakeup), then that's what matters. If
you end up sleeping, you've lost that latency game and polling is mostly
useful in the blk_iopoll designed fashion for high iops scenarios.
Besides, you need the task + page context to be able to find out what to
poll for (and when to stop).

-- 
Jens Axboe

WARNING: multiple messages have this Message-ID (diff)
From: Jens Axboe <axboe@kernel.dk>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Ingo Molnar <mingo@kernel.org>,
	Matthew Wilcox <willy@linux.intel.com>,
	Al Viro <viro@zeniv.linux.org.uk>, Ingo Molnar <mingo@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-nvme@lists.infradead.org,
	Linux SCSI List <linux-scsi@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: RFC: Allow block drivers to poll for I/O instead of sleeping
Date: Tue, 25 Jun 2013 16:57:54 +0200	[thread overview]
Message-ID: <20130625145754.GL5594@kernel.dk> (raw)
In-Reply-To: <20130625001102.GA6623@home.goodmis.org>

On Mon, Jun 24 2013, Steven Rostedt wrote:
> On Mon, Jun 24, 2013 at 09:17:18AM +0200, Jens Axboe wrote:
> > On Sun, Jun 23 2013, Linus Torvalds wrote:
> > > 
> > > You could try to do that either *in* the idle thread (which would take
> > > the context switch overhead - maybe negating some of the advantages),
> > > or alternatively hook into the scheduler idle logic before actually
> > > doing the switch.
> > 
> > It can't happen in the idle thread. If you need to take the context
> > switch, then you've negated pretty much all of the gain of the polled
> > approach.
> 
> What about hooking into the idle_balance code? That happens if we are
> about to go to idle but before the full schedule switch to the idle
> task.
> 
> 
> In __schedule(void):
> 
> 	if (unlikely(!rq->nr_running))
> 		idle_balance(cpu, rq);

If you can avoid the switch (sleep/wakeup), then that's what matters. If
you end up sleeping, you've lost that latency game and polling is mostly
useful in the blk_iopoll designed fashion for high iops scenarios.
Besides, you need the task + page context to be able to find out what to
poll for (and when to stop).

-- 
Jens Axboe


  parent reply	other threads:[~2013-06-25 14:57 UTC|newest]

Thread overview: 42+ 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-20 20:17 ` Matthew Wilcox
2013-06-23 10:09 ` Ingo Molnar
2013-06-23 10:09   ` Ingo Molnar
2013-06-23 18:29   ` Linus Torvalds
2013-06-23 18:29     ` Linus Torvalds
2013-06-24  7:17     ` Jens Axboe
2013-06-24  7:17       ` Jens Axboe
2013-06-25  0:11       ` Steven Rostedt
2013-06-25  0:11         ` Steven Rostedt
2013-06-25  3:07         ` Matthew Wilcox
2013-06-25  3:07           ` Matthew Wilcox
2013-06-25 13:57           ` Steven Rostedt
2013-06-25 13:57             ` Steven Rostedt
2013-06-25 14:57         ` Jens Axboe [this message]
2013-06-25 14:57           ` Jens Axboe
2013-06-24  8:07     ` Ingo Molnar
2013-06-24  8:07       ` Ingo Molnar
2013-06-25  3:18       ` Matthew Wilcox
2013-06-25  3:18         ` Matthew Wilcox
2013-06-25  7:07         ` Bart Van Assche
2013-06-25  7:07           ` Bart Van Assche
2013-06-25 15:00         ` Jens Axboe
2013-06-25 15:00           ` Jens Axboe
2013-06-27 18:10     ` Rik van Riel
2013-06-27 18:10       ` Rik van Riel
2013-06-23 22:14   ` David Ahern
2013-06-23 22:14     ` David Ahern
2013-06-24  8:21     ` Ingo Molnar
2013-06-24  8:21       ` Ingo Molnar
2013-06-24  7:15   ` Jens Axboe
2013-06-24  7:15     ` Jens Axboe
2013-06-24  8:18     ` Ingo Molnar
2013-06-24  8:18       ` Ingo Molnar
2013-06-25  3:01     ` Matthew Wilcox
2013-06-25  3:01       ` Matthew Wilcox
2013-06-25 14:55       ` Jens Axboe
2013-06-25 14:55         ` Jens Axboe
2013-06-27 18:42 ` Rik van Riel
2013-06-27 18:42   ` Rik van Riel
2013-07-04  1:13 ` Shaohua Li
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=20130625145754.GL5594@kernel.dk \
    --to=axboe@kernel.dk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.