mm/memory_hotplug: just build zonelist for new added node
Subsystems (2)
PATCH 1/1 mm/memory_hotplug: just build zonelist for new added node
In commit (9adb62a5df9c0fbef7) "mm/hotplug: correctly setup fallback zonelists when creating new pgdat" tries to build the correct zonelist for a new added node, while it is not necessary to rebuild it for already exist nodes.
In build_zonelists(), it will iterate on nodes with memory. For a new added node, it will have memory until node_states_set_node() is called in online_pages().
This patch will avoid to rebuild the zonelists for already exist nodes.
--- mm/page_alloc.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
mm/page_alloc.c +9 -7
@@ -5200,15 +5200,17 @@ static int __build_all_zonelists(void *data)memset (node_load,0 ,sizeof (node_load));#endif -if (self && !node_online (self->node_id)) { +/* This node is hotadded and no memory preset yet. +* So just build zonelists is fine, no need to touch other nodes. +*/ +if (self && !node_online (self->node_id))build_zonelists (self); - } - -for_each_online_node (nid) { -pg_data_t *pgdat =NODE_DATA (nid); +else +for_each_online_node (nid) { +pg_data_t *pgdat =NODE_DATA (nid); -build_zonelists (pgdat); - } +build_zonelists (pgdat); + }/* * Initialize the boot_pagesets that are going to be used
Signature · 7 lines
2.11.0 -- 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>
Quoted 7 lines · Wei Yang
In commit (
9adb62a5df9c0fbef7) "mm/hotplug: correctly setup fallback zonelists when creating new pgdat" tries to build the correct zonelist for a new added node, while it is not necessary to rebuild it for already exist nodes.In
build_zonelists(), it will iterate on nodes with memory. For a new added node, it will have memory untilnode_states_set_node()is called in
it will not have memory
right?
Quoted 5 lines
online_pages().This patch will avoid to rebuild the zonelists for already exist nodes.
Signed-off-by Wei Yang <[email protected]>
Sounds correct, as far as the memory hotplug mess allows.
Some style nitpicks below:
Quoted 9 lines
--- mm/page_alloc.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)mm/page_alloc.c +0
-0
mm/page_alloc.c static int __build_all_zonelists(void *data) · line 5203
Quoted 5 lines
mm/page_alloc.c +1
-1@@ -5200,15 +5200,17 @@ static int __build_all_zonelists(void *data)memset (node_load,0 ,sizeof (node_load));#endif -if (self && !node_online (self->node_id)) { +/* This node is hotadded and no memory preset yet.
On multiline comments, the first line should be empty after "/*"
But I see Andrew already fixed that.
Quoted 6 lines
mm/page_alloc.c +3
-2+* So just build zonelists is fine, no need to touch other nodes. +*/ +if (self && !node_online (self->node_id))build_zonelists (self); - } -
mm/page_alloc.c static int __build_all_zonelists(void *data) · line 5213
Quoted 10 lines
mm/page_alloc.c +5
-4-for_each_online_node (nid) { -pg_data_t *pgdat =NODE_DATA (nid); +else +for_each_online_node (nid) { +pg_data_t *pgdat =NODE_DATA (nid); -build_zonelists (pgdat); - } +build_zonelists (pgdat); + }
Personally I would use { } for the else block, and thus leave them also for the if block, not sure if this is recommended by the style guide though.
mm/page_alloc.c static int __build_all_zonelists(void *data)
Quoted 3 lines
mm/page_alloc.c +0
-0/* * Initialize the boot_pagesets that are going to be used
--
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>
Quoted 11 lines · Vlastimil Babka
Quoted 7 lines · Wei Yang
In commit (
9adb62a5df9c0fbef7) "mm/hotplug: correctly setup fallback zonelists when creating new pgdat" tries to build the correct zonelist for a new added node, while it is not necessary to rebuild it for already exist nodes.In
build_zonelists(), it will iterate on nodes with memory. For a new added node, it will have memory untilnode_states_set_node()is called init will not have memory
No memory at this point.
Quoted 26 lines
right?
Quoted 5 lines
online_pages().This patch will avoid to rebuild the zonelists for already exist nodes.
Signed-off-by Wei Yang <[email protected]>Sounds correct, as far as the memory hotplug mess allows.
Acked-by Vlastimil Babka <[email protected]>Some style nitpicks below:
Quoted 12 lines
--- mm/page_alloc.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)mm/page_alloc.c +0
-0@@ -5200,15 +5200,17 @@ static int __build_all_zonelists(void *data)memset (node_load,0 ,sizeof (node_load));#endif
Quoted 5 lines
mm/page_alloc.c static int __build_all_zonelists(void *data) · line 5203
Quoted 2 lines
mm/page_alloc.c +1
-1-if (self && !node_online (self->node_id)) { +/* This node is hotadded and no memory preset yet. On multiline comments, the first line should be empty after "/*"
Thanks, I will pay attention next time.
Quoted 14 lines
But I see Andrew already fixed that.
Quoted 12 lines
mm/page_alloc.c +6
-4+* So just build zonelists is fine, no need to touch other nodes. +*/ +if (self && !node_online (self->node_id))build_zonelists (self); - } - -for_each_online_node (nid) { -pg_data_t *pgdat =NODE_DATA (nid); +else +for_each_online_node (nid) { +pg_data_t *pgdat =NODE_DATA (nid);
Quoted 8 lines
mm/page_alloc.c static int __build_all_zonelists(void *data) · line 5213
Quoted 4 lines
mm/page_alloc.c +2
-2-build_zonelists (pgdat); - } +build_zonelists (pgdat); + }Personally I would use { } for the else block, and thus leave them also for the if block, not sure if this is recommended by the style guide though.
I am not quite sure about this. The checkpatch.py script doesn't complain.
Thanks for your comment again~
Quoted 4 lines
mm/page_alloc.c static int __build_all_zonelists(void *data)
Quoted 3 lines
mm/page_alloc.c +0
-0/* * Initialize the boot_pagesets that are going to be used
--
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>
Quoted 10 lines · Wei Yang
In commit (
9adb62a5df9c0fbef7) "mm/hotplug: correctly setup fallback zonelists when creating new pgdat" tries to build the correct zonelist for a new added node, while it is not necessary to rebuild it for already exist nodes.In
build_zonelists(), it will iterate on nodes with memory. For a new added node, it will have memory untilnode_states_set_node()is called inonline_pages().This patch will avoid to rebuild the zonelists for already exist nodes.
It is not very clear from the changelog why that actually matters. The only effect I can see is that other zonelists on other online nodes will not learn about the currently memory less node. This is a good think because we do not pointlessly try to allocate from that node.
Quoted 1 line
Signed-off-by Wei Yang <[email protected]>
Quoted 9 lines
--- mm/page_alloc.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)mm/page_alloc.c +0
-0
mm/page_alloc.c static int __build_all_zonelists(void *data) · line 5205
Quoted 7 lines
mm/page_alloc.c +3
-1@@ -5200,15 +5200,17 @@ static int __build_all_zonelists(void *data)memset (node_load,0 ,sizeof (node_load));#endif -if (self && !node_online (self->node_id)) { +/* This node is hotadded and no memory preset yet. +* So just build zonelists is fine, no need to touch other nodes. +*/
This comment doesn't make much sense to me. What about
/*
* Do not rebuild zonelists on all online nodes if the current
* node is not online yet (it doesn't have any memory) and
* allocating from it is pointless. Still build zonelist for
* self because we need to handle memoryless nodes. */
Quoted 25 lines
mm/page_alloc.c +6
-6+if (self && !node_online (self->node_id))build_zonelists (self); - } - -for_each_online_node (nid) { -pg_data_t *pgdat =NODE_DATA (nid); +else +for_each_online_node (nid) { +pg_data_t *pgdat =NODE_DATA (nid); -build_zonelists (pgdat); - } +build_zonelists (pgdat); + }/* * Initialize the boot_pagesets that are going to be used Signature · 7 lines
2.11.0 -- 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>
Signature · 8 lines
Michal Hocko SUSE Labs -- 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>
Quoted 10 lines · Michal Hocko
Quoted 9 lines · Wei Yang
In commit (
9adb62a5df9c0fbef7) "mm/hotplug: correctly setup fallback zonelists when creating new pgdat" tries to build the correct zonelist for a new added node, while it is not necessary to rebuild it for already exist nodes.In
build_zonelists(), it will iterate on nodes with memory. For a new added node, it will have memory untilnode_states_set_node()is called inonline_pages().
Quoted 6 lines
Quoted 1 line
This patch will avoid to rebuild the zonelists for already exist nodes.
It is not very clear from the changelog why that actually matters. The only effect I can see is that other zonelists on other online nodes will not learn about the currently memory less node. This is a good think because we do not pointlessly try to allocate from that node.
build_zonelists_node() seems to use managed_zone(zone) checks, so it should not include empty zones anyway. So effectively seems to me we just avoid some pointless work under stop_machine().
Quoted 48 lines
Quoted 1 line
Signed-off-by Wei Yang <[email protected]>Acked-by Michal Hocko <[email protected]>Quoted 9 lines
--- mm/page_alloc.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)mm/page_alloc.c +0
-0mm/page_alloc.c static int __build_all_zonelists(void *data) · line 5205
Quoted 7 lines
mm/page_alloc.c +3
-1@@ -5200,15 +5200,17 @@ static int __build_all_zonelists(void *data)memset (node_load,0 ,sizeof (node_load));#endif -if (self && !node_online (self->node_id)) { +/* This node is hotadded and no memory preset yet. +* So just build zonelists is fine, no need to touch other nodes. +*/ This comment doesn't make much sense to me. What about
/*
* Do not rebuild zonelists on all online nodes if the current
* node is not online yet (it doesn't have any memory) and
* allocating from it is pointless. Still build zonelist for
* self because we need to handle memoryless nodes. */Quoted 20 lines
mm/page_alloc.c +6
-6+if (self && !node_online (self->node_id))build_zonelists (self); - } - -for_each_online_node (nid) { -pg_data_t *pgdat =NODE_DATA (nid); +else +for_each_online_node (nid) { +pg_data_t *pgdat =NODE_DATA (nid); -build_zonelists (pgdat); - } +build_zonelists (pgdat); + }/* * Initialize the boot_pagesets that are going to be used Signature · 1 line
2.11.0
Quoted 6 lines
Quoted 5 lines
--
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>
Quoted 13 lines · Vlastimil Babka
Quoted 12 lines · Michal Hocko
Quoted 10 lines · Wei Yang
In commit (
9adb62a5df9c0fbef7) "mm/hotplug: correctly setup fallback zonelists when creating new pgdat" tries to build the correct zonelist for a new added node, while it is not necessary to rebuild it for already exist nodes.In
build_zonelists(), it will iterate on nodes with memory. For a new added node, it will have memory untilnode_states_set_node()is called inonline_pages().This patch will avoid to rebuild the zonelists for already exist nodes.
Quoted 8 lines
Quoted 4 lines
It is not very clear from the changelog why that actually matters. The only effect I can see is that other zonelists on other online nodes will not learn about the currently memory less node. This is a good think because we do not pointlessly try to allocate from that node.
build_zonelists_node()seems to usemanaged_zone(zone)checks, so it should not include empty zones anyway. So effectively seems to me we just avoid some pointless work understop_machine().
Ohh, you are right. I was looking for populated_zone and didn't find any so I thought we just do not care. So, indeed the patch has no functional effect it just reduces the stop_machine overhead tiny bit.
Signature · 8 lines
Michal Hocko SUSE Labs -- 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>