From: Eric Biggers <ebiggers3@gmail.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: Andreas Dilger <adilger@dilger.ca>,
Al Viro <viro@ZenIV.linux.org.uk>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
David Howells <dhowells@redhat.com>,
linux-kernel@vger.kernel.org, Eric Biggers <ebiggers@google.com>
Subject: Re: [PATCH v2] statx: optimize copy of struct statx to userspace
Date: Mon, 13 Mar 2017 11:11:50 -0700 [thread overview]
Message-ID: <20170313181150.GB108079@gmail.com> (raw)
In-Reply-To: <dbbe9bca-15c5-5d3f-92f0-80cc69ec7768@redhat.com>
On Mon, Mar 13, 2017 at 11:27:32AM +0100, Florian Weimer wrote:
> On 03/13/2017 05:34 AM, Andreas Dilger wrote:
> >Not that it is a huge deal either way, but I'd think it is harder for the
> >compiler to optimize across a function call boundary like memset() vs. a
> >struct initialization in the same function where it can see that all but
> >a few of the fields are being overwritten immediately before they are used.
>
> GCC treats memset as a function call only if options such as
> -ffreestanding or -fno-builtin are enabled, or if memset is
> redefined in a header file. Does the kernel do this?
>
No, it does not. So gcc treats memset() as a request to clear memory, not as a
request to call a function called "memset()" specifically. On x86_64 it's
compiling it into a "rep stos" instruction.
- Eric
prev parent reply other threads:[~2017-03-13 18:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-11 21:45 [PATCH v2] statx: optimize copy of struct statx to userspace Eric Biggers
2017-03-12 1:24 ` Al Viro
2017-03-12 2:16 ` Eric Biggers
2017-03-12 2:29 ` Al Viro
2017-03-12 4:02 ` Eric Biggers
2017-03-12 6:01 ` Eric Biggers
2017-03-13 4:34 ` Andreas Dilger
2017-03-13 10:27 ` Florian Weimer
2017-03-13 18:11 ` Eric Biggers [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=20170313181150.GB108079@gmail.com \
--to=ebiggers3@gmail.com \
--cc=adilger@dilger.ca \
--cc=dhowells@redhat.com \
--cc=ebiggers@google.com \
--cc=fweimer@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).