Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933317AbdCLC3z (ORCPT ); Sat, 11 Mar 2017 21:29:55 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:57768 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755391AbdCLC3r (ORCPT ); Sat, 11 Mar 2017 21:29:47 -0500 Date: Sun, 12 Mar 2017 02:29:27 +0000 From: Al Viro To: Eric Biggers Cc: linux-fsdevel@vger.kernel.org, David Howells , linux-kernel@vger.kernel.org, Eric Biggers Subject: Re: [PATCH v2] statx: optimize copy of struct statx to userspace Message-ID: <20170312022923.GQ29622@ZenIV.linux.org.uk> References: <20170311214555.941-1-ebiggers3@gmail.com> <20170312012411.GN29622@ZenIV.linux.org.uk> <20170312021655.GA593@zzz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170312021655.GA593@zzz> User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1373 Lines: 30 On Sat, Mar 11, 2017 at 06:16:55PM -0800, Eric Biggers wrote: > Hi Al, > > On Sun, Mar 12, 2017 at 01:24:15AM +0000, Al Viro wrote: > > On Sat, Mar 11, 2017 at 01:45:55PM -0800, Eric Biggers wrote: > > > From: Eric Biggers > > > > > > I found that statx() was significantly slower than stat(). As a > > > microbenchmark, I compared 10,000,000 invocations of fstat() on a tmpfs > > > file to the same with statx() passed a NULL path: > > > > Umm... > > > > Well, it's a silly benchmark, but stat performance is important, and usually > things are cached already so most of the time is just overhead --- which this > measures. And since nothing actually uses statx() yet, you can't do a benchmark > just by running some command like 'git status' or whatever. Oh, I agree that multiple __put_user() are wrong; I also agree that bulk copy is the right approach (when we get the unsafe stuff right, we can revisit that, but I suspect that on quite a few architectures a bulk copy will still give better time, no matter what). > If padding is a concern at all (AFAICS it's not actually an issue now with > struct statx, but people tend to have different opinions on how careful they > want to be with padding), then I think we'll just have to start by memsetting > the whole struct to 0. My point is simply that it's worth a comment in that code.