David Laight <David.Laight@xxxxxxxxxx> wrote: > It is harder to compare because of some of the random name changes. I wouldn't say 'random' exactly, but if you prefer, some of the name changing can be split out into a separate patch. The macros are kind of the worst since they picked up variable names from the callers. > The version of the source I found seems to pass priv2 to functions > that don't use it? That can't be avoided if I convert everything to inline functions and function pointers - but the optimiser can get rid of it where it can inline the step function. I tried passing the iterator to the step functions instead, but that just made things bigger. memcpy_from_iter_mc() is interesting to deal with. I would prefer to deal with it in the caller so we only do the check once, but that might mean duplicating the caller. Actually, ->copy_mc is only set in once place, dump_emit_page() in coredump.c, and only on a bvec iterator, so I could probably do a special function just for that that calls iterate_bvec() rather than iterate_and_advance2() and then make _copy_from_iter() just use memcpy_from_iter() and get rid of iov_iter::copy_mc entirely. > Since the functions aren't inlined you get the cost of passing > the parameters. > This seems to affect the common cases. Actually, in v2, the action functions for common cases are marked __always_inline and do get fully inlined and the code in some paths actually ends up slightly smaller. > Is that all left over from a version that passed function pointers > (with the hope they'd be inlined?). > Just directly inlining the simple copies should help. I did that in v2 for things like memcpy_to_iter() and memcpy_from_iter(). > I rather hope the should_fail_usercopy() and instrument_copy_xxx() > calls are usually either absent or, at most, nops. Okay - it's probably worth marking those too, then. > This all seems to have a lot fewer options than last time I looked. I'm not sure what you mean by 'a lot fewer options'? > Is it worth optimising the KVEC case with a single buffer? You mean an equivalent of UBUF? Maybe. There are probably a whole bunch of netfs places that do single-kvec writes, though I'm trying to convert these over to bvec arrays, combining them with their data, and MSG_SPLICE_PAGES. David