Skip to contentSkip to conversation

don't attempt to reclaim anon page in lumpy reclaim when no swap space is available

PATCH In review Minchan Kim 3 participants 3 messages Jul 4, 2009

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

PATCH 1/1 don't attempt to reclaim anon page in lumpy reclaim when no swap space is available

This patch is based on mmotm 2009-07-02-19-57 reverted
'vmscan: don't attempt to reclaim anon page in lumpy reclaim when no swap space is available.'

This verssion is better than old one.
That's because enough swap space check is done in case of only lumpy reclaim. so it can't degrade performance in normal case.

== CUT HERE ==

VM already avoids attempting to reclaim anon pages in various places, But it doesn't avoid it for lumpy reclaim.

It shuffles lru list unnecessary so that it is pointless.

Cc Mel Gorman <[email protected]>
Cc KOSAKI Motohiro <[email protected]>
Cc Rik van Riel <[email protected]>
Cc KAMEZAWA Hiroyuki <[email protected]>
---
 mm/vmscan.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
mm/vmscan.c +7 -0
index 27558aa..977af15 100644
@@ -930,6 +930,13 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
 			/* Check that we have not crossed a zone boundary. */
 			if (unlikely(page_zone_id(cursor_page) != zone_id))
 				continue;
+			/*
+			 * If we don't have enough swap space, reclaiming of anon page
+			 * which don't already have a swap slot is pointless.
+			 */
+			if (nr_swap_pages <= 0 && (PageAnon(cursor_page) &&
+						!PageSwapCache(cursor_page)))
+				continue;
 			if (__isolate_lru_page(cursor_page, mode, file) == 0) {
 				list_move(&cursor_page->lru, dst);
 				mem_cgroup_del_lru(cursor_page);
Signature · 13 lines
1.5.4.3



-- 
Kind 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
#1 lore raw
Quoted 10 lines · Minchan Kim

VM already avoids attempting to reclaim anon pages in various places, But it doesn't avoid it for lumpy reclaim.

It shuffles lru list unnecessary so that it is pointless.

Cc Mel Gorman <[email protected]>
Cc KOSAKI Motohiro <[email protected]>
Cc Rik van Riel <[email protected]>
Cc KAMEZAWA Hiroyuki <[email protected]>
Signature · 7 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/ .
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

2009/7/4 Minchan Kim <[email protected]>:

Quoted 32 lines

This patch is based on mmotm 2009-07-02-19-57 reverted
'vmscan: don't attempt to reclaim anon page in lumpy reclaim when no swap space is available.'

This verssion is better than old one.
That's because enough swap space check is done in case of only lumpy reclaim. so it can't degrade performance in normal case.

== CUT HERE ==

VM already avoids attempting to reclaim anon pages in various places, But it doesn't avoid it for lumpy reclaim.

It shuffles lru list unnecessary so that it is pointless.

Cc Mel Gorman <[email protected]>
Cc KOSAKI Motohiro <[email protected]>
Cc Rik van Riel <[email protected]>
Cc KAMEZAWA Hiroyuki <[email protected]>

---
 mm/vmscan.c |    7 +++++++

 1 files changed, 7 insertions(+), 0 deletions(-)
mm/vmscan.c +0 -0
index 27558aa..977af15 100644
@@ -930,6 +930,13 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
                        /* Check that we have not crossed a zone boundary. */
                        if (unlikely(page_zone_id(cursor_page) != zone_id))
                                continue;

mm/vmscan.c static unsigned long isolate_lru_pages(unsigned long nr_to_scan, · line 942

Quoted 10 lines
mm/vmscan.c +7 -0
+                       /*
+                        * If we don't have enough swap space, reclaiming of anon page
+                        * which don't already have a swap slot is pointless.
+                        */
+                       if (nr_swap_pages <= 0 && (PageAnon(cursor_page) &&
+                                               !PageSwapCache(cursor_page)))
+                               continue;
                        if (__isolate_lru_page(cursor_page, mode, file) == 0) {
                                list_move(&cursor_page->lru, dst);
                                mem_cgroup_del_lru(cursor_page);

okey. this is definitely better. thanks.

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