OSDN Git Service

block: optimise bvec_iter_advance()
authorPavel Begunkov <asml.silence@gmail.com>
Sat, 30 Nov 2019 20:23:52 +0000 (23:23 +0300)
committerJens Axboe <axboe@kernel.dk>
Tue, 3 Dec 2019 14:36:38 +0000 (07:36 -0700)
commit795ee49c1a28d1b3eeb2b463f18d557700fc6153
tree37a0074d7559534cd68eb5d58883f5ab27f3bf7d
parent8cdda87a4414092cd210e766189cf0353a844861
block: optimise bvec_iter_advance()

bvec_iter_advance() is quite popular, but compilers fail to do proper
alias analysis and optimise it good enough. The assembly is checked
for gcc 9.2, x86-64.

- remove @iter->bi_size from min(...), as it's always less than @bytes.
Modify at the beginning and forget about it.

- the compiler isn't able to collapse memory dependencies and remove
writes in the loop. Help it by explicitely using local vars.

Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/bvec.h