linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mel Gorman <mel@csn.ul.ie>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: linux-mm <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Wu Fengguang <fengguang.wu@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH for mmotm 5/5] fix vmscan-change-the-number-of-the-unmapped-files-in-zone-reclaim.patch
Date: Thu, 11 Jun 2009 12:15:51 +0100	[thread overview]
Message-ID: <20090611111550.GF7302@csn.ul.ie> (raw)
In-Reply-To: <20090611192757.6D59.A69D9226@jp.fujitsu.com>

On Thu, Jun 11, 2009 at 07:28:30PM +0900, KOSAKI Motohiro wrote:
> Subject: [PATCH] fix vmscan-change-the-number-of-the-unmapped-files-in-zone-reclaim.patch 
> 
> 
> +	nr_unmapped_file_pages = zone_page_state(zone, NR_INACTIVE_FILE) +
> +				 zone_page_state(zone, NR_ACTIVE_FILE) -
> +				 zone_page_state(zone, NR_FILE_MAPPED);
> 
> is wrong. it can be underflow because tmpfs pages are not counted NR_*_FILE,
> but they are counted NR_FILE_MAPPED.
> 
> fixing here.
> 
> 
> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> Cc: Mel Gorman <mel@csn.ul.ie>
> Cc: Wu Fengguang <fengguang.wu@intel.com>
> ---
>  mm/vmscan.c |   32 ++++++++++++++++++++------------
>  1 file changed, 20 insertions(+), 12 deletions(-)
> 
> Index: b/mm/vmscan.c
> ===================================================================
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -2333,6 +2333,23 @@ int sysctl_min_unmapped_ratio = 1;
>   */
>  int sysctl_min_slab_ratio = 5;
>  
> +static unsigned long zone_unmapped_file_pages(struct zone *zone)
> +{
> +	long nr_file_pages;
> +	long nr_file_mapped;
> +	long nr_unmapped_file_pages;
> +
> +	nr_file_pages = zone_page_state(zone, NR_INACTIVE_FILE) +
> +			zone_page_state(zone, NR_ACTIVE_FILE);
> +	nr_file_mapped = zone_page_state(zone, NR_FILE_MAPPED) -
> +			 zone_page_state(zone,
> +					NR_SWAP_BACKED_FILE_MAPPED);
> +	nr_unmapped_file_pages = nr_file_pages - nr_file_mapped;
> +
> +	return nr_unmapped_file_pages > 0 ? nr_unmapped_file_pages : 0;
> +}

This is a more accurate calculation for sure. The question is - is it
necessary?

> +
> +
>  /*
>   * Try to free up some pages from this zone through reclaim.
>   */
> @@ -2355,7 +2372,6 @@ static int __zone_reclaim(struct zone *z
>  		.isolate_pages = isolate_pages_global,
>  	};
>  	unsigned long slab_reclaimable;
> -	long nr_unmapped_file_pages;
>  
>  	disable_swap_token();
>  	cond_resched();
> @@ -2368,11 +2384,7 @@ static int __zone_reclaim(struct zone *z
>  	reclaim_state.reclaimed_slab = 0;
>  	p->reclaim_state = &reclaim_state;
>  
> -	nr_unmapped_file_pages = zone_page_state(zone, NR_INACTIVE_FILE) +
> -				 zone_page_state(zone, NR_ACTIVE_FILE) -
> -				 zone_page_state(zone, NR_FILE_MAPPED);
> -
> -	if (nr_unmapped_file_pages > zone->min_unmapped_pages) {
> +	if (zone_unmapped_file_pages(zone) > zone->min_unmapped_pages) {
>  		/*
>  		 * Free memory by calling shrink zone with increasing
>  		 * priorities until we have enough memory freed.
> @@ -2419,8 +2431,7 @@ int zone_reclaim(struct zone *zone, gfp_
>  {
>  	int node_id;
>  	int ret;
> -	long nr_unmapped_file_pages;
> -	long nr_slab_reclaimable;
> +	unsigned long nr_slab_reclaimable;
>  
>  	/*
>  	 * Zone reclaim reclaims unmapped file backed pages and
> @@ -2432,11 +2443,8 @@ int zone_reclaim(struct zone *zone, gfp_
>  	 * if less than a specified percentage of the zone is used by
>  	 * unmapped file backed pages.
>  	 */
> -	nr_unmapped_file_pages = zone_page_state(zone, NR_INACTIVE_FILE) +
> -				 zone_page_state(zone, NR_ACTIVE_FILE) -
> -				 zone_page_state(zone, NR_FILE_MAPPED);
>  	nr_slab_reclaimable = zone_page_state(zone, NR_SLAB_RECLAIMABLE);
> -	if (nr_unmapped_file_pages <= zone->min_unmapped_pages &&
> +	if (zone_unmapped_file_pages(zone) <= zone->min_unmapped_pages &&
>  	    nr_slab_reclaimable <= zone->min_slab_pages)
>  		return 0;
>  
> 
> 

-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

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

  reply	other threads:[~2009-06-11 11:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-11 10:25 [PATCH for mmotm 0/5] introduce swap-backed-file-mapped count and fix vmscan-change-the-number-of-the-unmapped-files-in-zone-reclaim.patch KOSAKI Motohiro
2009-06-11 10:26 ` [PATCH for mmotm 1/5] cleanp page_remove_rmap() KOSAKI Motohiro
2009-06-11 11:01   ` Mel Gorman
2009-06-11 23:21   ` Wu Fengguang
2009-06-11 10:26 ` [PATCH for mmotm 2/5] KOSAKI Motohiro
2009-06-11 11:13   ` Mel Gorman
2009-06-11 11:50     ` KOSAKI Motohiro
2009-06-12 10:22       ` Mel Gorman
2009-06-11 23:29   ` Wu Fengguang
2009-06-11 10:27 ` [PATCH for mmotm 3/5] add Mapped(SwapBacked) field to /proc/meminfo KOSAKI Motohiro
2009-06-11 10:27 ` [PATCH for mmotm 4/5] adjust fields length of /proc/meminfo KOSAKI Motohiro
2009-06-11 10:28 ` [PATCH for mmotm 5/5] fix vmscan-change-the-number-of-the-unmapped-files-in-zone-reclaim.patch KOSAKI Motohiro
2009-06-11 11:15   ` Mel Gorman [this message]
2009-06-11 10:38 ` [PATCH for mmotm 0/5] introduce swap-backed-file-mapped count and " Mel Gorman
2009-06-11 10:42   ` KOSAKI Motohiro
2009-06-11 10:53     ` Mel Gorman
2009-06-11 11:32       ` KOSAKI Motohiro

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=20090611111550.GF7302@csn.ul.ie \
    --to=mel@csn.ul.ie \
    --cc=akpm@linux-foundation.org \
    --cc=fengguang.wu@intel.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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 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).