From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753438AbbDMGdY (ORCPT ); Mon, 13 Apr 2015 02:33:24 -0400 Received: from mail-ig0-f176.google.com ([209.85.213.176]:34970 "EHLO mail-ig0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751498AbbDMGdW (ORCPT ); Mon, 13 Apr 2015 02:33:22 -0400 Date: Mon, 13 Apr 2015 14:33:27 +0800 From: Boqun Feng To: Al Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Moore Subject: Re: [PATCH v2] vfs: avoid recopying file names in getname_flags Message-ID: <20150413063327.GB25517@fixme-laptop.cn.ibm.com> References: <1427309152-25129-1-git-send-email-boqun.feng@gmail.com> <20150329042744.GA1477@fixme-laptop> <20150407083826.GA1048@fixme-laptop.cn.ibm.com> <20150411235655.GK889@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="IiVenqGWf+H9Y6IX" Content-Disposition: inline In-Reply-To: <20150411235655.GK889@ZenIV.linux.org.uk> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --IiVenqGWf+H9Y6IX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Al, On Sun, Apr 12, 2015 at 12:56:55AM +0100, Al Viro wrote: > On Tue, Apr 07, 2015 at 04:38:26PM +0800, Boqun Feng wrote: > > Ping again... >=20 > What exactly does it buy us? You need a pathname just a bit under 4Kb, w= hich, > with all due respect, is an extremely rare case. Resulting code is more > complicated, we _still_ copy twice (sure, the second time is for 16 bytes= or > so, but...), instead of "compare with the address of embedded array" we g= et > the loveliness like > > > > + if (name->name !=3D ((char *)name - EMBEDDED_NAME_MAX)) { > this... _And_, on top of everything else, we get name and name->name > guaranteed to hit different cachelines, in all cases, including the common > ones. >=20 > What for? It's not as if userland memory had been communicated with by > IP over carrier pigeons, after all, and the cost of 4Kb worth of > (essentially) memcpy() is going to be > a) incurred in extremely rare case > and > b) be dwarfed by the work we need to _do_ with what we'd copied. > After all, that pathname is going to be parsed and traversed - all 4Kb > worth of it. >=20 > So what's the point? Thank you for your response. Well, my original purpose of doing this is to avoid recopying file names, I thought although long file names are race, it's worthy if we can optimize without affecting common cases. But you are right, I fail to take cachelines into consideration, so comman cases are affected. Before I totally give it up, I'd like to run some performance tests about this patch, which I should do before sending the patch, I will do better next time ;-) If I find something new, I will let you know. Thanks again for your comments. Regards, Boqun Feng --IiVenqGWf+H9Y6IX Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJVK2MzAAoJEEl56MO1B/q4uuIIAI0tU1ohkUcgrJoHrp5CEis0 mjbY6tCR8yyfGJ2w8kaIidk+Lcfnk5vMex0UdvLOKMSufOoRRrH2Di1lXXDRrdrH oBe572u+vxuKhCkUk4/rTZ0ouDEs0Ufvf6Cg/YtTMdaY03c6IWJaF50solvZyDLK FSNNHR0ih5jSwMnb8WLIm1OIkk7tyRz3cAVoyTRoY95qUh3scr44f4tBPdA2Yd7R ml2ZQnMqbXnqbGeBxs9I9frHL1hmbBOGPTweO+iZyjmYZdZ+DtG1oHH0oWNrY/vw HAvZcF82chmlF8wSHzPemeglV/1j8D5INUcwW57+890s8ENx/nEReUN8ide7vq4= =bImu -----END PGP SIGNATURE----- --IiVenqGWf+H9Y6IX--