From: Yinghai Lu <yinghai@kernel.org>
To: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
"H. Peter Anvin" <hpa@zytor.com>, Tejun Heo <tj@kernel.org>,
David Rientjes <rientjes@google.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/2] x86, numa, emu: move size calculation into if block
Date: Wed, 02 Mar 2011 17:25:06 -0800 [thread overview]
Message-ID: <4D6EEDF2.6090201@kernel.org> (raw)
don't need to assign them that early.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/mm/numa_64.c | 11 +++++------
arch/x86/mm/numa_emulation.c | 3 ++-
2 files changed, 7 insertions(+), 7 deletions(-)
Index: linux-2.6/arch/x86/mm/numa_64.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/numa_64.c
+++ linux-2.6/arch/x86/mm/numa_64.c
@@ -390,13 +390,12 @@ static void __init numa_nodemask_from_me
*/
void __init numa_reset_distance(void)
{
- size_t size = numa_distance_cnt * numa_distance_cnt * sizeof(numa_distance[0]);
-
/* numa_distance could be 1LU marking allocation failure, test cnt */
- if (numa_distance_cnt)
- memblock_x86_free_range(__pa(numa_distance),
- __pa(numa_distance) + size);
- numa_distance_cnt = 0;
+ if (numa_distance_cnt) {
+ size_t size = numa_distance_cnt * numa_distance_cnt * sizeof(numa_distance[0]);
+ memblock_x86_free_range(__pa(numa_distance), __pa(numa_distance) + size);
+ numa_distance_cnt = 0;
+ }
numa_distance = NULL; /* enable table creation */
}
Index: linux-2.6/arch/x86/mm/numa_emulation.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/numa_emulation.c
+++ linux-2.6/arch/x86/mm/numa_emulation.c
@@ -300,7 +300,7 @@ void __init numa_emulation(struct numa_m
static struct numa_meminfo pi __initdata;
const u64 max_addr = max_pfn << PAGE_SHIFT;
u8 *phys_dist = NULL;
- size_t phys_size = numa_dist_cnt * numa_dist_cnt * sizeof(phys_dist[0]);
+ size_t phys_size = 0;
int i, j, ret;
if (!emu_cmdline)
@@ -341,6 +341,7 @@ void __init numa_emulation(struct numa_m
if (numa_dist_cnt) {
u64 phys;
+ phys_size = numa_dist_cnt * numa_dist_cnt * sizeof(phys_dist[0]);
phys = memblock_find_in_range(0,
(u64)max_pfn_mapped << PAGE_SHIFT,
phys_size, PAGE_SIZE);
next reply other threads:[~2011-03-03 1:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-03 1:25 Yinghai Lu [this message]
2011-03-03 1:28 ` [PATCH 2/2] x86, numa, emu: only transform numa_distance if SLIT is there Yinghai Lu
2011-03-03 6:22 ` Tejun Heo
2011-03-10 8:55 ` Ingo Molnar
2011-03-03 6:21 ` [PATCH 1/2] x86, numa, emu: move size calculation into if block 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=4D6EEDF2.6090201@kernel.org \
--to=yinghai@kernel.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rientjes@google.com \
--cc=tglx@linutronix.de \
--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