linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 1/2] mm/vmscan: restore sc->gfp_mask after promoting it to __GFP_HIGHMEM
@ 2014-02-14  6:41 Weijie Yang
  2014-02-14 11:04 ` Mel Gorman
  2014-02-14 14:15 ` Rik van Riel
  0 siblings, 2 replies; 3+ messages in thread
From: Weijie Yang @ 2014-02-14  6:41 UTC (permalink / raw)
  To: 'Mel Gorman'
  Cc: 'Andrew Morton', riel, 'Minchan Kim',
	weijie.yang.kh, 'Linux-MM', 'linux-kernel'

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@samsung.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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH V2 1/2] mm/vmscan: restore sc->gfp_mask after promoting it to __GFP_HIGHMEM
  2014-02-14  6:41 [PATCH V2 1/2] mm/vmscan: restore sc->gfp_mask after promoting it to __GFP_HIGHMEM Weijie Yang
@ 2014-02-14 11:04 ` Mel Gorman
  2014-02-14 14:15 ` Rik van Riel
  1 sibling, 0 replies; 3+ messages in thread
From: Mel Gorman @ 2014-02-14 11:04 UTC (permalink / raw)
  To: Weijie Yang
  Cc: 'Andrew Morton', riel, 'Minchan Kim',
	weijie.yang.kh, 'Linux-MM', 'linux-kernel'

On Fri, Feb 14, 2014 at 02:41:33PM +0800, Weijie Yang wrote:
> 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@samsung.com>

Acked-by: Mel Gorman <mgorman@suse.de>

-- 
Mel Gorman
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH V2 1/2] mm/vmscan: restore sc->gfp_mask after promoting it to __GFP_HIGHMEM
  2014-02-14  6:41 [PATCH V2 1/2] mm/vmscan: restore sc->gfp_mask after promoting it to __GFP_HIGHMEM Weijie Yang
  2014-02-14 11:04 ` Mel Gorman
@ 2014-02-14 14:15 ` Rik van Riel
  1 sibling, 0 replies; 3+ messages in thread
From: Rik van Riel @ 2014-02-14 14:15 UTC (permalink / raw)
  To: Weijie Yang, 'Mel Gorman'
  Cc: 'Andrew Morton', 'Minchan Kim', weijie.yang.kh,
	'Linux-MM', 'linux-kernel'

On 02/14/2014 01:41 AM, Weijie Yang wrote:
> 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@samsung.com>

Acked-by: Rik van Riel <riel@redhat.com>

-- 
All rights reversed

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-14 14:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-14  6:41 [PATCH V2 1/2] mm/vmscan: restore sc->gfp_mask after promoting it to __GFP_HIGHMEM Weijie Yang
2014-02-14 11:04 ` Mel Gorman
2014-02-14 14:15 ` Rik van Riel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).