lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-id: <000101cf294f$eef39610$ccdac230$%yang@samsung.com>
Date:	Fri, 14 Feb 2014 14:41:33 +0800
From:	Weijie Yang <weijie.yang@...sung.com>
To:	'Mel Gorman' <mgorman@...e.de>
Cc:	'Andrew Morton' <akpm@...ux-foundation.org>, riel@...hat.com,
	'Minchan Kim' <minchan@...nel.org>, weijie.yang.kh@...il.com,
	'Linux-MM' <linux-mm@...ck.org>,
	'linux-kernel' <linux-kernel@...r.kernel.org>
Subject: [PATCH V2 1/2] 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

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@...sung.com>
---
Changes since v1:
	- use orig_mask to record the caller's orininal mask and restore
	 it after finishing scan, according to Riel's suggestion.

V1: https://lkml.org/lkml/2014/2/12/764

 mm/vmscan.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index a9c74b4..da0a87c 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2298,6 +2298,7 @@ static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc)
 	unsigned long nr_soft_reclaimed;
 	unsigned long nr_soft_scanned;
 	bool aborted_reclaim = false;
+	gfp_t orig_mask = sc->gfp_mask;
 
 	/*
 	 * If the number of buffer_heads in the machine exceeds the maximum
@@ -2354,6 +2355,12 @@ static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc)
 		shrink_zone(zone, sc);
 	}
 
+	/*
+	 * restore to original mask to avoid the impact on its caller
+	 * if we promote it to __GFP_HIGHMEM.
+	 */
+	sc->gfp_mask = orig_mask;
+
 	return aborted_reclaim;
 }
 
-- 
1.7.10.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