Skip to contentSkip to conversation

memory-hotplug: add build zonelists when offline pages

PATCH Superseded qiuxishi 2 participants 4 messages Aug 21, 2012 – Aug 22, 2012

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

qiuxishi

author
#0 lore raw

PATCH 1/1 memory-hotplug: add build zonelists when offline pages

From: Xishi Qiu <[email protected]>

online_pages() does build_all_zonelists() and zone_pcp_update(), I think offline_pages() should do it too. The node has no memory to allocate, so remove this node's zones form other nodes' zonelists.

---
 mm/memory_hotplug.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
mm/memory_hotplug.c +5 -1
index bc7e7a2..5172bd4 100644
@@ -979,7 +979,11 @@ repeat:
 	if (!node_present_pages(node)) {
 		node_clear_state(node, N_HIGH_MEMORY);
 		kswapd_stop(node);
-	}
+		mutex_lock(&zonelists_mutex);
+		build_all_zonelists(NODE_DATA(node), NULL);
+		mutex_unlock(&zonelists_mutex);
+	} else
+		zone_pcp_update(zone);
 
 	vm_total_pages = nr_free_pagecache_pages();
 	writeback_set_ratelimit();
Signature · 7 lines
1.7.6.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

At 08/21/2012 08:51 PM, qiuxishi Wrote:

Quoted 17 lines

From: Xishi Qiu <[email protected]>

online_pages() does build_all_zonelists() and zone_pcp_update(), I think offline_pages() should do it too. The node has no memory to allocate, so remove this node's zones form other nodes' zonelists.

---
 mm/memory_hotplug.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
mm/memory_hotplug.c +0 -0
index bc7e7a2..5172bd4 100644

mm/memory_hotplug.c repeat: · line 983

Quoted 6 lines
mm/memory_hotplug.c +2 -1
@@ -979,7 +979,11 @@ repeat:
 	if (!node_present_pages(node)) {
 		node_clear_state(node, N_HIGH_MEMORY);
 		kswapd_stop(node);
-	}
+		mutex_lock(&zonelists_mutex);
+		build_all_zonelists(NODE_DATA(node), NULL);

The node is still onlined now, so there is no need to pass this node's pgdat to build_all_zonelists().

I think we should build all zonelists when the zone has no pages.

mm/memory_hotplug.c repeat: · line 986

Quoted 3 lines
mm/memory_hotplug.c +3 -0
+		mutex_unlock(&zonelists_mutex);
+	} else
+		zone_pcp_update(zone);

There is more than one zone in a node. So the zone can have no pages when the node has some pages.

And we have called drain_all_pages(), I think there is no need to call zone_pcp_update() here.

Thanks
Wen Congyang

mm/memory_hotplug.c repeat: · line 989

Quoted 3 lines
mm/memory_hotplug.c +0 -0
 	vm_total_pages = nr_free_pagecache_pages();
 	writeback_set_ratelimit();

--
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
Quoted 31 lines · Wen Congyang

At 08/21/2012 08:51 PM, qiuxishi Wrote:

Quoted 17 lines

From: Xishi Qiu <[email protected]>

online_pages() does build_all_zonelists() and zone_pcp_update(), I think offline_pages() should do it too. The node has no memory to allocate, so remove this node's zones form other nodes' zonelists.

---
 mm/memory_hotplug.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
mm/memory_hotplug.c +0 -0
index bc7e7a2..5172bd4 100644

mm/memory_hotplug.c repeat: · line 983

Quoted 6 lines
mm/memory_hotplug.c +2 -1
@@ -979,7 +979,11 @@ repeat:
 	if (!node_present_pages(node)) {
 		node_clear_state(node, N_HIGH_MEMORY);
 		kswapd_stop(node);
-	}
+		mutex_lock(&zonelists_mutex);
+		build_all_zonelists(NODE_DATA(node), NULL);

The node is still onlined now, so there is no need to pass this node's pgdat to build_all_zonelists().

I think we should build all zonelists when the zone has no pages.

Quoted 7 lines

mm/memory_hotplug.c repeat: · line 986

Quoted 3 lines
mm/memory_hotplug.c +3 -0
+		mutex_unlock(&zonelists_mutex);
+	} else
+		zone_pcp_update(zone);

There is more than one zone in a node. So the zone can have no pages when the node has some pages.

Yes, you are right. Here is the new patch,

