Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1598433

Re: [PATCH] statx: optimize copy of struct statx to userspace

Path csiph.com!feeder.erje.net!2.eu.feeder.erje.net!ecngs!feeder2.ecngs.de!78.46.240.70.MISMATCH!weretis.net!feeder4.news.weretis.net!news.albasani.net!tahina.priv.at!bofh.it!news.nic.it!robomod
From David Howells <dhowells@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] statx: optimize copy of struct statx to userspace
Date Sat, 11 Mar 2017 20:30:01 +0100
Message-ID <tjUSd-7fQ-1@gated-at.bofh.it> (permalink)
References <tjMhX-1jq-5@gated-at.bofh.it>
X-Original-To Eric Biggers <ebiggers3@gmail.com>
Organization Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903
MIME-Version 1.0
Content-Type text/plain; charset="us-ascii"
Content-ID <9623.1489260500.1@warthog.procyon.org.uk>
X-Scanned-By MIMEDefang 2.68 on 10.5.11.24
X-Greylist Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Sat, 11 Mar 2017 19:28:23 +0000 (UTC)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 41
X-Original-Cc dhowells@redhat.com, linux-fsdevel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>, linux-kernel@vger.kernel.org, Eric Biggers <ebiggers@google.com>
X-Original-Date Sat, 11 Mar 2017 19:28:20 +0000
X-Original-Message-ID <9624.1489260500@warthog.procyon.org.uk>
X-Original-References <20170311101510.6504-1-ebiggers3@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1598433

Show key headers only | View raw


Eric Biggers <ebiggers3@gmail.com> wrote:

> From: Eric Biggers <ebiggers@google.com>
> 
> 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:
> 
> 	$ time ./stat_benchmark
> 
> 	real	0m1.464s
> 	user	0m0.275s
> 	sys	0m1.187s
> 
> 	$ time ./statx_benchmark
> 
> 	real	0m5.530s
> 	user	0m0.281s
> 	sys	0m5.247s
> 
> statx is expected to be a little slower than stat because struct statx
> is larger than struct stat, but not by *that* much.  It turns out that
> most of the overhead was in copying struct statx to userspace,
> apparently mostly in all the stac/clac instructions that got generated
> for each __put_user() call.  (This was on x86_64, but some other
> architectures, e.g. arm64, have something similar now too.)
> 
> stat() instead initializes its struct on the stack and copies it to
> userspace with a single call to copy_to_user().  This turns out to be
> much faster, and changing statx to do this makes it almost as fast as
> stat:
> 
> 	$ time ./statx_benchmark
> 
> 	real	0m1.573s
> 	user	0m0.229s
> 	sys	0m1.344s
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>

Acked-by: David Howells <dhowells@redhat.com>

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] statx: optimize copy of struct statx to userspace Eric Biggers <ebiggers3@gmail.com> - 2017-03-11 11:20 +0100
  Re: [PATCH] statx: optimize copy of struct statx to userspace David Howells <dhowells@redhat.com> - 2017-03-11 20:30 +0100
  Re: [PATCH] statx: optimize copy of struct statx to userspace Eric Biggers <ebiggers3@gmail.com> - 2017-03-11 22:50 +0100

csiph-web