From: Al Viro <viro@zeniv.linux.org.uk>
To: Li kunyu <kunyu@nfschina.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] utsname: Optimize clone_uts_ns()
Date: Mon, 15 Jan 2024 06:54:40 +0000 [thread overview]
Message-ID: <20240115065440.GF1674809@ZenIV> (raw)
In-Reply-To: <20240115061127.30836-1-kunyu@nfschina.com>
On Mon, Jan 15, 2024 at 02:11:27PM +0800, Li kunyu wrote:
> Optimize the err variable assignment location so that the err variable
> is manually modified when an error occurs.
First of all, this is *not* an optimization in any meaningful sense -
compiler is perfectly capable to shift those assignments (from either
form) and choose whatever it prefers.
Incidentally, it might end up lifting the store out of if - it's
entirely possible that
r1 = v
flag = (r2 == 0)
if flag goto fail
is better than
flag = (r2 == 0)
if flag goto l
...
l:
r1 = v
goto fail
provided that assignment to r1 and checking r2 can be done in parallel
and that's assuming that it will figure out that branch is unlikely.
Readability might be a good reason; optimization... no. Leave that to
compiler; it will override your choice here anyway.
prev parent reply other threads:[~2024-01-15 6:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-15 6:11 [PATCH] utsname: Optimize clone_uts_ns() Li kunyu
2024-01-15 6:54 ` 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=20240115065440.GF1674809@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=kunyu@nfschina.com \
--cc=linux-kernel@vger.kernel.org \
/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