Skip to contentSkip to conversation

x86: numa: mm: kill double initialization for NODE_DATA

PATCH In review Lin Feng 2 participants 6 messages Apr 2, 2013 – Apr 7, 2013

Subsystems (3)
lore
Share & tools
lore

Lin Feng

author
#0 lore raw

PATCH 1/1 x86: numa: mm: kill double initialization for NODE_DATA

We initialize node_id, node_start_pfn and node_spanned_pages for NODE_DATA in initmem_init() while the later two members are kept unused and will be recaculated soon in paging_init(), so remove the useless assignments.

PS. For clarifying calling chains are showed as follows:
setup_arch()
...
initmem_init()

    x86_numa_init()
      numa_init()
        numa_register_memblks()
          setup_node_data()
            NODE_DATA(nid)->node_id = nid;
            NODE_DATA(nid)->node_start_pfn = start >> PAGE_SHIFT;
            NODE_DATA(nid)->node_spanned_pages = (end - start) >> PAGE_SHIFT;
  ...
  x86_init.paging.pagetable_init()
  paging_init()
    ...
    sparse_init()
      sparse_early_usemaps_alloc_node()
        sparse_early_usemaps_alloc_pgdat_section()
          ___alloc_bootmem_node_nopanic()
            __alloc_memory_core_early(pgdat->node_id,...)
    ...
    zone_sizes_init()
      free_area_init_nodes()
        free_area_init_node()
          pgdat->node_id = nid;
          pgdat->node_start_pfn = node_start_pfn;
          calculate_node_totalpages();
            pgdat->node_spanned_pages = totalpages;
---
 arch/x86/mm/numa.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
arch/x86/mm/numa.c +0 -2
index 72fe01e..efdd08f 100644
@@ -230,8 +230,6 @@ static void __init setup_node_data(int nid, u64 start, u64 end)
 	node_data[nid] = nd;
 	memset(NODE_DATA(nid), 0, sizeof(pg_data_t));
 	NODE_DATA(nid)->node_id = nid;
-	NODE_DATA(nid)->node_start_pfn = start >> PAGE_SHIFT;
-	NODE_DATA(nid)->node_spanned_pages = (end - start) >> PAGE_SHIFT;
 
 	node_set_online(nid);
 }
Signature · 7 lines
1.7.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw
Quoted 24 lines · Lin Feng

We initialize node_id, node_start_pfn and node_spanned_pages for NODE_DATA in initmem_init() while the later two members are kept unused and will be recaculated soon in paging_init(), so remove the useless assignments.

PS. For clarifying calling chains are showed as follows:
setup_arch()
...
initmem_init()
x86_numa_init()

     numa_init()
       numa_register_memblks()
         setup_node_data()
           NODE_DATA(nid)->node_id = nid;
           NODE_DATA(nid)->node_start_pfn = start >> PAGE_SHIFT;
           NODE_DATA(nid)->node_spanned_pages = (end - start) >> PAGE_SHIFT;
 ...
 x86_init.paging.pagetable_init()
 paging_init()
   ...
   sparse_init()
     sparse_early_usemaps_alloc_node()
       sparse_early_usemaps_alloc_pgdat_section()
         ___alloc_bootmem_node_nopanic()
           __alloc_memory_core_early(pgdat->node_id,...)
Quoted 9 lines

...
zone_sizes_init()

     free_area_init_nodes()
       free_area_init_node()
         pgdat->node_id = nid;
         pgdat->node_start_pfn = node_start_pfn;
         calculate_node_totalpages();
           pgdat->node_spanned_pages = totalpages;

You miss the nodes which could become online at some point, but not online currently.

Regards,
Wanpeng Li

Quoted 27 lines

---
arch/x86/mm/numa.c | 2 --

1 files changed, 0 insertions(+), 2 deletions(-)
arch/x86/mm/numa.c +0 -2
index 72fe01e..efdd08f 100644
@@ -230,8 +230,6 @@ static void __init setup_node_data(int nid, u64 start, u64 end)
 	node_data[nid] = nd;
 	memset(NODE_DATA(nid), 0, sizeof(pg_data_t));
 	NODE_DATA(nid)->node_id = nid;
