From: Pavel Begunkov <asml.silence@gmail.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
Jens Axboe <axboe@kernel.dk>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC] mm: optimise generic_file_read_iter
Date: Sat, 7 Aug 2021 11:30:48 +0100 [thread overview]
Message-ID: <d6d36192-4afa-c8a5-5bc0-43bb667b7694@gmail.com> (raw)
In-Reply-To: <YQ09tqMda2ke2qHy@zeniv-ca.linux.org.uk>
On 8/6/21 2:48 PM, Al Viro wrote:
> On Fri, Aug 06, 2021 at 12:42:43PM +0100, Pavel Begunkov wrote:
>> Unless direct I/O path of generic_file_read_iter() ended up with an
>> error or a short read, it doesn't use inode. So, load inode and size
>> later, only when they're needed. This cuts two memory reads and also
>> imrpoves code generation, e.g. loads from stack.
>
> ... and the same question here.
>
>> NOTE: as a side effect, it reads inode->i_size after ->direct_IO(), and
>> I'm not sure whether that's valid, so would be great to get feedback
>> from someone who knows better.
>
> Ought to be safe, I think, but again, how much effect have you observed
> from the patch?
Answering for both patches -- I haven't benchmarked it and don't expect
to find anything just from this one, considering variance between runs.
I took a loot at the assembly (gcc 11.1), it removes 2 reads to get
i_size, write+read that i_size from stack, because it stashed it on
the stack.
For example, we've squeezed several percents of throughput before on
the io_uring side just by cutting sheer number of not too expensive
individually instructions. IMHO, it's easier to do when you spotted
something by the way, than rediscovering the same during a performance
safari.
--
Pavel Begunkov
next prev parent reply other threads:[~2021-08-07 10:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-06 11:42 [RFC] mm: optimise generic_file_read_iter Pavel Begunkov
2021-08-06 13:48 ` Al Viro
2021-08-06 17:18 ` Jens Axboe
2021-08-07 10:30 ` Pavel Begunkov [this message]
2021-08-06 23:49 ` Dave Chinner
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=d6d36192-4afa-c8a5-5bc0-43bb667b7694@gmail.com \
--to=asml.silence@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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;
as well as URLs for NNTP newsgroup(s).