percpu: reduce the number of cpu distance comparisons
authorWonhyuk Yang <vvghjk1234@gmail.com>
Fri, 30 Oct 2020 01:38:20 +0000 (10:38 +0900)
committerDennis Zhou <dennis@kernel.org>
Sun, 14 Feb 2021 17:34:05 +0000 (17:34 +0000)
commitd7d29ac76f7efb506bcecc092641e704f791d92d
tree00c6e82ebc6252d53c4d2236d27928417d14c323
parent92bf22614b21a2706f4993b278017e437f7785b3
percpu: reduce the number of cpu distance comparisons

To build group_map[] and group_cnt[], we find out which group
CPUs belong to by comparing the distance of the cpu. However,
this includes cases where comparisons are not required.

This patch uses a bitmap to record CPUs that is not classified in
the group. CPUs that we know which group they belong to should be
cleared from the bitmap. In result, we can reduce the number of
unnecessary comparisons.

Signed-off-by: Wonhyuk Yang <vvghjk1234@gmail.com>
Signed-off-by: Dennis Zhou <dennis@kernel.org>
[Dennis: added cpumask_clear() call and #include cpumask.h.]
mm/percpu.c