diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/vmscan.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c index 95c08a8cc2ba..a6b7d14812e6 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -1061,6 +1061,19 @@ static unsigned long shrink_inactive_list(unsigned long max_scan, | |||
1061 | unsigned long nr_scanned = 0; | 1061 | unsigned long nr_scanned = 0; |
1062 | unsigned long nr_reclaimed = 0; | 1062 | unsigned long nr_reclaimed = 0; |
1063 | struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(zone, sc); | 1063 | 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; | ||
1064 | 1077 | ||
1065 | pagevec_init(&pvec, 1); | 1078 | pagevec_init(&pvec, 1); |
1066 | 1079 | ||
@@ -1073,19 +1086,7 @@ static unsigned long shrink_inactive_list(unsigned long max_scan, | |||
1073 | unsigned long nr_freed; | 1086 | unsigned long nr_freed; |
1074 | unsigned long nr_active; | 1087 | unsigned long nr_active; |
1075 | unsigned int count[NR_LRU_LISTS] = { 0, }; | 1088 | unsigned int count[NR_LRU_LISTS] = { 0, }; |
1076 | int mode = ISOLATE_INACTIVE; | 1089 | int mode = lumpy_reclaim ? ISOLATE_BOTH : 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 | 1090 | ||
1090 | nr_taken = sc->isolate_pages(sc->swap_cluster_max, | 1091 | nr_taken = sc->isolate_pages(sc->swap_cluster_max, |
1091 | &page_list, &nr_scan, sc->order, mode, | 1092 | &page_list, &nr_scan, sc->order, mode, |
@@ -1122,7 +1123,7 @@ static unsigned long shrink_inactive_list(unsigned long max_scan, | |||
1122 | * but that should be acceptable to the caller | 1123 | * but that should be acceptable to the caller |
1123 | */ | 1124 | */ |
1124 | if (nr_freed < nr_taken && !current_is_kswapd() && | 1125 | if (nr_freed < nr_taken && !current_is_kswapd() && |
1125 | sc->order > PAGE_ALLOC_COSTLY_ORDER) { | 1126 | lumpy_reclaim) { |
1126 | congestion_wait(WRITE, HZ/10); | 1127 | congestion_wait(WRITE, HZ/10); |
1127 | 1128 | ||
1128 | /* | 1129 | /* |