]> git.baikalelectronics.ru Git - kernel.git/commit
bcache: remove unnecessary prefetch() in bset_search_tree()
authorColy Li <colyli@suse.de>
Fri, 28 Jun 2019 11:59:31 +0000 (19:59 +0800)
committerJens Axboe <axboe@kernel.dk>
Fri, 28 Jun 2019 13:39:14 +0000 (07:39 -0600)
commitb692f56c916c04c5ac8ca62ca66f02a3c7848ebc
tree3ea70ddbfa4c7e767df4bbd7747074fb2016385a
parent20a9c02ef26c1362244e88e0730fd3d2b5c4250d
bcache: remove unnecessary prefetch() in bset_search_tree()

In function bset_search_tree(), when p >= t->size, t->tree[0] will be
prefetched by the following code piece,
 974                 unsigned int p = n << 4;
 975
 976                 p &= ((int) (p - t->size)) >> 31;
 977
 978                 prefetch(&t->tree[p]);

The purpose of the above code is to avoid a branch instruction, but
when p >= t->size, prefetch(&t->tree[0]) has no positive performance
contribution at all. This patch avoids the unncessary prefetch by only
calling prefetch() when p < t->size.

Signed-off-by: Coly Li <colyli@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/bcache/bset.c