All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rik van Riel <riel@redhat.com>
To: Weijie Yang <weijie.yang@samsung.com>, 'Mel Gorman' <mgorman@suse.de>
Cc: 'Andrew Morton' <akpm@linux-foundation.org>,
	'Minchan Kim' <minchan@kernel.org>,
	weijie.yang.kh@gmail.com, 'Linux-MM' <linux-mm@kvack.org>,
	'linux-kernel' <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] mm/vmscan: restore sc->gfp_mask after promoting it to __GFP_HIGHMEM
Date: Thu, 13 Feb 2014 11:10:28 -0500	[thread overview]
Message-ID: <52FCEE74.9010602@redhat.com> (raw)
In-Reply-To: <000001cf2865$0aa2c0c0$1fe84240$%yang@samsung.com>

On 02/12/2014 09:39 PM, Weijie Yang wrote:

> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -2298,14 +2298,17 @@ 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;
> +	bool promoted_mask = false;
>  
>  	/*
>  	 * If the number of buffer_heads in the machine exceeds the maximum
>  	 * allowed level, force direct reclaim to scan the highmem zone as
>  	 * highmem pages could be pinning lowmem pages storing buffer_heads
>  	 */
> -	if (buffer_heads_over_limit)
> +	if (buffer_heads_over_limit) {

It took me a minute to figure out why you are doing things this way,
so maybe this could use a comment, or maybe it could be done in a
simpler way, by simply saving and restoring the original mask?

		orig_mask = sc->gfp_mask;

> +		promoted_mask = !(sc->gfp_mask & __GFP_HIGHMEM);
>  		sc->gfp_mask |= __GFP_HIGHMEM;
> +	}
>  
>  	for_each_zone_zonelist_nodemask(zone, z, zonelist,
>  					gfp_zone(sc->gfp_mask), sc->nodemask) {
> @@ -2354,6 +2357,9 @@ static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc)
>  		shrink_zone(zone, sc);
>  	}
>  
> +	if (promoted_mask)
		sc->gfp_mask = orig_mask;

> +		sc->gfp_mask &= ~__GFP_HIGHMEM;
> +
>  	return aborted_reclaim;
>  }
>  
> 


-- 
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>

WARNING: multiple messages have this Message-ID (diff)
From: Rik van Riel <riel@redhat.com>
To: Weijie Yang <weijie.yang@samsung.com>, "'Mel Gorman'" <mgorman@suse.de>
Cc: "'Andrew Morton'" <akpm@linux-foundation.org>,
	"'Minchan Kim'" <minchan@kernel.org>,
	weijie.yang.kh@gmail.com, "'Linux-MM'" <linux-mm@kvack.org>,
	"'linux-kernel'" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] mm/vmscan: restore sc->gfp_mask after promoting it to __GFP_HIGHMEM
Date: Thu, 13 Feb 2014 11:10:28 -0500	[thread overview]
Message-ID: <52FCEE74.9010602@redhat.com> (raw)
In-Reply-To: <000001cf2865$0aa2c0c0$1fe84240$%yang@samsung.com>

On 02/12/2014 09:39 PM, Weijie Yang wrote:

> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -2298,14 +2298,17 @@ 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;
> +	bool promoted_mask = false;
>  
>  	/*
>  	 * If the number of buffer_heads in the machine exceeds the maximum
>  	 * allowed level, force direct reclaim to scan the highmem zone as
>  	 * highmem pages could be pinning lowmem pages storing buffer_heads
>  	 */
> -	if (buffer_heads_over_limit)
> +	if (buffer_heads_over_limit) {

It took me a minute to figure out why you are doing things this way,
so maybe this could use a comment, or maybe it could be done in a
simpler way, by simply saving and restoring the original mask?

		orig_mask = sc->gfp_mask;

> +		promoted_mask = !(sc->gfp_mask & __GFP_HIGHMEM);
>  		sc->gfp_mask |= __GFP_HIGHMEM;
> +	}
>  
>  	for_each_zone_zonelist_nodemask(zone, z, zonelist,
>  					gfp_zone(sc->gfp_mask), sc->nodemask) {
> @@ -2354,6 +2357,9 @@ static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc)
>  		shrink_zone(zone, sc);
>  	}
>  
> +	if (promoted_mask)
		sc->gfp_mask = orig_mask;

> +		sc->gfp_mask &= ~__GFP_HIGHMEM;
> +
>  	return aborted_reclaim;
>  }
>  
> 


-- 
All rights reversed

  reply	other threads:[~2014-02-13 16:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-13  2:39 [PATCH 1/2] mm/vmscan: restore sc->gfp_mask after promoting it to __GFP_HIGHMEM Weijie Yang
2014-02-13  2:39 ` Weijie Yang
2014-02-13 16:10 ` Rik van Riel [this message]
2014-02-13 16:10   ` Rik van Riel
2014-02-14  3:39   ` Weijie Yang
2014-02-14  3:39     ` Weijie Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52FCEE74.9010602@redhat.com \
    --to=riel@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=minchan@kernel.org \
    --cc=weijie.yang.kh@gmail.com \
    --cc=weijie.yang@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.