aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmscan.c
diff options
context:
space:
mode:
authorWeijie Yang <weijie.yang@samsung.com>2014-04-07 18:36:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-07 19:35:50 -0400
commit619d0d76c1ee943f171c7d4fc021ec7602388579 (patch)
tree1a2bff9a01509f95031157f3a84b44dead8e7d3f /mm/vmscan.c
parenta5338093bfb462256f70f3450c08f73e59543e26 (diff)
mm/vmscan: restore sc->gfp_mask after promoting it to __GFP_HIGHMEM
We promote sc->gfp_mask to __GFP_HIGHMEM to forcibly scan highmem if there are too many buffer_heads pinning highmem. See cc715d99e5 ("mm: vmscan: forcibly scan highmem if there are too many buffer_heads pinning highmem"). This patch restores sc->gfp_mask to its caller original value after finishing the scan job, to avoid the impact on other invocations from its upper caller, such as vmpressure_prio(), shrink_slab(). Signed-off-by: Weijie Yang <weijie.yang@samsung.com> Acked-by: Mel Gorman <mgorman@suse.de> Acked-by: Rik van Riel <riel@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r--mm/vmscan.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 1f56a80a7c41..1c51e4f52fd9 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2314,6 +2314,7 @@ static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc)
2314 unsigned long lru_pages = 0; 2314 unsigned long lru_pages = 0;
2315 bool aborted_reclaim = false; 2315 bool aborted_reclaim = false;
2316 struct reclaim_state *reclaim_state = current->reclaim_state; 2316 struct reclaim_state *reclaim_state = current->reclaim_state;
2317 gfp_t orig_mask;
2317 struct shrink_control shrink = { 2318 struct shrink_control shrink = {
2318 .gfp_mask = sc->gfp_mask, 2319 .gfp_mask = sc->gfp_mask,
2319 }; 2320 };
@@ -2323,6 +2324,7 @@ static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc)
2323 * allowed level, force direct reclaim to scan the highmem zone as 2324 * allowed level, force direct reclaim to scan the highmem zone as
2324 * highmem pages could be pinning lowmem pages storing buffer_heads 2325 * highmem pages could be pinning lowmem pages storing buffer_heads
2325 */ 2326 */
2327 orig_mask = sc->gfp_mask;
2326 if (buffer_heads_over_limit) 2328 if (buffer_heads_over_limit)
2327 sc->gfp_mask |= __GFP_HIGHMEM; 2329 sc->gfp_mask |= __GFP_HIGHMEM;
2328 2330
@@ -2393,6 +2395,12 @@ static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc)
2393 } 2395 }
2394 } 2396 }
2395 2397
2398 /*
2399 * Restore to original mask to avoid the impact on the caller if we
2400 * promoted it to __GFP_HIGHMEM.
2401 */
2402 sc->gfp_mask = orig_mask;
2403
2396 return aborted_reclaim; 2404 return aborted_reclaim;
2397} 2405}
2398 2406