From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753714AbbDKX47 (ORCPT ); Sat, 11 Apr 2015 19:56:59 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:38927 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751130AbbDKX45 (ORCPT ); Sat, 11 Apr 2015 19:56:57 -0400 Date: Sun, 12 Apr 2015 00:56:55 +0100 From: Al Viro To: Boqun Feng 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: <20150411235655.GK889@ZenIV.linux.org.uk> References: <1427309152-25129-1-git-send-email-boqun.feng@gmail.com> <20150329042744.GA1477@fixme-laptop> <20150407083826.GA1048@fixme-laptop.cn.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150407083826.GA1048@fixme-laptop.cn.ibm.com> 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 On Tue, Apr 07, 2015 at 04:38:26PM +0800, Boqun Feng wrote: > Ping again... What exactly does it buy us? You need a pathname just a bit under 4Kb, which, 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 get the loveliness like > > > + if (name->name != ((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. 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. So what's the point?