---
 mm/memory_hotplug.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
mm/memory_hotplug.c +6 -1
index bc7e7a2..5f6997f 100644
@@ -973,8 +973,13 @@ repeat:
 
 	init_per_zone_wmark_min();
 
-	if (!populated_zone(zone))
+	if (!populated_zone(zone)) {
 		zone_pcp_reset(zone);
+		mutex_lock(&zonelists_mutex);
+		build_all_zonelists(NULL, NULL);
+		mutex_unlock(&zonelists_mutex);
+	} else
+		zone_pcp_update(zone);
 
 	if (!node_present_pages(node)) {
 		node_clear_state(node, N_HIGH_MEMORY);
Signature · 1 line
1.7.6.1
Quoted 6 lines

And we have called drain_all_pages(), I think there is no need to call zone_pcp_update() here.

Thanks
Wen Congyang

In zone_pcp_update(), it calculates zone_batchsize() which does not calculated in drain_all_pages().

Thanks
Xishi Qiu

Quoted 5 lines

mm/memory_hotplug.c repeat: · line 988

Quoted 3 lines
mm/memory_hotplug.c +0 -0
 	vm_total_pages = nr_free_pagecache_pages();
 	writeback_set_ratelimit();

--
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

At 08/22/2012 03:59 PM, qiuxishi Wrote:

Quoted 32 lines · Wen Congyang
Quoted 31 lines
Quoted 31 lines

At 08/21/2012 08:51 PM, qiuxishi Wrote:

Quoted 12 lines
Quoted 12 lines

From: Xishi Qiu <[email protected]>

online_pages() does build_all_zonelists() and zone_pcp_update(), I think offline_pages() should do it too. The node has no memory to allocate, so remove this node's zones form other nodes' zonelists.

---
 mm/memory_hotplug.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
Quoted 11 lines

mm/memory_hotplug.c repeat: · line 983

Quoted 11 lines
mm/memory_hotplug.c +2 -1
index bc7e7a2..5172bd4 100644
@@ -979,7 +979,11 @@ repeat:
 	if (!node_present_pages(node)) {
 		node_clear_state(node, N_HIGH_MEMORY);
 		kswapd_stop(node);
-	}
+		mutex_lock(&zonelists_mutex);
+		build_all_zonelists(NODE_DATA(node), NULL);

The node is still onlined now, so there is no need to pass this node's pgdat to build_all_zonelists().

I think we should build all zonelists when the zone has no pages.

Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

mm/memory_hotplug.c repeat: · line 982

Quoted 3 lines
mm/memory_hotplug.c +3 -0
+		mutex_unlock(&zonelists_mutex);
+	} else
+		zone_pcp_update(zone);

There is more than one zone in a node. So the zone can have no pages when the node has some pages.

Yes, you are right. Here is the new patch,

This version looks fine to me.

Quoted 29 lines
---
 mm/memory_hotplug.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
mm/memory_hotplug.c +6 -2
index bc7e7a2..5f6997f 100644
@@ -973,8 +973,13 @@ repeat:
 
 	init_per_zone_wmark_min();
 
-	if (!populated_zone(zone))
+	if (!populated_zone(zone)) {
 		zone_pcp_reset(zone);
+		mutex_lock(&zonelists_mutex);
+		build_all_zonelists(NULL, NULL);
+		mutex_unlock(&zonelists_mutex);
+	} else
+		zone_pcp_update(zone);
 
 	if (!node_present_pages(node)) {
 		node_clear_state(node, N_HIGH_MEMORY);
-- 1.7.6.1
Quoted 3 lines
Quoted 3 lines

And we have called drain_all_pages(), I think there is no need to call zone_pcp_update() here.

Quoted 5 lines
Quoted 3 lines
Quoted 3 lines

Thanks
Wen Congyang

In zone_pcp_update(), it calculates zone_batchsize() which does not calculated in drain_all_pages().

Yes, zone_batchsize() depends on zone's present pages. If zone's present pages are changed, zone's pcp should be updated.

Thanks
Wen Congyang

Quoted 9 lines

Thanks
Xishi Qiu

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

mm/memory_hotplug.c repeat: · line 988

Quoted 3 lines
mm/memory_hotplug.c +0 -0
 	vm_total_pages = nr_free_pagecache_pages();
 	writeback_set_ratelimit();
Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

--
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>