diff options
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r-- | mm/vmscan.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c index 2f7c6ae8fae0..387422470c95 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -277,6 +277,21 @@ unsigned long shrink_slab(struct shrink_control *shrink, | |||
277 | } | 277 | } |
278 | 278 | ||
279 | /* | 279 | /* |
280 | * We need to avoid excessive windup on filesystem shrinkers | ||
281 | * due to large numbers of GFP_NOFS allocations causing the | ||
282 | * shrinkers to return -1 all the time. This results in a large | ||
283 | * nr being built up so when a shrink that can do some work | ||
284 | * comes along it empties the entire cache due to nr >>> | ||
285 | * max_pass. This is bad for sustaining a working set in | ||
286 | * memory. | ||
287 | * | ||
288 | * Hence only allow the shrinker to scan the entire cache when | ||
289 | * a large delta change is calculated directly. | ||
290 | */ | ||
291 | if (delta < max_pass / 4) | ||
292 | total_scan = min(total_scan, max_pass / 2); | ||
293 | |||
294 | /* | ||
280 | * Avoid risking looping forever due to too large nr value: | 295 | * Avoid risking looping forever due to too large nr value: |
281 | * never try to free more than twice the estimate number of | 296 | * never try to free more than twice the estimate number of |
282 | * freeable entries. | 297 | * freeable entries. |