From: Jens Axboe <axboe@kernel.dk>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Theodore Ts'o <tytso@mit.edu>, Christoph Hellwig <hch@lst.de>,
LKML <linux-kernel@vger.kernel.org>,
Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH v4 0/3] random: convert to using iters, for Al Viro
Date: Fri, 20 May 2022 09:58:28 -0600 [thread overview]
Message-ID: <79024675-9a4a-cb2b-a0ed-91067ef05783@kernel.dk> (raw)
In-Reply-To: <Yoe52RaMayvgodVW@zx2c4.com>
On 5/20/22 9:55 AM, Jason A. Donenfeld wrote:
> Hi Jens,
>
> On Fri, May 20, 2022 at 09:44:25AM -0600, Jens Axboe wrote:
>> Ran 32, 1k, 4k here and it does seem to be down aboout 3%. Which is
>> definitely bigger than I expected, particularly for larger reads. If
>> anything, the 32b read seems comparably better than eg 1k or 4k, which
>> is also unexpected. Let me do a bit of profiling to see what is up.
>
> Something to keep in mind wrt 32b is that for complicated crypto
> reasons, the function has this logic:
>
> - If len <= 32, generate one 64 byte block and give <= 32 bytes of it to
> the caller.
>
> - If len > 32, generate one 64 byte block, but give 0 of it to the
> caller. Then generate ?len/64? blocks for the caller.
>
> Put together, this means:
>
> - 1..32, 1 block
> - 33..64, 2 blocks
> - 65..128, 3 blocks
> - 129..196, 4 blocks
>
> So you get this sort of shelf where the amortization benefits don't
> really kick in until after 3 blocks.
Ah I see, I can see if 64b is closer to the change for eg 1k.
>> If you're worried about it, I'd just keep the read/write and add the
>> iter variants on the side.
>
> Not a chance of that. These functions are already finicky as-is; I would
> really hate to have to duplicate all of these paths.
Then I'd say there are only two options:
- Add a helper that provides splice for something that only has
read/write set.
- Just accept that we're 3% slower reading from /dev/urandom for now,
and maybe 1-2% for small reads. Can't really imagine this being a huge
issue, how many high throughput /dev/urandom read situations exist in
the real world?
--
Jens Axboe
next prev parent reply other threads:[~2022-05-20 15:58 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-20 9:44 [PATCH v4 0/3] random: convert to using iters, for Al Viro Jason A. Donenfeld
2022-05-20 9:44 ` [PATCH v4 1/3] random: convert to using fops->read_iter() Jason A. Donenfeld
2022-05-20 13:37 ` Jason A. Donenfeld
2022-05-20 14:36 ` Jens Axboe
2022-05-20 14:39 ` Jason A. Donenfeld
2022-05-20 15:12 ` Al Viro
2022-05-20 9:44 ` [PATCH v4 2/3] random: convert to using fops->write_iter() Jason A. Donenfeld
2022-05-20 9:44 ` [PATCH v4 3/3] random: wire up fops->splice_{read,write}_iter() Jason A. Donenfeld
2022-05-20 12:16 ` [PATCH v4 0/3] random: convert to using iters, for Al Viro Jens Axboe
2022-05-20 15:25 ` Jason A. Donenfeld
2022-05-20 15:34 ` Jens Axboe
2022-05-20 15:39 ` Jason A. Donenfeld
2022-05-20 15:44 ` Jens Axboe
2022-05-20 15:55 ` Jason A. Donenfeld
2022-05-20 15:58 ` Jens Axboe [this message]
2022-05-20 16:03 ` Jason A. Donenfeld
2022-05-20 16:06 ` Jens Axboe
2022-05-20 15:46 ` Jason A. Donenfeld
2022-05-20 15:51 ` Jens Axboe
2022-05-20 15:58 ` Jason A. Donenfeld
2022-05-20 16:00 ` Jens Axboe
2022-05-20 15:47 ` Al Viro
2022-05-20 15:53 ` Jens Axboe
2022-05-20 16:15 ` Al Viro
2022-05-20 16:24 ` Jens Axboe
2022-05-20 16:39 ` Jason A. Donenfeld
2022-05-20 16:41 ` Jens Axboe
2022-05-24 4:52 ` Eric W. Biederman
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=79024675-9a4a-cb2b-a0ed-91067ef05783@kernel.dk \
--to=axboe@kernel.dk \
--cc=Jason@zx2c4.com \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
--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