On Tue, Mar 28, 2023 at 11:42 AM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote: > > Umm... Why not set ->nr_segs to 1 in iov_iter_ubuf() instead? Note that > it won't be more costly; that part of struct iov_iter (8 bytes at offset 40 > on amd64) is *not* left uninitialized - zero gets stored there. That way > you'll get constant 1 stored there, which is just as cheap... Ack. And with my suggestion to embed a 'struct iov' in the 'struct iov_iter' for the ITER_UBUF case (see previous email, try not to barf), we really end up with a pretty cheap "ITER_UBUF can be used almost as-is for any ITER_IOV case". Linus