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... > > 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? 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
Attachment:
pgp97ldR4kYsz.pgp
Description: PGP signature