lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 7 Aug 2021 11:30:48 +0100
From:   Pavel Begunkov <asml.silence@...il.com>
To:     Al Viro <viro@...iv.linux.org.uk>
Cc:     Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
        linux-fsdevel@...r.kernel.org, Jens Axboe <axboe@...nel.dk>,
        linux-kernel@...r.kernel.org
Subject: Re: [RFC] mm: optimise generic_file_read_iter

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