diff options
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r-- | mm/vmscan.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c index 159e6c760d83..be4dfe87be03 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -126,6 +126,12 @@ long vm_total_pages; /* The total number of pages which the VM controls */ | |||
126 | static LIST_HEAD(shrinker_list); | 126 | static LIST_HEAD(shrinker_list); |
127 | static DECLARE_RWSEM(shrinker_rwsem); | 127 | static DECLARE_RWSEM(shrinker_rwsem); |
128 | 128 | ||
129 | #ifdef CONFIG_CGROUP_MEM_CONT | ||
130 | #define scan_global_lru(sc) (!(sc)->mem_cgroup) | ||
131 | #else | ||
132 | #define scan_global_lru(sc) (1) | ||
133 | #endif | ||
134 | |||
129 | /* | 135 | /* |
130 | * Add a shrinker callback to be called from the vm | 136 | * Add a shrinker callback to be called from the vm |
131 | */ | 137 | */ |
@@ -1280,11 +1286,12 @@ static unsigned long do_try_to_free_pages(struct zone **zones, gfp_t gfp_mask, | |||
1280 | * Don't shrink slabs when reclaiming memory from | 1286 | * Don't shrink slabs when reclaiming memory from |
1281 | * over limit cgroups | 1287 | * over limit cgroups |
1282 | */ | 1288 | */ |
1283 | if (sc->mem_cgroup == NULL) | 1289 | if (scan_global_lru(sc)) { |
1284 | shrink_slab(sc->nr_scanned, gfp_mask, lru_pages); | 1290 | shrink_slab(sc->nr_scanned, gfp_mask, lru_pages); |
1285 | if (reclaim_state) { | 1291 | if (reclaim_state) { |
1286 | nr_reclaimed += reclaim_state->reclaimed_slab; | 1292 | nr_reclaimed += reclaim_state->reclaimed_slab; |
1287 | reclaim_state->reclaimed_slab = 0; | 1293 | reclaim_state->reclaimed_slab = 0; |
1294 | } | ||
1288 | } | 1295 | } |
1289 | total_scanned += sc->nr_scanned; | 1296 | total_scanned += sc->nr_scanned; |
1290 | if (nr_reclaimed >= sc->swap_cluster_max) { | 1297 | if (nr_reclaimed >= sc->swap_cluster_max) { |
@@ -1311,7 +1318,7 @@ static unsigned long do_try_to_free_pages(struct zone **zones, gfp_t gfp_mask, | |||
1311 | congestion_wait(WRITE, HZ/10); | 1318 | congestion_wait(WRITE, HZ/10); |
1312 | } | 1319 | } |
1313 | /* top priority shrink_caches still had more to do? don't OOM, then */ | 1320 | /* top priority shrink_caches still had more to do? don't OOM, then */ |
1314 | if (!sc->all_unreclaimable && sc->mem_cgroup == NULL) | 1321 | if (!sc->all_unreclaimable && scan_global_lru(sc)) |
1315 | ret = 1; | 1322 | ret = 1; |
1316 | out: | 1323 | out: |
1317 | /* | 1324 | /* |