Skip to content

Commit dcf23cc

Browse files
committed
arch/x86: replace nodes_weight with nodes_empty where appropriate
mm code calls nodes_weight() to check if any bit of a given nodemask is set. We can do it 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 <[email protected]>
1 parent b55032f commit dcf23cc

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

arch/x86/mm/amdtopology.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ int __init amd_numa_init(void)
154154
node_set(nodeid, numa_nodes_parsed);
155155
}
156156

157-
if (!nodes_weight(numa_nodes_parsed))
157+
if (nodes_empty(numa_nodes_parsed))
158158
return -ENOENT;
159159

160160
/*

arch/x86/mm/numa_emulation.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ static int __init split_nodes_interleave(struct numa_meminfo *ei,
123123
* Continue to fill physical nodes with fake nodes until there is no
124124
* memory left on any of them.
125125
*/
126-
while (nodes_weight(physnode_mask)) {
126+
while (!nodes_empty(physnode_mask)) {
127127
for_each_node_mask(i, physnode_mask) {
128128
u64 dma32_end = PFN_PHYS(MAX_DMA32_PFN);
129129
u64 start, limit, end;
@@ -270,7 +270,7 @@ static int __init split_nodes_size_interleave_uniform(struct numa_meminfo *ei,
270270
* Fill physical nodes with fake nodes of size until there is no memory
271271
* left on any of them.
272272
*/
273-
while (nodes_weight(physnode_mask)) {
273+
while (!nodes_empty(physnode_mask)) {
274274
for_each_node_mask(i, physnode_mask) {
275275
u64 dma32_end = PFN_PHYS(MAX_DMA32_PFN);
276276
u64 start, limit, end;

0 commit comments

Comments
 (0)