[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4D6EEDF2.6090201@kernel.org>
Date: Wed, 02 Mar 2011 17:25:06 -0800
From: Yinghai Lu <yinghai@...nel.org>
To: Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...e.hu>,
"H. Peter Anvin" <hpa@...or.com>, Tejun Heo <tj@...nel.org>,
David Rientjes <rientjes@...gle.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH 1/2] x86, numa, emu: move size calculation into if block
don't need to assign them that early.
Signed-off-by: Yinghai Lu <yinghai@...nel.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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists