mm/page_alloc: call set_pageblock_order() once for each node
Subsystems (2)
PATCH 1/1 mm/page_alloc: call set_pageblock_order() once for each node
set_pageblock_order() is a standalone function which sets pageblock_order, while current implementation calls this function on each ZONE of each node in free_area_init_core().
Since free_area_init_node() is the only user of free_area_init_core(), this patch moves set_pageblock_order() up one level to invoke set_pageblock_order() only once on each node.
--- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/page_alloc.c +1 -1
@@ -6169,7 +6169,6 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat)if (!size)continue ; -set_pageblock_order ();setup_usemap (pgdat, zone, zone_start_pfn, size);init_currently_empty_zone (zone, zone_start_pfn, size);memmap_init (size, nid, j, zone_start_pfn);
@@ -6254,6 +6253,7 @@ void __paginginit free_area_init_node(int nid, unsigned long *zones_size,alloc_node_mem_map (pgdat);reset_deferred_meminit (pgdat); +set_pageblock_order ();free_area_init_core (pgdat); }
Signature · 1 line
2.15.1
Quoted 9 lines · Wei Yang
set_pageblock_order()is a standalone function which setspageblock_order, while current implementation calls this function on each ZONE of each node infree_area_init_core().Since
free_area_init_node()is the only user offree_area_init_core(), this patch movesset_pageblock_order()up one level to invokeset_pageblock_order()only once on each node.Signed-off-by Wei Yang <[email protected]>
The patch looks ok but given that set_pageblock_order returns immediately if it has already been called, I expect the benefit is marginal. Was any improvement in boot time measured?
Signature · 2 lines
Mel Gorman SUSE Labs
Quoted 9 lines · Mel Gorman
Quoted 8 lines · Wei Yang
set_pageblock_order()is a standalone function which setspageblock_order, while current implementation calls this function on each ZONE of each node infree_area_init_core().Since
free_area_init_node()is the only user offree_area_init_core(), this patch movesset_pageblock_order()up one level to invokeset_pageblock_order()only once on each node.
Quoted 5 lines
Quoted 1 line
Signed-off-by Wei Yang <[email protected]>The patch looks ok but given that
set_pageblock_orderreturns immediately if it has already been called, I expect the benefit is marginal. Was any improvement in boot time measured?
No, I don't expect measurable improvement from this since the number of nodes and zones are limited.
This is just a code refine from logic point of view.
Quoted 4 lines
Signature · 3 lines
-- Mel Gorman SUSE Labs
Signature · 2 lines
Wei Yang Help you, Help me
Michal Hocko
reviewerQuoted 12 lines · Wei Yang
Quoted 11 lines · Mel Gorman
Quoted 9 lines · Wei Yang
set_pageblock_order()is a standalone function which setspageblock_order, while current implementation calls this function on each ZONE of each node infree_area_init_core().Since
free_area_init_node()is the only user offree_area_init_core(), this patch movesset_pageblock_order()up one level to invokeset_pageblock_order()only once on each node.Signed-off-by Wei Yang <[email protected]>
Quoted 8 lines
Quoted 3 lines
The patch looks ok but given that
set_pageblock_orderreturns immediately if it has already been called, I expect the benefit is marginal. Was any improvement in boot time measured?No, I don't expect measurable improvement from this since the number of nodes and zones are limited.
This is just a code refine from logic point of view.
Then, please make sure it is a real refinement. Calling this function per node is only half way to get there as the function is by no means per node.
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 17 lines · Michal Hocko
Quoted 16 lines · Wei Yang
Quoted 14 lines · Mel Gorman
Quoted 9 lines · Wei Yang
set_pageblock_order()is a standalone function which setspageblock_order, while current implementation calls this function on each ZONE of each node infree_area_init_core().Since
free_area_init_node()is the only user offree_area_init_core(), this patch movesset_pageblock_order()up one level to invokeset_pageblock_order()only once on each node.Signed-off-by Wei Yang <[email protected]>The patch looks ok but given that
set_pageblock_orderreturns immediately if it has already been called, I expect the benefit is marginal. Was any improvement in boot time measured?
Quoted 9 lines
Quoted 4 lines
No, I don't expect measurable improvement from this since the number of nodes and zones are limited.
This is just a code refine from logic point of view.
Then, please make sure it is a real refinement. Calling this function per node is only half way to get there as the function is by no means per node.
Hi, Michal
I guess you are willing to see this function is only called once for the whole system.
Yes, that is the ideal way, well I don't come up with an elegant way. The best way is to move this to free_area_init_nodes(), while you can see not all arch use this function.
Then I have two options:
A: Move this to free_area_init_nodes() for those arch using it. Call it specifically for those arch not using free_area_init_nodes().
B: call it before setup_arch() in start_kernel()
Hmm... which one you would prefer? If you have a better idea, that would be great.
Quoted 3 lines
Signature · 2 lines
Michal Hocko SUSE Labs
Signature · 2 lines
Wei Yang Help you, Help me
Michal Hocko
reviewerQuoted 39 lines · Wei Yang
Quoted 17 lines · Michal Hocko
Quoted 16 lines · Wei Yang
Quoted 14 lines · Mel Gorman
Quoted 9 lines · Wei Yang
set_pageblock_order()is a standalone function which setspageblock_order, while current implementation calls this function on each ZONE of each node infree_area_init_core().Since
free_area_init_node()is the only user offree_area_init_core(), this patch movesset_pageblock_order()up one level to invokeset_pageblock_order()only once on each node.Signed-off-by Wei Yang <[email protected]>The patch looks ok but given that
set_pageblock_orderreturns immediately if it has already been called, I expect the benefit is marginal. Was any improvement in boot time measured?Quoted 9 lines
Quoted 4 lines
No, I don't expect measurable improvement from this since the number of nodes and zones are limited.
This is just a code refine from logic point of view.
Then, please make sure it is a real refinement. Calling this function per node is only half way to get there as the function is by no means per node.
Hi, Michal
I guess you are willing to see this function is only called once for the whole system.
Yes, that is the ideal way, well I don't come up with an elegant way. The best way is to move this to
free_area_init_nodes(), while you can see not all arch use this function.Then I have two options:
Quoted 7 lines
A: Move this to
free_area_init_nodes()for those arch using it. Call it specifically for those arch not usingfree_area_init_nodes().B: call it before
setup_arch()instart_kernel()Hmm... which one you would prefer? If you have a better idea, that would be great.
or
C: do nothing and/or just document why do we call it this way (convenience).
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 43 lines · Michal Hocko
Quoted 42 lines · Wei Yang
Quoted 17 lines · Michal Hocko
Quoted 16 lines · Wei Yang
Quoted 14 lines · Mel Gorman
Quoted 9 lines · Wei Yang
set_pageblock_order()is a standalone function which setspageblock_order, while current implementation calls this function on each ZONE of each node infree_area_init_core().Since
free_area_init_node()is the only user offree_area_init_core(), this patch movesset_pageblock_order()up one level to invokeset_pageblock_order()only once on each node.Signed-off-by Wei Yang <[email protected]>The patch looks ok but given that
set_pageblock_orderreturns immediately if it has already been called, I expect the benefit is marginal. Was any improvement in boot time measured?Quoted 9 lines
Quoted 4 lines
No, I don't expect measurable improvement from this since the number of nodes and zones are limited.
This is just a code refine from logic point of view.
Then, please make sure it is a real refinement. Calling this function per node is only half way to get there as the function is by no means per node.
Hi, Michal
I guess you are willing to see this function is only called once for the whole system.
Yes, that is the ideal way, well I don't come up with an elegant way. The best way is to move this to
free_area_init_nodes(), while you can see not all arch use this function.Then I have two options:
A: Move this to
free_area_init_nodes()for those arch using it. Call it specifically for those arch not usingfree_area_init_nodes().
Quoted 8 lines
Quoted 4 lines
B: call it before
setup_arch()instart_kernel()Hmm... which one you would prefer? If you have a better idea, that would be great.
or
C: do nothing and/or just document why do we call it this way (convenience).
Ok, maybe we can leave it alone now.
Quoted 3 lines
Signature · 2 lines
Michal Hocko SUSE Labs
Signature · 2 lines
Wei Yang Help you, Help me