LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] x86_64: cleanup setup_node_zones called by paging_init
@ 2008-01-09 3:34 Yinghai Lu
2008-01-09 17:49 ` Christoph Lameter
0 siblings, 1 reply; 10+ messages in thread
From: Yinghai Lu @ 2008-01-09 3:34 UTC (permalink / raw)
To: Andrew Morton, Ingo Molnar, Thomas Gleixner, Christoph Lameter; +Cc: LKML
[PATCH] x86_64: cleanup setup_node_zones called by paging_init
setup_node_zones calcuates some variable but only use them when FLAT_NODE_MEM_MAP is set
so change the MACRO postion to avoid calculating.
also change it to static
Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>
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
@@ -227,15 +227,16 @@ void __init setup_node_bootmem(int nodei
srat_reserve_add_area(nodeid);
#endif
node_set_online(nodeid);
-}
+}
+#ifdef CONFIG_FLAT_NODE_MEM_MAP
/* Initialize final allocator for a zone */
-void __init setup_node_zones(int nodeid)
-{
+static void __init setup_node_zones(int nodeid)
+{
unsigned long start_pfn, end_pfn, memmapsize, limit;
- start_pfn = node_start_pfn(nodeid);
- end_pfn = node_end_pfn(nodeid);
+ start_pfn = node_start_pfn(nodeid);
+ end_pfn = node_end_pfn(nodeid);
Dprintk(KERN_INFO "Setting up memmap for node %d %lx-%lx\n",
nodeid, start_pfn, end_pfn);
@@ -244,14 +245,13 @@ void __init setup_node_zones(int nodeid)
memory. */
memmapsize = sizeof(struct page) * (end_pfn-start_pfn);
limit = end_pfn << PAGE_SHIFT;
-#ifdef CONFIG_FLAT_NODE_MEM_MAP
- NODE_DATA(nodeid)->node_mem_map =
- __alloc_bootmem_core(NODE_DATA(nodeid)->bdata,
- memmapsize, SMP_CACHE_BYTES,
- round_down(limit - memmapsize, PAGE_SIZE),
+ NODE_DATA(nodeid)->node_mem_map =
+ __alloc_bootmem_core(NODE_DATA(nodeid)->bdata,
+ memmapsize, SMP_CACHE_BYTES,
+ round_down(limit - memmapsize, PAGE_SIZE),
limit);
+}
#endif
-}
void __init numa_init_array(void)
{
@@ -570,9 +570,11 @@ void __init paging_init(void)
sparse_memory_present_with_active_regions(MAX_NUMNODES);
sparse_init();
+#ifdef CONFIG_FLAT_NODE_MEM_MAP
for_each_online_node(i) {
- setup_node_zones(i);
+ setup_node_zones(i);
}
+#endif
free_area_init_nodes(max_zone_pfns);
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] x86_64: cleanup setup_node_zones called by paging_init
2008-01-09 3:34 [PATCH] x86_64: cleanup setup_node_zones called by paging_init Yinghai Lu
@ 2008-01-09 17:49 ` Christoph Lameter
2008-01-09 18:30 ` [PATCH] x86_64: cleanup setup_node_zones called by paging_init v2 Yinghai Lu
0 siblings, 1 reply; 10+ messages in thread
From: Christoph Lameter @ 2008-01-09 17:49 UTC (permalink / raw)
To: Yinghai Lu; +Cc: Andrew Morton, Ingo Molnar, Thomas Gleixner, LKML
On Tue, 8 Jan 2008, Yinghai Lu wrote:
> [PATCH] x86_64: cleanup setup_node_zones called by paging_init
The whitespace cleanups make it difficult to review the patch. Could you
send those separately?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] x86_64: cleanup setup_node_zones called by paging_init v2
2008-01-09 17:49 ` Christoph Lameter
@ 2008-01-09 18:30 ` Yinghai Lu
2008-01-09 19:11 ` Dave Hansen
2008-01-09 19:19 ` Christoph Lameter
0 siblings, 2 replies; 10+ messages in thread
From: Yinghai Lu @ 2008-01-09 18:30 UTC (permalink / raw)
To: Christoph Lameter, Andrew Morton, Ingo Molnar, Thomas Gleixner; +Cc: LKML
[PATCH] x86_64: cleanup setup_node_zones called by paging_init v2
setup_node_zones calcuates some variable but only use them when FLAT_NODE_MEM_MAP is set
so change the MACRO postion to avoid calculating.
also change it to static
Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>
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
@@ -229,8 +229,9 @@ void __init setup_node_bootmem(int nodei
node_set_online(nodeid);
}
+#ifdef CONFIG_FLAT_NODE_MEM_MAP
/* Initialize final allocator for a zone */
-void __init setup_node_zones(int nodeid)
+static void __init setup_node_zones(int nodeid)
{
unsigned long start_pfn, end_pfn, memmapsize, limit;
@@ -244,14 +245,14 @@ void __init setup_node_zones(int nodeid)
memory. */
memmapsize = sizeof(struct page) * (end_pfn-start_pfn);
limit = end_pfn << PAGE_SHIFT;
-#ifdef CONFIG_FLAT_NODE_MEM_MAP
+
NODE_DATA(nodeid)->node_mem_map =
__alloc_bootmem_core(NODE_DATA(nodeid)->bdata,
memmapsize, SMP_CACHE_BYTES,
round_down(limit - memmapsize, PAGE_SIZE),
limit);
-#endif
}
+#endif
void __init numa_init_array(void)
{
@@ -570,9 +571,11 @@ void __init paging_init(void)
sparse_memory_present_with_active_regions(MAX_NUMNODES);
sparse_init();
+#ifdef CONFIG_FLAT_NODE_MEM_MAP
for_each_online_node(i) {
setup_node_zones(i);
}
+#endif
free_area_init_nodes(max_zone_pfns);
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] x86_64: cleanup setup_node_zones called by paging_init v2
2008-01-09 18:30 ` [PATCH] x86_64: cleanup setup_node_zones called by paging_init v2 Yinghai Lu
@ 2008-01-09 19:11 ` Dave Hansen
2008-01-09 19:19 ` Christoph Lameter
1 sibling, 0 replies; 10+ messages in thread
From: Dave Hansen @ 2008-01-09 19:11 UTC (permalink / raw)
To: Yinghai Lu
Cc: Christoph Lameter, Andrew Morton, Ingo Molnar, Thomas Gleixner, LKML
On Wed, 2008-01-09 at 10:30 -0800, Yinghai Lu wrote:
>
> [PATCH] x86_64: cleanup setup_node_zones called by paging_init v2
>
> setup_node_zones calcuates some variable but only use them when
> FLAT_NODE_MEM_MAP is set
>
> so change the MACRO postion to avoid calculating.
>
> also change it to static
I just see the patch adding a net of one #ifdef (and 3 lines of .c
file), and I don't consider that a cleanup. :(
If you make the function static, and make sure to cover that Dprintk up
with the #ifdef, I think the compiler should take care of the rest and
just throw away the function. Then, you won't need to add the second
#ifdef. You can even kill the brackets in that for loop.
Also, if you're going to be mucking around in there, can you give
setup_node_zones() a better name? It doesn't exactly setup any zones
any more. alloc_node_mem_map(), perhaps? The comment above it is
bogus, too.
-- Dave
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] x86_64: cleanup setup_node_zones called by paging_init v2
2008-01-09 18:30 ` [PATCH] x86_64: cleanup setup_node_zones called by paging_init v2 Yinghai Lu
2008-01-09 19:11 ` Dave Hansen
@ 2008-01-09 19:19 ` Christoph Lameter
2008-01-09 20:34 ` [PATCH] x86_64: cleanup setup_node_zones called by paging_init v3 Yinghai Lu
2008-01-12 11:26 ` [PATCH] x86_64: cleanup setup_node_zones called by paging_init v2 Yinghai Lu
1 sibling, 2 replies; 10+ messages in thread
From: Christoph Lameter @ 2008-01-09 19:19 UTC (permalink / raw)
To: Yinghai Lu; +Cc: Andrew Morton, Ingo Molnar, Thomas Gleixner, LKML
On Wed, 9 Jan 2008, Yinghai Lu wrote:
> +#ifdef CONFIG_FLAT_NODE_MEM_MAP
> /* Initialize final allocator for a zone */
> -void __init setup_node_zones(int nodeid)
> +static void __init setup_node_zones(int nodeid)
> {
> unsigned long start_pfn, end_pfn, memmapsize, limit;
>
> @@ -244,14 +245,14 @@ void __init setup_node_zones(int nodeid)
> memory. */
> memmapsize = sizeof(struct page) * (end_pfn-start_pfn);
> limit = end_pfn << PAGE_SHIFT;
> -#ifdef CONFIG_FLAT_NODE_MEM_MAP
> +
> NODE_DATA(nodeid)->node_mem_map =
> __alloc_bootmem_core(NODE_DATA(nodeid)->bdata,
> memmapsize, SMP_CACHE_BYTES,
> round_down(limit - memmapsize, PAGE_SIZE),
> limit);
> -#endif
> }
Here you could do an
#else
<empty def of setup_node_zones>
which would avoid the additional #ifdef later.
Also move the for_each statement into that function.
The current version will have an unused variable i if
CONFIG_FLAG_NODE_MEM_MAP is not set.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] x86_64: cleanup setup_node_zones called by paging_init v3
2008-01-09 19:19 ` Christoph Lameter
@ 2008-01-09 20:34 ` Yinghai Lu
2008-01-10 19:27 ` [PATCH] x86_64: cleanup setup_node_zones called by paging_init v4 Yinghai Lu
2008-01-12 11:26 ` [PATCH] x86_64: cleanup setup_node_zones called by paging_init v2 Yinghai Lu
1 sibling, 1 reply; 10+ messages in thread
From: Yinghai Lu @ 2008-01-09 20:34 UTC (permalink / raw)
To: Christoph Lameter, Andrew Morton, Ingo Molnar, Thomas Gleixner; +Cc: LKML
[PATCH] x86_64: cleanup setup_node_zones called by paging_init v3
setup_node_zones calcuates some variables but only use them when FLAT_NODE_MEM_MAP is set
so change the MACRO postion to avoid calculating.
also change it to static, rename it to flat_setup_node_zones
Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>
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
@@ -229,8 +229,9 @@ void __init setup_node_bootmem(int nodei
node_set_online(nodeid);
}
+#ifdef CONFIG_FLAT_NODE_MEM_MAP
/* Initialize final allocator for a zone */
-void __init setup_node_zones(int nodeid)
+static void __init flat_setup_node_zones(int nodeid)
{
unsigned long start_pfn, end_pfn, memmapsize, limit;
@@ -244,14 +245,16 @@ void __init setup_node_zones(int nodeid)
memory. */
memmapsize = sizeof(struct page) * (end_pfn-start_pfn);
limit = end_pfn << PAGE_SHIFT;
-#ifdef CONFIG_FLAT_NODE_MEM_MAP
+
NODE_DATA(nodeid)->node_mem_map =
__alloc_bootmem_core(NODE_DATA(nodeid)->bdata,
memmapsize, SMP_CACHE_BYTES,
round_down(limit - memmapsize, PAGE_SIZE),
limit);
+}
+#else
+#define flat_setup_node_zones(i) do {} while (0)
#endif
-}
void __init numa_init_array(void)
{
@@ -571,7 +574,7 @@ void __init paging_init(void)
sparse_init();
for_each_online_node(i) {
- setup_node_zones(i);
+ flat_setup_node_zones(i);
}
free_area_init_nodes(max_zone_pfns);
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] x86_64: cleanup setup_node_zones called by paging_init v4
2008-01-09 20:34 ` [PATCH] x86_64: cleanup setup_node_zones called by paging_init v3 Yinghai Lu
@ 2008-01-10 19:27 ` Yinghai Lu
0 siblings, 0 replies; 10+ messages in thread
From: Yinghai Lu @ 2008-01-10 19:27 UTC (permalink / raw)
To: Christoph Lameter, Andrew Morton, Ingo Molnar, Thomas Gleixner; +Cc: LKML
please check the one against to x86.git mm
[PATCH] x86_64: cleanup setup_node_zones called by paging_init v4
setup_node_zones calcuates some variables but only use them when FLAT_NODE_MEM_MAP is set
so change the MACRO postion to avoid calculating.
also change it to static, and rename it to flat_setup_node_zones
Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index 8482314..551e359 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -233,8 +233,9 @@ void __init setup_node_bootmem(int nodeid, unsigned long start,
node_set_online(nodeid);
}
+#ifdef CONFIG_FLAT_NODE_MEM_MAP
/* Initialize final allocator for a zone */
-void __init setup_node_zones(int nodeid)
+static void __init flat_setup_node_zones(int nodeid)
{
unsigned long start_pfn, end_pfn, memmapsize, limit;
@@ -250,14 +251,16 @@ void __init setup_node_zones(int nodeid)
*/
memmapsize = sizeof(struct page) * (end_pfn-start_pfn);
limit = end_pfn << PAGE_SHIFT;
-#ifdef CONFIG_FLAT_NODE_MEM_MAP
+
NODE_DATA(nodeid)->node_mem_map =
__alloc_bootmem_core(NODE_DATA(nodeid)->bdata,
memmapsize, SMP_CACHE_BYTES,
round_down(limit - memmapsize, PAGE_SIZE),
limit);
-#endif
}
+#else
+#define flat_setup_node_zones(i) do {} while (0)
+#endif
/*
* There are unfortunately some poorly designed mainboards around that
@@ -581,7 +584,7 @@ void __init paging_init(void)
sparse_init();
for_each_online_node(i)
- setup_node_zones(i);
+ flat_setup_node_zones(i);
free_area_init_nodes(max_zone_pfns);
}
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] x86_64: cleanup setup_node_zones called by paging_init v2
2008-01-09 19:19 ` Christoph Lameter
2008-01-09 20:34 ` [PATCH] x86_64: cleanup setup_node_zones called by paging_init v3 Yinghai Lu
@ 2008-01-12 11:26 ` Yinghai Lu
2008-01-14 19:48 ` Christoph Lameter
1 sibling, 1 reply; 10+ messages in thread
From: Yinghai Lu @ 2008-01-12 11:26 UTC (permalink / raw)
To: Christoph Lameter, Ingo Molnar; +Cc: Andrew Morton, Thomas Gleixner, LKML
On Wednesday 09 January 2008 11:19:01 am Christoph Lameter wrote:
> On Wed, 9 Jan 2008, Yinghai Lu wrote:
>
Christoph's
x86: 64-bit, make sparsemem vmemmap the only memory model
is in x86.git mm
so we could remove setup_node_zones because it is not needed by SPARSEMEM
please check the following patch.
YH
[PATCH] x86_84: only support sparsemem fix
sparsemem is only one supported, so could remove FLAT_NODE_MEM related code, that is
only needed !SPARSEMEM
Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index 8482314..4c286b7 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -233,32 +233,6 @@ void __init setup_node_bootmem(int nodeid, unsigned long start,
node_set_online(nodeid);
}
-/* Initialize final allocator for a zone */
-void __init setup_node_zones(int nodeid)
-{
- unsigned long start_pfn, end_pfn, memmapsize, limit;
-
- start_pfn = node_start_pfn(nodeid);
- end_pfn = node_end_pfn(nodeid);
-
- Dprintk(KERN_INFO "Setting up memmap for node %d %lx-%lx\n",
- nodeid, start_pfn, end_pfn);
-
- /*
- * Try to allocate mem_map at end to not fill up precious <4GB
- * memory.
- */
- memmapsize = sizeof(struct page) * (end_pfn-start_pfn);
- limit = end_pfn << PAGE_SHIFT;
-#ifdef CONFIG_FLAT_NODE_MEM_MAP
- NODE_DATA(nodeid)->node_mem_map =
- __alloc_bootmem_core(NODE_DATA(nodeid)->bdata,
- memmapsize, SMP_CACHE_BYTES,
- round_down(limit - memmapsize, PAGE_SIZE),
- limit);
-#endif
-}
-
/*
* There are unfortunately some poorly designed mainboards around that
* only connect memory to a single CPU. This breaks the 1:1 cpu->node
@@ -580,9 +554,6 @@ void __init paging_init(void)
sparse_memory_present_with_active_regions(MAX_NUMNODES);
sparse_init();
- for_each_online_node(i)
- setup_node_zones(i);
-
free_area_init_nodes(max_zone_pfns);
}
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] x86_64: cleanup setup_node_zones called by paging_init v2
2008-01-12 11:26 ` [PATCH] x86_64: cleanup setup_node_zones called by paging_init v2 Yinghai Lu
@ 2008-01-14 19:48 ` Christoph Lameter
2008-01-18 22:48 ` [PATCH] x86_64: only support sparsemem fix Yinghai Lu
0 siblings, 1 reply; 10+ messages in thread
From: Christoph Lameter @ 2008-01-14 19:48 UTC (permalink / raw)
To: Yinghai Lu; +Cc: Ingo Molnar, Andrew Morton, Thomas Gleixner, LKML
On Sat, 12 Jan 2008, Yinghai Lu wrote:
> please check the following patch.
Exactly!
Reviewed-by: Christoph Lameter <clameter@sgi.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] x86_64: only support sparsemem fix
2008-01-14 19:48 ` Christoph Lameter
@ 2008-01-18 22:48 ` Yinghai Lu
0 siblings, 0 replies; 10+ messages in thread
From: Yinghai Lu @ 2008-01-18 22:48 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Christoph Lameter, Andrew Morton, Thomas Gleixner, LKML
[PATCH] x86_64: only support sparsemem fix
sparsemem is only one supported, so could remove FLAT_NODE_MEM related, that is
only needed !SPARSEMEM
Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>
Reviewed-by: Christoph Lameter <clameter@sgi.com>
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -240,35 +240,6 @@ void __init setup_node_bootmem(int nodeid, unsigned long start,
node_set_online(nodeid);
}
-#ifdef CONFIG_FLAT_NODE_MEM_MAP
-/* Initialize final allocator for a zone */
-static void __init flat_setup_node_zones(int nodeid)
-{
- unsigned long start_pfn, end_pfn, memmapsize, limit;
-
- start_pfn = node_start_pfn(nodeid);
- end_pfn = node_end_pfn(nodeid);
-
- Dprintk(KERN_INFO "Setting up memmap for node %d %lx-%lx\n",
- nodeid, start_pfn, end_pfn);
-
- /*
- * Try to allocate mem_map at end to not fill up precious <4GB
- * memory.
- */
- memmapsize = sizeof(struct page) * (end_pfn-start_pfn);
- limit = end_pfn << PAGE_SHIFT;
-
- NODE_DATA(nodeid)->node_mem_map =
- __alloc_bootmem_core(NODE_DATA(nodeid)->bdata,
- memmapsize, SMP_CACHE_BYTES,
- round_down(limit - memmapsize, PAGE_SIZE),
- limit);
-}
-#else
-#define flat_setup_node_zones(i) do {} while (0)
-#endif
-
/*
* There are unfortunately some poorly designed mainboards around that
* only connect memory to a single CPU. This breaks the 1:1 cpu->node
@@ -600,9 +571,6 @@ void __init paging_init(void)
sparse_memory_present_with_active_regions(MAX_NUMNODES);
sparse_init();
- for_each_online_node(i)
- flat_setup_node_zones(i);
-
free_area_init_nodes(max_zone_pfns);
}
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-01-18 22:43 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-09 3:34 [PATCH] x86_64: cleanup setup_node_zones called by paging_init Yinghai Lu
2008-01-09 17:49 ` Christoph Lameter
2008-01-09 18:30 ` [PATCH] x86_64: cleanup setup_node_zones called by paging_init v2 Yinghai Lu
2008-01-09 19:11 ` Dave Hansen
2008-01-09 19:19 ` Christoph Lameter
2008-01-09 20:34 ` [PATCH] x86_64: cleanup setup_node_zones called by paging_init v3 Yinghai Lu
2008-01-10 19:27 ` [PATCH] x86_64: cleanup setup_node_zones called by paging_init v4 Yinghai Lu
2008-01-12 11:26 ` [PATCH] x86_64: cleanup setup_node_zones called by paging_init v2 Yinghai Lu
2008-01-14 19:48 ` Christoph Lameter
2008-01-18 22:48 ` [PATCH] x86_64: only support sparsemem fix Yinghai Lu
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).