Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753855AbdCMSME (ORCPT ); Mon, 13 Mar 2017 14:12:04 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:36497 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752513AbdCMSLy (ORCPT ); Mon, 13 Mar 2017 14:11:54 -0400 Date: Mon, 13 Mar 2017 11:11:50 -0700 From: Eric Biggers To: Florian Weimer Cc: Andreas Dilger , Al Viro , linux-fsdevel , David Howells , linux-kernel@vger.kernel.org, Eric Biggers Subject: Re: [PATCH v2] statx: optimize copy of struct statx to userspace Message-ID: <20170313181150.GB108079@gmail.com> References: <20170311214555.941-1-ebiggers3@gmail.com> <20170312012411.GN29622@ZenIV.linux.org.uk> <20170312021655.GA593@zzz> <20170312022923.GQ29622@ZenIV.linux.org.uk> <20170312040206.GA3684@zzz> <20170312060148.GA1595@zzz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 815 Lines: 17 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