linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yang <weiyang@linux.vnet.ibm.com>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, Wei Yang <weiyang@linux.vnet.ibm.com>,
	Tejun Heo <tj@kernel.org>
Subject: [PATCH V2] mm/page: refine the calculation of highest possible node id
Date: Sat, 11 Jul 2015 11:08:16 +0800	[thread overview]
Message-ID: <1436584096-7016-1-git-send-email-weiyang@linux.vnet.ibm.com> (raw)
In-Reply-To: <20150710003555.4398c8ad.akpm@linux-foundation.org>

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 reverse the order by scanning from the end with find_last_bit().

Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Tejun Heo <tj@kernel.org>

---
v2:
   Just call find_last_bit() on node_possible_map.
---
 mm/page_alloc.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 59248f4..f8d0a98 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5450,10 +5450,9 @@ void __paginginit free_area_init_node(int nid, unsigned long *zones_size,
 void __init setup_nr_node_ids(void)
 {
 	unsigned int node;
-	unsigned int highest = 0;
+	unsigned int highest;
 
-	for_each_node_mask(node, node_possible_map)
-		highest = node;
+	highest = find_last_bit(node_possible_map.bits, MAX_NUMNODES);
 	nr_node_ids = highest + 1;
 }
 #endif
-- 
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2015-07-11  3:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-10  6:26 [PATCH] mm/page: refine the calculation of highest possible node id Wei Yang
2015-07-10  7:35 ` Andrew Morton
2015-07-10  8:27   ` Wei Yang
2015-07-11  3:08   ` Wei Yang [this message]
2015-07-11  4:17     ` [PATCH V3] " Wei Yang
2015-07-16  0:16       ` David Rientjes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1436584096-7016-1-git-send-email-weiyang@linux.vnet.ibm.com \
    --to=weiyang@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).