Skip to contentSkip to conversation

consider swap space when we decide compaction goes or not

PATCH In review Minchan Kim 3 participants 3 messages Dec 20, 2011

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

PATCH 1/1 consider swap space when we decide compaction goes or not

It's pointless to go reclaiming when we have no swap space and lots of anon pages in inactive list.

Cc KOSAKI Motohiro <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Andrea Arcangeli <[email protected]>
---
 mm/vmscan.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
mm/vmscan.c +3 -2
index 23256e8..cd5400c 100644
@@ -2015,8 +2015,9 @@ static inline bool should_continue_reclaim(struct zone *zone,
 	 * inactive lists are large enough, continue reclaiming
 	 */
 	pages_for_compaction = (2UL << sc->order);
-	inactive_lru_pages = zone_nr_lru_pages(zone, sc, LRU_INACTIVE_ANON) +
-				zone_nr_lru_pages(zone, sc, LRU_INACTIVE_FILE);
+	inactive_lru_pages = zone_nr_lru_pages(zone, sc, LRU_INACTIVE_FILE);
+	if (nr_swap_pages > 0)
+		inactive_lru_pages += zone_nr_lru_pages(zone, sc, LRU_INACTIVE_ANON);
 	if (sc->nr_reclaimed < pages_for_compaction &&
 			inactive_lru_pages > pages_for_compaction)
 		return true;
Signature · 8 lines
1.7.6.4

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Acked-by on v1 1/1
#1 lore raw
Quoted 19 lines · Minchan Kim

It's pointless to go reclaiming when we have no swap space and lots of anon pages in inactive list.

Cc KOSAKI Motohiro <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Andrea Arcangeli <[email protected]>
---
 mm/vmscan.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
mm/vmscan.c +0 -0
index 23256e8..cd5400c 100644
@@ -2015,8 +2015,9 @@ static inline bool should_continue_reclaim(struct zone *zone,
 	 * inactive lists are large enough, continue reclaiming

mm/vmscan.c static inline bool should_continue_reclaim(struct zone *zone, · line 2023

Quoted 10 lines
mm/vmscan.c +3 -2
 	 */
 	pages_for_compaction = (2UL << sc->order);
-	inactive_lru_pages = zone_nr_lru_pages(zone, sc, LRU_INACTIVE_ANON) +
-				zone_nr_lru_pages(zone, sc, LRU_INACTIVE_FILE);
+	inactive_lru_pages = zone_nr_lru_pages(zone, sc, LRU_INACTIVE_FILE);
+	if (nr_swap_pages > 0)
+		inactive_lru_pages += zone_nr_lru_pages(zone, sc, LRU_INACTIVE_ANON);
 	if (sc->nr_reclaimed < pages_for_compaction &&
 			inactive_lru_pages > pages_for_compaction)
 		return true;

The changelog does not win a prize for detail but it makes sense. Without this patch, it is possible when swap is disabled to continue trying to reclaim when there are only anonymous page in the system even though that will not make any progress.

Signature · 9 lines
Mel Gorman
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Reviewed-by on v1 1/1
#2 lore raw
In reply to Minchan Kim
Quoted 9 lines · Minchan Kim

It's pointless to go reclaiming when we have no swap space and lots of anon pages in inactive list.

Cc KOSAKI Motohiro<[email protected]>
Cc Mel Gorman<[email protected]>
Cc Rik van Riel<[email protected]>
Cc Johannes Weiner<[email protected]>
Cc Andrea Arcangeli<[email protected]>
Signature · 8 lines
All rights reversed

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>