Re: generic_permission() optimization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 31, 2024 at 03:17:18PM -1000, Linus Torvalds wrote:
> On Thu, 31 Oct 2024 at 12:34, Linus Torvalds
> <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > So I'd rather start with just the cheap inode-only "ACL is clearly not
> > there" check, and later if we find that the ACL_NOT_CACHED case is
> > problematic do we look at that.
> 
> Actually, if I switch the tests around so that I do the permission bit
> check first, it becomes very natural to just check IS_POSIXACL() at
> the end (where we're about to go to the slow case, which will be
> touching i_sb anyway).
> 
> Plus I can actually improve code generation by not shifting the mode
> bits down into the low bits, but instead spreading the requested
> permission bits around.
> 
> The "spread bits around" becomes a simple constant multiplication with
> just three bits set, and the compiler will actually generate much
> better code (you can do it with two consecutive 'lea' instructions).
> 
> The expression for this ends up looking a bit like line noise, so a
> comment explaining each step is a good idea.
> 
> IOW, here's a rewritten patch that does it that way around, and thus
> deals with IS_POSIXACL() very naturally and seems to generate quite
> good code for me.

Acked-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux