summaryrefslogtreecommitdiff
path: root/arch/x86/mm/numa_emulation.c
diff options
context:
space:
mode:
authorYury Norov <yury.norov@gmail.com>2022-02-10 14:49:09 -0800
committerThomas Gleixner <tglx@linutronix.de>2022-04-10 22:35:38 +0200
commitc2a911d302b0d014a4d0d732a2bfc319e643eb62 (patch)
tree0f64c293a81e4637a1ddaec7f8456d45090339fb /arch/x86/mm/numa_emulation.c
parent3a5ff1f6dd50f5e1c2aa87491910dd6d275af24b (diff)
x86/mm: Replace nodes_weight() with nodes_empty() where appropriate
Various mm code calls nodes_weight() to check if any bit of a given nodemask is set. This can be done more efficiently with nodes_empty() because nodes_empty() stops traversing the nodemask as soon as it finds first set bit, while nodes_weight() counts all bits unconditionally. Signed-off-by: Yury Norov <yury.norov@gmail.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20220210224933.379149-26-yury.norov@gmail.com
Diffstat (limited to 'arch/x86/mm/numa_emulation.c')
-rw-r--r--arch/x86/mm/numa_emulation.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c
index 1a02b791d273..9a9305367fdd 100644
--- a/arch/x86/mm/numa_emulation.c
+++ b/arch/x86/mm/numa_emulation.c
@@ -123,7 +123,7 @@ static int __init split_nodes_interleave(struct numa_meminfo *ei,
* Continue to fill physical nodes with fake nodes until there is no
* memory left on any of them.
*/
- while (nodes_weight(physnode_mask)) {
+ while (!nodes_empty(physnode_mask)) {
for_each_node_mask(i, physnode_mask) {
u64 dma32_end = PFN_PHYS(MAX_DMA32_PFN);
u64 start, limit, end;
@@ -270,7 +270,7 @@ static int __init split_nodes_size_interleave_uniform(struct numa_meminfo *ei,
* Fill physical nodes with fake nodes of size until there is no memory
* left on any of them.
*/
- while (nodes_weight(physnode_mask)) {
+ while (!nodes_empty(physnode_mask)) {
for_each_node_mask(i, physnode_mask) {
u64 dma32_end = PFN_PHYS(MAX_DMA32_PFN);
u64 start, limit, end;