Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: jonathan.derrick@intel.com (Jon Derrick)
Subject: [PATCH 1/2] block: add queue flag to always poll
Date: Thu, 5 May 2016 15:34:11 -0600	[thread overview]
Message-ID: <20160505213411.GA14146@localhost.localdomain> (raw)
In-Reply-To: <x49lh3o5hcs.fsf@segfault.boston.devel.redhat.com>

On Thu, May 05, 2016@05:23:47PM -0400, Jeff Moyer wrote:
> Jon Derrick <jonathan.derrick at intel.com> writes:
> 
> > This patch adds poll-by-default functionality back for 4.6 by adding a
> > queue flag which specifies that it should always try polling, rather
> > than only if the io specifies it.
> 
> I'm not against the functionality, but it somehow feels like you've
> implemented this at the wrong layer.  I'd much rather polling be forced
> on for the file or the mountpoint, and then all requests would come down
> with RWF_HIPRI and there would be no special casing in the direct I/O
> code.
It was mainly grouped with common code.

I'll look into your suggestion of tagging HIPRI on file or mountpoint.


> 
> In case others disagree, I've provided a couple of comments below.
> Really, though, I think this is implemented upside-down.
> 
> -Jeff
> 
> > Signed-off-by: Jon Derrick <jonathan.derrick at intel.com>
> > ---
> >  block/blk-core.c       | 8 ++++++++
> >  fs/direct-io.c         | 7 ++++++-
> >  include/linux/blkdev.h | 2 ++
> >  3 files changed, 16 insertions(+), 1 deletion(-)
> >
> > diff --git a/block/blk-core.c b/block/blk-core.c
> > index 827f8ba..d85f913 100644
> > --- a/block/blk-core.c
> > +++ b/block/blk-core.c
> > @@ -3335,6 +3335,14 @@ void blk_finish_plug(struct blk_plug *plug)
> >  }
> >  EXPORT_SYMBOL(blk_finish_plug);
> >  
> > +bool blk_force_poll(struct request_queue *q)
> > +{
> > +	if (!q->mq_ops || !q->mq_ops->poll ||
> > +	    !test_bit(QUEUE_FLAG_POLL_FORCE, &q->queue_flags))
> > +		return false;
> > +	return true;
> > +}
> 
> The flag shouldn't be set if it doesn't make sense, and these checks are
> re-done inside blk_poll, anyway.  Just do the test bit:
> 
> 	return test_bit(QUEUE_FLAG_POLL_FORCE, &q->queue_flags);
> 
Yeah I noticed that too after posting v1, but I didn't get much interest into
proposing v2. Thanks for catching that and reminding me of it.


> >  bool blk_poll(struct request_queue *q, blk_qc_t cookie)
> >  {
> >  	struct blk_plug *plug;
> > diff --git a/fs/direct-io.c b/fs/direct-io.c
> > index 476f1ec..2775552 100644
> > --- a/fs/direct-io.c
> > +++ b/fs/direct-io.c
> > @@ -450,7 +450,12 @@ static struct bio *dio_await_one(struct dio *dio)
> >  		__set_current_state(TASK_UNINTERRUPTIBLE);
> >  		dio->waiter = current;
> >  		spin_unlock_irqrestore(&dio->bio_lock, flags);
> > -		if (!(dio->iocb->ki_flags & IOCB_HIPRI) ||
> > +		/*
> > +		 * Polling must be enabled explicitly on a per-IO basis,
> > +		 * or through the queue's sysfs io_poll_force control
> > +		 */
> > +		if (!((dio->iocb->ki_flags & IOCB_HIPRI) ||
> > +		      (blk_force_poll(bdev_get_queue(dio->bio_bdev)))) ||
> >  		    !blk_poll(bdev_get_queue(dio->bio_bdev), dio->bio_cookie))
> 
> Make a local variable for the queue, please.
> 
Sounds good

> -Jeff

  reply	other threads:[~2016-05-05 21:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-31 20:19 [PATCH 0/2] Block: Give option to force io polling Jon Derrick
2016-03-31 20:19 ` [PATCH 1/2] block: add queue flag to always poll Jon Derrick
2016-05-05 21:23   ` Jeff Moyer
2016-05-05 21:34     ` Jon Derrick [this message]
2016-03-31 20:19 ` [PATCH 2/2] block: add forced polling sysfs controls Jon Derrick
2016-04-05 12:38 ` [PATCH 0/2] Block: Give option to force io polling Christoph Hellwig
2016-04-05 15:54   ` Keith Busch
2016-04-05 17:27     ` Christoph Hellwig
2016-04-05 18:07       ` Stephen Bates
2016-05-05 19:44 ` Stephen Bates
2016-05-08  9:02   ` hch
2016-05-09 14:53     ` Stephen Bates
2016-05-12  7:08       ` hch
2016-05-12 17:27         ` Stephen Bates
2016-05-12 17:34           ` Derrick, Jonathan

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=20160505213411.GA14146@localhost.localdomain \
    --to=jonathan.derrick@intel.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