Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 904a9553 authored by Wei Yang's avatar Wei Yang Committed by Linus Torvalds
Browse files

mm/page_alloc.c: refine the calculation of highest possible node id



nr_node_ids records the highest possible node id, which is calculated by
scanning the bitmap node_states[N_POSSIBLE].  Current implementation
scan the bitmap from the beginning, which will scan the whole bitmap.

This patch reverses the order by scanning from the end with
find_last_bit().

Signed-off-by: default avatarWei Yang <weiyang@linux.vnet.ibm.com>
Cc: Tejun Heo <tj@kernel.org>
Acked-by: default avatarDavid Rientjes <rientjes@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 52a2b53f
Loading
Loading
Loading
Loading
+2 −4
Original line number Original line Diff line number Diff line
@@ -5478,11 +5478,9 @@ void __paginginit free_area_init_node(int nid, unsigned long *zones_size,
 */
 */
void __init setup_nr_node_ids(void)
void __init setup_nr_node_ids(void)
{
{
	unsigned int node;
	unsigned int highest;
	unsigned int highest = 0;


	for_each_node_mask(node, node_possible_map)
	highest = find_last_bit(node_possible_map.bits, MAX_NUMNODES);
		highest = node;
	nr_node_ids = highest + 1;
	nr_node_ids = highest + 1;
}
}
#endif
#endif