-	NODE_DATA(nid)->node_start_pfn = start >> PAGE_SHIFT;
-	NODE_DATA(nid)->node_spanned_pages = (end - start) >> PAGE_SHIFT;
 
 	node_set_online(nid);
 }
Signature · 7 lines
1.7.1

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

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

#5 lore raw
In reply to Lin Feng
Quoted 24 lines · Lin Feng

We initialize node_id, node_start_pfn and node_spanned_pages for NODE_DATA in initmem_init() while the later two members are kept unused and will be recaculated soon in paging_init(), so remove the useless assignments.

PS. For clarifying calling chains are showed as follows:
setup_arch()
...
initmem_init()
x86_numa_init()

     numa_init()
       numa_register_memblks()
         setup_node_data()
           NODE_DATA(nid)->node_id = nid;
           NODE_DATA(nid)->node_start_pfn = start >> PAGE_SHIFT;
           NODE_DATA(nid)->node_spanned_pages = (end - start) >> PAGE_SHIFT;
 ...
 x86_init.paging.pagetable_init()
 paging_init()
   ...
   sparse_init()
     sparse_early_usemaps_alloc_node()
       sparse_early_usemaps_alloc_pgdat_section()
         ___alloc_bootmem_node_nopanic()
           __alloc_memory_core_early(pgdat->node_id,...)
Quoted 9 lines

...
zone_sizes_init()

     free_area_init_nodes()
       free_area_init_node()
         pgdat->node_id = nid;
         pgdat->node_start_pfn = node_start_pfn;
         calculate_node_totalpages();
           pgdat->node_spanned_pages = totalpages;

You miss the nodes which could become online at some point, but not online currently.

Regards,
Wanpeng Li

Quoted 27 lines

---
arch/x86/mm/numa.c | 2 --

1 files changed, 0 insertions(+), 2 deletions(-)
arch/x86/mm/numa.c +0 -2
index 72fe01e..efdd08f 100644
@@ -230,8 +230,6 @@ static void __init setup_node_data(int nid, u64 start, u64 end)
 	node_data[nid] = nd;
 	memset(NODE_DATA(nid), 0, sizeof(pg_data_t));
 	NODE_DATA(nid)->node_id = nid;
-	NODE_DATA(nid)->node_start_pfn = start >> PAGE_SHIFT;
-	NODE_DATA(nid)->node_spanned_pages = (end - start) >> PAGE_SHIFT;
 
 	node_set_online(nid);
 }
Signature · 7 lines
1.7.1

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

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

author
#2 lore raw
In reply to Wanpeng Li

Hi Wanpeng,

Quoted 29 lines · Wanpeng Li
Quoted 21 lines
Quoted 21 lines

PS. For clarifying calling chains are showed as follows:
setup_arch()
...
initmem_init()
x86_numa_init()

     numa_init()
       numa_register_memblks()
         setup_node_data()
           NODE_DATA(nid)->node_id = nid;
           NODE_DATA(nid)->node_start_pfn = start >> PAGE_SHIFT;
           NODE_DATA(nid)->node_spanned_pages = (end - start) >> PAGE_SHIFT;
 ...
 x86_init.paging.pagetable_init()
 paging_init()
   ...
   sparse_init()
     sparse_early_usemaps_alloc_node()
       sparse_early_usemaps_alloc_pgdat_section()
         ___alloc_bootmem_node_nopanic()
           __alloc_memory_core_early(pgdat->node_id,...)

...

Quoted 8 lines
Quoted 8 lines
   zone_sizes_init()
     free_area_init_nodes()
       free_area_init_node()
         pgdat->node_id = nid;
         pgdat->node_start_pfn = node_start_pfn;
         calculate_node_totalpages();
           pgdat->node_spanned_pages = totalpages;
Quoted 2 lines

You miss the nodes which could become online at some point, but not online currently.

Sorry, I'm not quite understanding what you said.

I keep node_set_online(nid) there. In boot phase if a node is online now it wil be reinitialized later by zone_sizes_init() else if a node is hotpluged after system is up it will also be initialized by hotadd_new_pgdat() which falls into calling free_area_init_node().

