Skip to contentSkip to conversation

low order lumpy reclaim also should use PAGEOUT_IO_SYNC.

PATCH In review KOSAKI Motohiro 3 participants 6 messages Apr 21, 2009 – Apr 23, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 low order lumpy reclaim also should use PAGEOUT_IO_SYNC.

Subject: [PATCH] low order lumpy reclaim also should use PAGEOUT_IO_SYNC.

commit 33c120ed2843090e2bd316de1588b8bf8b96cbde (more aggressively use lumpy reclaim) change lumpy reclaim using condition. but it isn't enough change.

lumpy reclaim don't only mean isolate neighber page, but also do pageout as synchronous. this patch does it.

Cc Lee Schermerhorn <[email protected]>
Cc Andy Whitcroft <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Rik van Riel <[email protected]>
---
 mm/vmscan.c |   29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)
mm/vmscan.c +15 -14
Index: b/mm/vmscan.c
===================================================================
@@ -1049,6 +1049,19 @@ static unsigned long shrink_inactive_lis
 	unsigned long nr_scanned = 0;
 	unsigned long nr_reclaimed = 0;
 	struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(zone, sc);
+	int lumpy_reclaim = 0;
+
+	/*
+	 * If we need a large contiguous chunk of memory, or have
+	 * trouble getting a small set of contiguous pages, we
+	 * will reclaim both active and inactive pages.
+	 *
+	 * We use the same threshold as pageout congestion_wait below.
+	 */
+	if (sc->order > PAGE_ALLOC_COSTLY_ORDER)
+		lumpy_reclaim = 1;
+	else if (sc->order && priority < DEF_PRIORITY - 2)
+		lumpy_reclaim = 1;
 
 	pagevec_init(&pvec, 1);
 
@@ -1061,19 +1074,7 @@ static unsigned long shrink_inactive_lis
 		unsigned long nr_freed;
 		unsigned long nr_active;
 		unsigned int count[NR_LRU_LISTS] = { 0, };
