On Mon, Oct 21, 2024 at 02:47:59PM +0200, Christian Brauner wrote: > On Fri, Oct 18, 2024 at 08:38:22PM +0100, Al Viro wrote: > > On Fri, Oct 18, 2024 at 05:51:58PM +0100, Al Viro wrote: > > > > > Extra cycles where? If anything, I'd expect a too-small-to-measure > > > speedup due to dereference shifted from path_init() to __set_nameidata(). > > > Below is literally all it takes to make filename_lookup() treat NULL > > > as empty-string name. > > > > > > NOTE: I'm not talking about forcing the pure by-descriptor case through > > > the dfd+pathname codepath; not without serious profiling. But treating > > > AT_FDCWD + NULL by the delta below and passing NULL struct filename to > > > filename_lookup()? Where do you expect to have the lost cycles on that? > > > > [snip] > > > > BTW, could you give me a reference to the mail with those objections? > > I don't see anything in my mailbox, but... > > I had to search for quite a bit myself: > > https://lore.kernel.org/r/CAHk-=wifPKRG2w4mw+YchNtAuk4mMJBde7bG-Z7wt0+ZeQMJ_A@xxxxxxxxxxxxxx Re get_user() - there's one architecture where this fetch is a clear loss. Take a look at what um is doing; it's a full page table walk, then (single-byte) memcpy(). With no caching of page table walk results, so strncpy_from_user() in case the sucker is _not_ empty will have to start from scratch (and it's _not_ generic strncpy_from_user() there, for the same reasons). BTW, I wonder if we could speed the things up on um by caching the last page table walk result - and treating that as a TLB. Might make back-to-back get_user()/put_user() seriously cheaper there - unsafe_get_user() could grow a fastpath, possibly making generic strncpy_from_user() cheap enough to be used. If that is feasible, the only non-generic variant would remain on mips, and that's a lot less convincing case than um. Possibly strnlen_user(), as well - that one has a variant on xtensa, but that's also not an obvious win compared to generic... That's a separate story, anyway.