Skip to contentSkip to conversation

+ mm-vmscan-restore-sc-gfp_mask-after-promoting-it-to-__gfp_highmem.patch added to -mm tree

PATCH [email protected] 1 participant 1 message Feb 19, 2014

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

Subject: + mm-vmscan-restore-sc-gfp_mask-after-promoting-it-to-__gfp_highmem.patch added to -mm tree
To: [email protected],[email protected],[email protected]
From: [email protected]
Date: Wed, 19 Feb 2014 14:32:09 -0800

The patch titled

     Subject: mm/vmscan: restore sc->gfp_mask after promoting it to __GFP_HIGHMEM

has been added to the -mm tree. Its filename is
mm-vmscan-restore-sc-gfp_mask-after-promoting-it-to-__gfp_highmem.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-vmscan-restore-sc-gfp_mask-after-promoting-it-to-__gfp_highmem.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-vmscan-restore-sc-gfp_mask-after-promoting-it-to-__gfp_highmem.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Weijie Yang <[email protected]>
Subject: 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().

---

 mm/vmscan.c |    8 ++++++++
 1 file changed, 8 insertions(+)
mm/vmscan.c renamed from mm/vmscan.c~mm-vmscan-restore-sc-gfp_mask-after-promoting-it-to-__gfp_highmem +8 -0
diff -puN mm/vmscan.c~mm-vmscan-restore-sc-gfp_mask-after-promoting-it-to-__gfp_highmem mm/vmscan.c
@@ -2314,6 +2314,7 @@ static bool shrink_zones(struct zonelist
 	unsigned long lru_pages = 0;
 	bool aborted_reclaim = false;
 	struct reclaim_state *reclaim_state = current->reclaim_state;
+	gfp_t orig_mask;
 	struct shrink_control shrink = {
 		.gfp_mask = sc->gfp_mask,
 	};
@@ -2323,6 +2324,7 @@ static bool shrink_zones(struct zonelist
 	 * allowed level, force direct reclaim to scan the highmem zone as
 	 * highmem pages could be pinning lowmem pages storing buffer_heads
 	 */
+	orig_mask = sc->gfp_mask;
 	if (buffer_heads_over_limit)
 		sc->gfp_mask |= __GFP_HIGHMEM;
 
@@ -2393,6 +2395,12 @@ static bool shrink_zones(struct zonelist
 		}
 	}
 
+	/*
+	 * Restore to original mask to avoid the impact on the caller if we
+	 * promoted it to __GFP_HIGHMEM.
+	 */
+	sc->gfp_mask = orig_mask;
+
 	return aborted_reclaim;
 }
 

_

Patches currently in -mm which might be from [email protected] are

mm-vmscan-restore-sc-gfp_mask-after-promoting-it-to-__gfp_highmem.patch mm-vmscan-do-not-check-compaction_ready-on-promoted-zones.patch linux-next.patch