Skip to content

Commit 78dc583

Browse files
kosakitorvalds
authored andcommitted
vmscan: low order lumpy reclaim also should use PAGEOUT_IO_SYNC
Commit 33c120e ("more aggressively use lumpy reclaim") 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. Minchan.kim@gmail.com said: Andy added synchronous lumpy reclaim with c661b07. 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 33c120e. 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. Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com> Cc: Andy Whitcroft <apw@shadowen.org> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Rik van Riel <riel@redhat.com> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Reviewed-by: Minchan Kim <Minchan.kim@gmail.com> Reviewed-by: Mel Gorman <mel@csn.ul.ie> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent d2bf6be commit 78dc583

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

‎mm/vmscan.c‎

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,6 +1061,19 @@ static unsigned long shrink_inactive_list(unsigned long max_scan,
10611061
unsigned long nr_scanned = 0;
10621062
unsigned long nr_reclaimed = 0;
10631063
struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(zone, sc);
1064+
int lumpy_reclaim = 0;
1065+
1066+
/*
1067+
* If we need a large contiguous chunk of memory, or have
1068+
* trouble getting a small set of contiguous pages, we
1069+
* will reclaim both active and inactive pages.
1070+
*
1071+
* We use the same threshold as pageout congestion_wait below.
1072+
*/
1073+
if (sc->order > PAGE_ALLOC_COSTLY_ORDER)
1074+
lumpy_reclaim = 1;
1075+
else if (sc->order && priority < DEF_PRIORITY - 2)
1076+
lumpy_reclaim = 1;
10641077

10651078
pagevec_init(&pvec, 1);
10661079

@@ -1073,19 +1086,7 @@ static unsigned long shrink_inactive_list(unsigned long max_scan,
10731086
unsigned long nr_freed;
10741087
unsigned long nr_active;
10751088
unsigned int count[NR_LRU_LISTS] = { 0, };
1076-
int mode = ISOLATE_INACTIVE;
1077-
1078-
/*
1079-
* If we need a large contiguous chunk of memory, or have
1080-
* trouble getting a small set of contiguous pages, we
1081-
* will reclaim both active and inactive pages.
1082-
*
1083-
* We use the same threshold as pageout congestion_wait below.
1084-
*/
1085-
if (sc->order > PAGE_ALLOC_COSTLY_ORDER)
1086-
mode = ISOLATE_BOTH;
1087-
else if (sc->order && priority < DEF_PRIORITY - 2)
1088-
mode = ISOLATE_BOTH;
1089+
int mode = lumpy_reclaim ? ISOLATE_BOTH : ISOLATE_INACTIVE;
10891090

10901091
nr_taken = sc->isolate_pages(sc->swap_cluster_max,
10911092
&page_list, &nr_scan, sc->order, mode,
@@ -1122,7 +1123,7 @@ static unsigned long shrink_inactive_list(unsigned long max_scan,
11221123
* but that should be acceptable to the caller
11231124
*/
11241125
if (nr_freed < nr_taken && !current_is_kswapd() &&
1125-
sc->order > PAGE_ALLOC_COSTLY_ORDER) {
1126+
lumpy_reclaim) {
11261127
congestion_wait(WRITE, HZ/10);
11271128

11281129
/*

0 commit comments

Comments
 (0)