linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: mateusznosek0@gmail.com
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] fs: micro-optimization remove branches by adjusting flag values
Date: Tue, 15 Sep 2020 01:31:50 +0100	[thread overview]
Message-ID: <20200915003150.GJ3421308@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20200914174338.9808-1-mateusznosek0@gmail.com>

On Mon, Sep 14, 2020 at 07:43:38PM +0200, mateusznosek0@gmail.com wrote:
> From: Mateusz Nosek <mateusznosek0@gmail.com>
> 
> When flags A and B have equal values than the following code
> 
> if(flags1 & A)
> 	flags2 |= B;
> 
> is equivalent to
> 
> flags2 |= (flags1 & A);
> 
> The latter code should generate less instructions and be faster as one
> branch is omitted in it.
> 
> Introduced patch changes the value of 'LOOKUP_EMPTY' and makes it equal
> to the value of 'AT_EMPTY_PATH'. Thanks to that, few branches can be
> changed in a way showed above which improves both performance and the
> size of the code.

No.  AT_EMPTY_PATH is a part of userland ABI; to tie LOOKUP_EMPTY to it
means that we can't ever modify the sucker.  Worse, it restricts any
possible reshuffling of the LOOKUP_... bits in the future.

So unless you can show an effect on the real-world profiles, there are
fairly strong reasons to avoid that headache.

      parent reply	other threads:[~2020-09-15  0:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-14 17:43 [RFC PATCH] fs: micro-optimization remove branches by adjusting flag values mateusznosek0
2020-09-14 18:06 ` Matthew Wilcox
2020-09-15  0:38   ` Al Viro
2020-09-15  0:31 ` Al Viro [this message]

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=20200915003150.GJ3421308@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mateusznosek0@gmail.com \
    /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).