bpf: Simplify code by using for_each_cpu_wrap()
authorPunit Agrawal <punit.agrawal@bytedance.com>
Wed, 7 Sep 2022 15:57:46 +0000 (16:57 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 10 Sep 2022 23:18:55 +0000 (16:18 -0700)
commit57c92f11a215717bf90880828b7a23c736c3c0d9
tree68fb30e8a2deb915d17dfd8e53fd364de500e5b8
parentcf7de6a53600ea554a8358e44fbcf47b449235f9
bpf: Simplify code by using for_each_cpu_wrap()

In the percpu freelist code, it is a common pattern to iterate over
the possible CPUs mask starting with the current CPU. The pattern is
implemented using a hand rolled while loop with the loop variable
increment being open-coded.

Simplify the code by using for_each_cpu_wrap() helper to iterate over
the possible cpus starting with the current CPU. As a result, some of
the special-casing in the loop also gets simplified.

No functional change intended.

Signed-off-by: Punit Agrawal <punit.agrawal@bytedance.com>
Acked-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20220907155746.1750329-1-punit.agrawal@bytedance.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/percpu_freelist.c