• Coly Li's avatar
    bcache: remove unnecessary prefetch() in bset_search_tree() · f960facb
    Coly Li authored
    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: default avatarColy Li <colyli@suse.de>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    f960facb
bset.c 33 KB