public inbox for [email protected]
 help / color / mirror / Atom feed
From: David Laight <[email protected]>
To: 'Pavel Begunkov' <[email protected]>, Jens Axboe <[email protected]>
Cc: Alexander Viro <[email protected]>,
	"[email protected]" <[email protected]>,
	"[email protected]" <[email protected]>,
	"[email protected]" <[email protected]>,
	"[email protected]" <[email protected]>,
	Matthew Wilcox <[email protected]>
Subject: RE: [PATCH 2/2] block: no-copy bvec for direct IO
Date: Wed, 9 Dec 2020 21:13:54 +0000	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <51905c4fcb222e14a1d5cb676364c1b4f177f582.1607477897.git.asml.silence@gmail.com>

From: Pavel Begunkov
> Sent: 09 December 2020 02:20
> 
> The block layer spends quite a while in blkdev_direct_IO() to copy and
> initialise bio's bvec. However, if we've already got a bvec in the input
> iterator it might be reused in some cases, i.e. when new
> ITER_BVEC_FLAG_FIXED flag is set. Simple tests show considerable
> performance boost, and it also reduces memory footprint.
...
> @@ -398,7 +422,11 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_vecs)
>  		bio->bi_end_io = blkdev_bio_end_io;
>  		bio->bi_ioprio = iocb->ki_ioprio;
> 
> -		ret = bio_iov_iter_get_pages(bio, iter);
> +		if (iov_iter_is_bvec(iter) && iov_iter_bvec_fixed(iter))
> +			ret = bio_iov_fixed_bvec_get_pages(bio, iter);
> +		else
> +			ret = bio_iov_iter_get_pages(bio, iter);
> +

Is it necessary to check iov_iter_is_bvec() as well as iov_iter_bvec_fixed() ?
If so it is probably worth using & not && so the compiler stands
a chance of generating a & (B | C) == B instead of 2 conditionals.
(I think I saw the bits in the same field being tested.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


  parent reply	other threads:[~2020-12-09 21:16 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-09  2:19 [RFC 0/2] nocopy bvec for direct IO Pavel Begunkov
2020-12-09  2:19 ` [PATCH 1/2] iov: introduce ITER_BVEC_FLAG_FIXED Pavel Begunkov
2020-12-09  8:36   ` Christoph Hellwig
2020-12-09  9:06     ` Christoph Hellwig
2020-12-09 11:54       ` Pavel Begunkov
2020-12-09 13:07     ` Al Viro
2020-12-09 13:37       ` Pavel Begunkov
2020-12-09 17:55         ` Christoph Hellwig
2020-12-09 18:24           ` Matthew Wilcox
2020-12-13 22:09             ` Pavel Begunkov
2020-12-09  2:19 ` [PATCH 2/2] block: no-copy bvec for direct IO Pavel Begunkov
2020-12-09  8:40   ` Christoph Hellwig
2020-12-09 12:01     ` Pavel Begunkov
2020-12-09 12:05       ` Christoph Hellwig
2020-12-09 12:03         ` Pavel Begunkov
2020-12-11 14:06     ` Johannes Weiner
2020-12-11 14:20       ` Pavel Begunkov
2020-12-11 15:38         ` Johannes Weiner
2020-12-11 15:47           ` Pavel Begunkov
2020-12-11 16:13             ` Johannes Weiner
2020-12-09 21:13   ` David Laight [this message]
2020-12-09  6:50 ` [RFC 0/2] nocopy " Christoph Hellwig
2020-12-09 11:54   ` Pavel Begunkov
2020-12-09 16:53 ` Jens Axboe
2020-12-13 22:03   ` Pavel Begunkov
2020-12-09 17:06 ` Al Viro

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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