iov_iter: streamline iovec/bvec alignment iteration
authorJens Axboe <axboe@kernel.dk>
Wed, 24 Jan 2024 15:23:48 +0000 (08:23 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 24 Jan 2024 15:27:43 +0000 (08:27 -0700)
commit01548ab553e69615b2d7f9e247524af7c2df984f
tree4f345e95d43a05df223ae0e468646fe22352cc80
parent615d300648869c774bd1fe54b4627bb0c20faed4
iov_iter: streamline iovec/bvec alignment iteration

Rewrite the alignment checking iterators for iovec and bvec to be easier
to read, and also significantly more compact in terms of generated code.
This saves 176 bytes of text on x86-64 for me (with clang-18) and 126
bytes on arm64 (with gcc-13).

In profiles, also saves a bit of time as well for the same workload:

     0.81%     -0.18%  [kernel.vmlinux]  [k] iov_iter_aligned_bvec
     0.48%     -0.09%  [kernel.vmlinux]  [k] iov_iter_is_aligned

which is a nice side benefit as well.

Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
lib/iov_iter.c