-		int mode = ISOLATE_INACTIVE;
-
-		/*
-		 * If we need a large contiguous chunk of memory, or have
-		 * trouble getting a small set of contiguous pages, we
-		 * will reclaim both active and inactive pages.
-		 *
-		 * We use the same threshold as pageout congestion_wait below.
-		 */
-		if (sc->order > PAGE_ALLOC_COSTLY_ORDER)
-			mode = ISOLATE_BOTH;
-		else if (sc->order && priority < DEF_PRIORITY - 2)
-			mode = ISOLATE_BOTH;
+		int mode = lumpy_reclaim ? ISOLATE_BOTH : ISOLATE_INACTIVE;
 
 		nr_taken = sc->isolate_pages(sc->swap_cluster_max,
 			     &page_list, &nr_scan, sc->order, mode,
@@ -1110,7 +1111,7 @@ static unsigned long shrink_inactive_lis
 		 * but that should be acceptable to the caller
 		 */
 		if (nr_freed < nr_taken && !current_is_kswapd() &&
-					sc->order > PAGE_ALLOC_COSTLY_ORDER) {
+		    lumpy_reclaim) {
 			congestion_wait(WRITE, HZ/10);
 
 			/*

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

Reviewed-by on v1 1/1
#1 lore raw

Hi, Kosaki-san.

Quoted 7 lines · On Tue, 21 Apr 2009 14:22:27 +0900 (JST) KOSAKI Motohiro…

Subject: [PATCH] low order lumpy reclaim also should use PAGEOUT_IO_SYNC.

commit 33c120ed2843090e2bd316de1588b8bf8b96cbde (more aggressively use lumpy reclaim) change lumpy reclaim using condition. but it isn't enough change.

lumpy reclaim don't only mean isolate neighber page, but also do pageout as synchronous. this patch does it.

I agree.

Andi added synchronous lumpy reclaim with c661b078fd62abe06fd11fab4ac5e4eeafe26b6d. At that time, lumpy reclaim is not agressive.
His intension is just for high-order users.(above PAGE_ALLOC_COSTLY_ORDER).

After some time, Rik added aggressive lumpy reclaim with 33c120ed2843090e2bd316de1588b8bf8b96cbde. His intension is that do lumpy reclaim when high-order users and trouble getting a small set of contiguous pages.

So we also have to add synchronous pageout for small set of contiguous pages. Nice catch!.

BTW, Do you have any number ?

Signature · 8 lines
Kinds Regards
Minchan Kim

--
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>
#2 lore raw
Quoted 22 lines

Hi, Kosaki-san.

Quoted 7 lines · On Tue, 21 Apr 2009 14:22:27 +0900 (JST) KOSAKI Motohiro…

Subject: [PATCH] low order lumpy reclaim also should use PAGEOUT_IO_SYNC.

commit 33c120ed2843090e2bd316de1588b8bf8b96cbde (more aggressively use lumpy reclaim) change lumpy reclaim using condition. but it isn't enough change.

lumpy reclaim don't only mean isolate neighber page, but also do pageout as synchronous. this patch does it.

I agree.

Andi added synchronous lumpy reclaim with c661b078fd62abe06fd11fab4ac5e4eeafe26b6d. At that time, lumpy reclaim is not agressive.
His intension is just for high-order users.(above PAGE_ALLOC_COSTLY_ORDER).

After some time, Rik added aggressive lumpy reclaim with 33c120ed2843090e2bd316de1588b8bf8b96cbde. His intension is that do lumpy reclaim when high-order users and trouble getting a small set of contiguous pages.

Quoted 6 lines

So we also have to add synchronous pageout for small set of contiguous pages. Nice catch!.

BTW, Do you have any number ?

No.

Actually, this logic only run when system is strongly memory stavation or fragment. not normal case.

At that time, another slowdown thing hide synchronous reclaim latency, I think.

--
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 27 lines · On Tue, 21 Apr 2009 16:21:18 +0900 (JST) KOSAKI Motohiro…
Quoted 27 lines

Hi, Kosaki-san.

Quoted 7 lines · On Tue, 21 Apr 2009 14:22:27 +0900 (JST) KOSAKI Motohiro…

Subject: [PATCH] low order lumpy reclaim also should use PAGEOUT_IO_SYNC.

commit 33c120ed2843090e2bd316de1588b8bf8b96cbde (more aggressively use lumpy reclaim) change lumpy reclaim using condition. but it isn't enough change.

lumpy reclaim don't only mean isolate neighber page, but also do pageout as synchronous. this patch does it.

I agree.

Andi added synchronous lumpy reclaim with c661b078fd62abe06fd11fab4ac5e4eeafe26b6d. At that time, lumpy reclaim is not agressive.
His intension is just for high-order users.(above PAGE_ALLOC_COSTLY_ORDER).

After some time, Rik added aggressive lumpy reclaim with 33c120ed2843090e2bd316de1588b8bf8b96cbde. His intension is that do lumpy reclaim when high-order users and trouble getting a small set of contiguous pages.

So we also have to add synchronous pageout for small set of contiguous pages. Nice catch!.

Quoted 9 lines
Quoted 1 line

BTW, Do you have any number ?

No.

Actually, this logic only run when system is strongly memory stavation or fragment. not normal case.

At that time, another slowdown thing hide synchronous reclaim latency, I think.

Yes. I think it's hard measure, too.
I was just out of curiosity if server guy have a any benchmark method. ;-)

Signature · 8 lines
Kinds Regards
Minchan Kim

--
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>
Reviewed-by on v1 1/1
#4 lore raw
In reply to KOSAKI Motohiro
Quoted 8 lines · KOSAKI Motohiro

Subject: [PATCH] low order lumpy reclaim also should use PAGEOUT_IO_SYNC.

commit 33c120ed2843090e2bd316de1588b8bf8b96cbde (more aggressively use lumpy reclaim) change lumpy reclaim using condition. but it isn't enough change.

lumpy reclaim don't only mean isolate neighber page, but also do pageout as synchronous. this patch does it.

Quoted 6 lines
Cc Lee Schermerhorn <[email protected]>
Cc Andy Whitcroft <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Rik van Riel <[email protected]>

Seems fair although the changelog could be better. Maybe something like?

====

Commit 33c120ed2843090e2bd316de1588b8bf8b96cbde increased how aggressive lumpy reclaim was by isolating both active and inactive pages for asynchronous lumpy reclaim on costly-high-order pages and for cheap-high-order when memory pressure is high. However, if the system is under heavy pressure and there are dirty pages, asynchronous IO may not be sufficient to reclaim a suitable page in time.

This patch causes the caller to enter synchronous lumpy reclaim for costly-high-order pages and for cheap-high-order pages when under memory pressure.
====

Whether the changelog is updated or not though;

Quoted 60 lines
---
 mm/vmscan.c |   29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

Index: b/mm/vmscan.c
===================================================================

mm/vmscan.c +15 -14
@@ -1049,6 +1049,19 @@ static unsigned long shrink_inactive_lis
 	unsigned long nr_scanned = 0;
 	unsigned long nr_reclaimed = 0;
 	struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(zone, sc);
+	int lumpy_reclaim = 0;
+
+	/*
+	 * If we need a large contiguous chunk of memory, or have
+	 * trouble getting a small set of contiguous pages, we
+	 * will reclaim both active and inactive pages.
+	 *
+	 * We use the same threshold as pageout congestion_wait below.
+	 */
+	if (sc->order > PAGE_ALLOC_COSTLY_ORDER)
+		lumpy_reclaim = 1;
+	else if (sc->order && priority < DEF_PRIORITY - 2)
+		lumpy_reclaim = 1;
 
 	pagevec_init(&pvec, 1);
 
@@ -1061,19 +1074,7 @@ static unsigned long shrink_inactive_lis
 		unsigned long nr_freed;
 		unsigned long nr_active;
 		unsigned int count[NR_LRU_LISTS] = { 0, };
-		int mode = ISOLATE_INACTIVE;
-
-		/*
-		 * If we need a large contiguous chunk of memory, or have
-		 * trouble getting a small set of contiguous pages, we
-		 * will reclaim both active and inactive pages.
-		 *
-		 * We use the same threshold as pageout congestion_wait below.
-		 */
-		if (sc->order > PAGE_ALLOC_COSTLY_ORDER)
-			mode = ISOLATE_BOTH;
-		else if (sc->order && priority < DEF_PRIORITY - 2)
-			mode = ISOLATE_BOTH;
+		int mode = lumpy_reclaim ? ISOLATE_BOTH : ISOLATE_INACTIVE;
 
 		nr_taken = sc->isolate_pages(sc->swap_cluster_max,
 			     &page_list, &nr_scan, sc->order, mode,
@@ -1110,7 +1111,7 @@ static unsigned long shrink_inactive_lis
 		 * but that should be acceptable to the caller
 		 */
 		if (nr_freed < nr_taken && !current_is_kswapd() &&
-					sc->order > PAGE_ALLOC_COSTLY_ORDER) {
+		    lumpy_reclaim) {
 			congestion_wait(WRITE, HZ/10);
 
 			/*
Signature · 9 lines
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

--
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 Reviewed-by Minchan Kim Reviewed-by Mel Gorman
#5 lore raw
Quoted 27 lines · KOSAKI Motohiro
Quoted 8 lines

Subject: [PATCH] low order lumpy reclaim also should use PAGEOUT_IO_SYNC.

commit 33c120ed2843090e2bd316de1588b8bf8b96cbde (more aggressively use lumpy reclaim) change lumpy reclaim using condition. but it isn't enough change.

lumpy reclaim don't only mean isolate neighber page, but also do pageout as synchronous. this patch does it.

Quoted 6 lines
Cc Lee Schermerhorn <[email protected]>
Cc Andy Whitcroft <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Rik van Riel <[email protected]>

Seems fair although the changelog could be better. Maybe something like?

====

Commit 33c120ed2843090e2bd316de1588b8bf8b96cbde increased how aggressive lumpy reclaim was by isolating both active and inactive pages for asynchronous lumpy reclaim on costly-high-order pages and for cheap-high-order when memory pressure is high. However, if the system is under heavy pressure and there are dirty pages, asynchronous IO may not be sufficient to reclaim a suitable page in time.

Quoted 8 lines

This patch causes the caller to enter synchronous lumpy reclaim for costly-high-order pages and for cheap-high-order pages when under memory pressure.
====

Whether the changelog is updated or not though;

Cool!

Andrew, Could you please replace vmscan-low-order-lumpy-reclaim-also-should-use-pageout_io_sync.patch with following patch?

===================================
Subject: vmscan: low order lumpy reclaim also should use PAGEOUT_IO_SYNC
From: KOSAKI Motohiro <[email protected]>

Commit 33c120ed2843090e2bd316de1588b8bf8b96cbde increased how aggressive lumpy reclaim was by isolating both active and inactive pages for asynchronous lumpy reclaim on costly-high-order pages and for cheap-high-order when memory pressure is high. However, if the system is under heavy pressure and there are dirty pages, asynchronous IO may not be sufficient to reclaim a suitable page in time.

This patch causes the caller to enter synchronous lumpy reclaim for costly-high-order pages and for cheap-high-order pages when under memory pressure.

[email protected] said:

Andy added synchronous lumpy reclaim with c661b078fd62abe06fd11fab4ac5e4eeafe26b6d. At that time, lumpy reclaim is not agressive. His intension is just for high-order users.(above PAGE_ALLOC_COSTLY_ORDER).

After some time, Rik added aggressive lumpy reclaim with 33c120ed2843090e2bd316de1588b8bf8b96cbde. His intention was to do lumpy reclaim when high-order users and trouble getting a small set of contiguous pages.

So we also have to add synchronous pageout for small set of contiguous pages.

---

 mm/vmscan.c |   29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)
mm/vmscan.c renamed from mm/vmscan.c~vmscan-low-order-lumpy-reclaim-also-should-use-pageout_io_sync +15 -14
diff -puN mm/vmscan.c~vmscan-low-order-lumpy-reclaim-also-should-use-pageout_io_sync mm/vmscan.c
@@ -1059,6 +1059,19 @@ static unsigned long shrink_inactive_lis
 	unsigned long nr_scanned = 0;
 	unsigned long nr_reclaimed = 0;
 	struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(zone, sc);
+	int lumpy_reclaim = 0;
+
+	/*
+	 * If we need a large contiguous chunk of memory, or have
+	 * trouble getting a small set of contiguous pages, we
+	 * will reclaim both active and inactive pages.
+	 *
+	 * We use the same threshold as pageout congestion_wait below.
+	 */
+	if (sc->order > PAGE_ALLOC_COSTLY_ORDER)
+		lumpy_reclaim = 1;
+	else if (sc->order && priority < DEF_PRIORITY - 2)
+		lumpy_reclaim = 1;
 
 	pagevec_init(&pvec, 1);
 
@@ -1071,19 +1084,7 @@ static unsigned long shrink_inactive_lis
 		unsigned long nr_freed;
 		unsigned long nr_active;
 		unsigned int count[NR_LRU_LISTS] = { 0, };
-		int mode = ISOLATE_INACTIVE;
-
-		/*
-		 * If we need a large contiguous chunk of memory, or have
-		 * trouble getting a small set of contiguous pages, we
-		 * will reclaim both active and inactive pages.
-		 *
-		 * We use the same threshold as pageout congestion_wait below.
-		 */
-		if (sc->order > PAGE_ALLOC_COSTLY_ORDER)
-			mode = ISOLATE_BOTH;
-		else if (sc->order && priority < DEF_PRIORITY - 2)
-			mode = ISOLATE_BOTH;
+		int mode = lumpy_reclaim ? ISOLATE_BOTH : ISOLATE_INACTIVE;
 
 		nr_taken = sc->isolate_pages(sc->swap_cluster_max,
 			     &page_list, &nr_scan, sc->order, mode,
@@ -1120,7 +1121,7 @@ static unsigned long shrink_inactive_lis
 		 * but that should be acceptable to the caller
 		 */
 		if (nr_freed < nr_taken && !current_is_kswapd() &&
-					sc->order > PAGE_ALLOC_COSTLY_ORDER) {
+		    lumpy_reclaim) {
 			congestion_wait(WRITE, HZ/10);
 
 			/*

_

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