From: David Laight <David.Laight@ACULAB.COM>
To: 'Jens Axboe' <axboe@kernel.dk>, LKML <linux-kernel@vger.kernel.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>
Subject: RE: [PATCH] iov_iter: streamline iovec/bvec alignment iteration
Date: Wed, 24 Jan 2024 12:07:55 +0000 [thread overview]
Message-ID: <9b43b9f3a32642e5a6388f3b1c8b114d@AcuMS.aculab.com> (raw)
In-Reply-To: <bd2f28ab-78cf-4ae0-a62a-d23a94fb3839@kernel.dk>
From: Jens Axboe
> Sent: 23 January 2024 19:49
>
> Rewrite iov_iter_aligned_iovec() and iov_iter_aligned_bvec() to be both
> easier to read, and also significantly more compact in terms of
> generated code. This saves 178 bytes of text on x86-64 for me (with
> clang-18) and 136 bytes on arm64 (with gcc-13).
>
...
> diff --git a/lib/iov_iter.c b/lib/iov_iter.c
> index e0aa6b440ca5..2fcc47d822e3 100644
> --- a/lib/iov_iter.c
> +++ b/lib/iov_iter.c
> @@ -714,12 +714,11 @@ EXPORT_SYMBOL(iov_iter_discard);
...
> - for (k = 0; k < i->nr_segs; k++, skip = 0) {
> - const struct iovec *iov = iter_iov(i) + k;
> + do {
> size_t len = iov->iov_len - skip;
Is i->nr_segs allowed to be zero?
The old code (seemed to) check for zero.
The new version will go horribly wrong.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2024-01-24 12:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-23 19:49 Jens Axboe
2024-01-24 12:07 ` David Laight [this message]
2024-01-24 14:49 ` Jens Axboe
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=9b43b9f3a32642e5a6388f3b1c8b114d@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®