]> git.baikalelectronics.ru Git - kernel.git/commit
lib/find_bit: add find_next{,_and}_bit_wrap
authorYury Norov <yury.norov@gmail.com>
Mon, 19 Sep 2022 21:05:56 +0000 (14:05 -0700)
committerYury Norov <yury.norov@gmail.com>
Sat, 1 Oct 2022 17:22:57 +0000 (10:22 -0700)
commit605beefa46e8bd48002972ebfde4c58c3818fc12
treeec87f04dbf7cdcb81c4094fa9ad5b9943ecd8de2
parentbf383b09817fe65429a16f71e679b6daa71d0c14
lib/find_bit: add find_next{,_and}_bit_wrap

The helper is better optimized for the worst case: in case of empty
cpumask, current code traverses 2 * size:

  next = cpumask_next_and(prev, src1p, src2p);
  if (next >= nr_cpu_ids)
   next = cpumask_first_and(src1p, src2p);

At bitmap level we can stop earlier after checking 'size + offset' bits.

Signed-off-by: Yury Norov <yury.norov@gmail.com>
include/linux/find.h
lib/cpumask.c