[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170313181150.GB108079@gmail.com>
Date: Mon, 13 Mar 2017 11:11:50 -0700
From: Eric Biggers <ebiggers3@...il.com>
To: Florian Weimer <fweimer@...hat.com>
Cc: Andreas Dilger <adilger@...ger.ca>,
Al Viro <viro@...IV.linux.org.uk>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
David Howells <dhowells@...hat.com>,
linux-kernel@...r.kernel.org, Eric Biggers <ebiggers@...gle.com>
Subject: Re: [PATCH v2] statx: optimize copy of struct statx to userspace
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
Powered by blists - more mailing lists