From: Tejun Heo <tj@kernel.org>
To: David Rientjes <rientjes@google.com>
Cc: Yinghai Lu <yinghai@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
"H. Peter Anvin" <hpa@zytor.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Cyrill Gorcunov <gorcunov@gmail.com>
Subject: [PATCH] x86-64, NUMA: Do not scan two times for setup_node_bootmem()
Date: Mon, 21 Feb 2011 11:20:40 +0100 [thread overview]
Message-ID: <20110221102040.GI31267@htj.dyndns.org> (raw)
In-Reply-To: <alpine.DEB.2.00.1102191942420.32280@chino.kir.corp.google.com>
>From 2d389b34c02cbc36c561a309735f69568aa9c3ea Mon Sep 17 00:00:00 2001
From: Yinghai Lu <yinghai@kernel.org>
Date: Mon, 21 Feb 2011 10:58:13 +0100
By the time setup_node_bootmem() is called, all the memblocks are
already registered. As node_data is allocated from these memblocks,
calling it more than once doesn't make any difference. Drop the loop.
tj: Rephrased description.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
---
Applied to x86-numa. I dropped the comment David pointed out and
redid the description. If you are unhappy with me redoing the
descriptions, please scream.
Thanks.
arch/x86/mm/numa_64.c | 32 ++++++++++++--------------------
1 files changed, 12 insertions(+), 20 deletions(-)
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index f6d85e3..6e4ee96 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -480,7 +480,7 @@ static bool __init numa_meminfo_cover_memory(const struct numa_meminfo *mi)
static int __init numa_register_memblks(struct numa_meminfo *mi)
{
- int i, j, nid;
+ int i, nid;
/* Account for nodes with cpus and no memory */
node_possible_map = numa_nodes_parsed;
@@ -506,28 +506,20 @@ static int __init numa_register_memblks(struct numa_meminfo *mi)
init_memory_mapping_high();
- /*
- * Finally register nodes. Do it twice in case setup_node_bootmem
- * missed one due to missing bootmem.
- */
- for (i = 0; i < 2; i++) {
- for_each_node_mask(nid, node_possible_map) {
- u64 start = (u64)max_pfn << PAGE_SHIFT;
- u64 end = 0;
+ /* Finally register nodes. */
+ for_each_node_mask(nid, node_possible_map) {
+ u64 start = (u64)max_pfn << PAGE_SHIFT;
+ u64 end = 0;
- if (node_online(nid))
+ for (i = 0; i < mi->nr_blks; i++) {
+ if (nid != mi->blk[i].nid)
continue;
-
- for (j = 0; j < mi->nr_blks; j++) {
- if (nid != mi->blk[j].nid)
- continue;
- start = min(mi->blk[j].start, start);
- end = max(mi->blk[j].end, end);
- }
-
- if (start < end)
- setup_node_bootmem(nid, start, end);
+ start = min(mi->blk[i].start, start);
+ end = max(mi->blk[i].end, end);
}
+
+ if (start < end)
+ setup_node_bootmem(nid, start, end);
}
return 0;
--
1.7.1
next prev parent reply other threads:[~2011-02-21 10:20 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4D5EC05A.60103@kernel.org>
2011-02-18 18:59 ` [PATCH 1/4] x86, numa: " Yinghai Lu
2011-02-20 4:03 ` David Rientjes
2011-02-21 10:20 ` Tejun Heo [this message]
2011-02-18 18:59 ` [PATCH 2/4] x86, numa: Do not adjust start/end for early_node_mem() Yinghai Lu
2011-02-20 4:03 ` David Rientjes
2011-02-20 4:17 ` Yinghai Lu
2011-02-21 9:43 ` Tejun Heo
2011-02-21 10:44 ` Tejun Heo
2011-02-21 20:28 ` Yinghai Lu
2011-02-22 10:36 ` Tejun Heo
2011-02-22 10:39 ` Tejun Heo
2011-02-21 17:21 ` Yinghai Lu
2011-02-22 0:27 ` David Rientjes
2011-02-18 18:59 ` [PATCH 3/4] x86, numa: cleanup x86_acpi_numa_init() Yinghai Lu
2011-02-20 4:03 ` David Rientjes
2011-02-21 9:46 ` Tejun Heo
2011-02-18 18:59 ` [PATCH 4/4] x86, numa: seperate alloc_numa_distance from numa_reset_distance Yinghai Lu
2011-02-20 4:03 ` David Rientjes
2011-02-21 10:48 ` Tejun Heo
2011-02-21 17:36 ` Yinghai Lu
2011-02-22 10:23 ` [PATCH] x86-64, NUMA: Seperate out numa_alloc_distance() from numa_set_distance() Tejun Heo
2011-02-22 10:30 ` Ingo Molnar
2011-02-22 10:32 ` Tejun Heo
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=20110221102040.GI31267@htj.dyndns.org \
--to=tj@kernel.org \
--cc=gorcunov@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rientjes@google.com \
--cc=tglx@linutronix.de \
--cc=yinghai@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
all inboxes | Powered by JetHome®