Besides this I'm not sure there are any other dependency besides what you worry about, while I tested this on a x86_64 numa system with hot-add nodes and the meminfo statics looks right before and after hot-add memory.

thanks for your patient,
linfeng

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

#3 lore raw
Quoted 35 lines · Lin Feng

Hi Wanpeng,

Quoted 31 lines · Wanpeng Li
Quoted 21 lines
Quoted 21 lines

PS. For clarifying calling chains are showed as follows:
setup_arch()
...
initmem_init()
x86_numa_init()

     numa_init()
       numa_register_memblks()
         setup_node_data()
           NODE_DATA(nid)->node_id = nid;
           NODE_DATA(nid)->node_start_pfn = start >> PAGE_SHIFT;
           NODE_DATA(nid)->node_spanned_pages = (end - start) >> PAGE_SHIFT;
 ...
 x86_init.paging.pagetable_init()
 paging_init()
   ...
   sparse_init()
     sparse_early_usemaps_alloc_node()
       sparse_early_usemaps_alloc_pgdat_section()
         ___alloc_bootmem_node_nopanic()
           __alloc_memory_core_early(pgdat->node_id,...)

...

Quoted 8 lines
Quoted 8 lines
   zone_sizes_init()
     free_area_init_nodes()
       free_area_init_node()
         pgdat->node_id = nid;
         pgdat->node_start_pfn = node_start_pfn;
         calculate_node_totalpages();
           pgdat->node_spanned_pages = totalpages;

You miss the nodes which could become online at some point, but not online currently.

Hi Feng,

Quoted 6 lines

Sorry, I'm not quite understanding what you said.

I keep node_set_online(nid) there. In boot phase if a node is online now it wil be reinitialized later by zone_sizes_init() else if a node is hotpluged after system is up it will also be initialized by hotadd_new_pgdat() which falls into calling free_area_init_node().

I miss it.

Quoted 4 lines

Besides this I'm not sure there are any other dependency besides what you worry about, while I tested this on a x86_64 numa system with hot-add nodes and the meminfo statics looks right before and after hot-add memory.

Fair enough. ;-)

Regards,
Wanpeng Li

Quoted 3 lines

thanks for your patient,
linfeng

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

#4 lore raw
In reply to Lin Feng
Quoted 35 lines · Lin Feng

Hi Wanpeng,

Quoted 31 lines · Wanpeng Li
Quoted 21 lines
Quoted 21 lines

PS. For clarifying calling chains are showed as follows:
setup_arch()
...
initmem_init()
x86_numa_init()

     numa_init()
       numa_register_memblks()
         setup_node_data()
           NODE_DATA(nid)->node_id = nid;
           NODE_DATA(nid)->node_start_pfn = start >> PAGE_SHIFT;
           NODE_DATA(nid)->node_spanned_pages = (end - start) >> PAGE_SHIFT;
 ...
 x86_init.paging.pagetable_init()
 paging_init()
   ...
   sparse_init()
     sparse_early_usemaps_alloc_node()
       sparse_early_usemaps_alloc_pgdat_section()
         ___alloc_bootmem_node_nopanic()
           __alloc_memory_core_early(pgdat->node_id,...)

...

Quoted 8 lines
Quoted 8 lines
   zone_sizes_init()
     free_area_init_nodes()
       free_area_init_node()
         pgdat->node_id = nid;
         pgdat->node_start_pfn = node_start_pfn;
         calculate_node_totalpages();
           pgdat->node_spanned_pages = totalpages;

You miss the nodes which could become online at some point, but not online currently.

Hi Feng,

Quoted 6 lines

Sorry, I'm not quite understanding what you said.

I keep node_set_online(nid) there. In boot phase if a node is online now it wil be reinitialized later by zone_sizes_init() else if a node is hotpluged after system is up it will also be initialized by hotadd_new_pgdat() which falls into calling free_area_init_node().

I miss it.

Quoted 4 lines

Besides this I'm not sure there are any other dependency besides what you worry about, while I tested this on a x86_64 numa system with hot-add nodes and the meminfo statics looks right before and after hot-add memory.

Fair enough. ;-)

Regards,
Wanpeng Li

Quoted 3 lines

thanks for your patient,
linfeng

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