Commit dcf23cca authored by Yury Norov's avatar Yury Norov

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: default avatarYury Norov <yury.norov@gmail.com>
parent b55032f1
...@@ -154,7 +154,7 @@ int __init amd_numa_init(void) ...@@ -154,7 +154,7 @@ int __init amd_numa_init(void)
node_set(nodeid, numa_nodes_parsed); node_set(nodeid, numa_nodes_parsed);
} }
if (!nodes_weight(numa_nodes_parsed)) if (nodes_empty(numa_nodes_parsed))
return -ENOENT; return -ENOENT;
/* /*
......
...@@ -123,7 +123,7 @@ static int __init split_nodes_interleave(struct numa_meminfo *ei, ...@@ -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 * Continue to fill physical nodes with fake nodes until there is no
* memory left on any of them. * memory left on any of them.
*/ */
while (nodes_weight(physnode_mask)) { while (!nodes_empty(physnode_mask)) {
for_each_node_mask(i, physnode_mask) { for_each_node_mask(i, physnode_mask) {
u64 dma32_end = PFN_PHYS(MAX_DMA32_PFN); u64 dma32_end = PFN_PHYS(MAX_DMA32_PFN);
u64 start, limit, end; u64 start, limit, end;
...@@ -270,7 +270,7 @@ static int __init split_nodes_size_interleave_uniform(struct numa_meminfo *ei, ...@@ -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 * Fill physical nodes with fake nodes of size until there is no memory
* left on any of them. * left on any of them.
*/ */
while (nodes_weight(physnode_mask)) { while (!nodes_empty(physnode_mask)) {
for_each_node_mask(i, physnode_mask) { for_each_node_mask(i, physnode_mask) {
u64 dma32_end = PFN_PHYS(MAX_DMA32_PFN); u64 dma32_end = PFN_PHYS(MAX_DMA32_PFN);
u64 start, limit, end; u64 start, limit, end;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment