linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Balbir Singh <balbir@linux.vnet.ibm.com>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Mel Gorman <mel@csn.ul.ie>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Subject: Re: [PATCH 2/4] vmscan: get_scan_ratio cleanup
Date: Tue, 29 Dec 2009 13:04:12 +0530	[thread overview]
Message-ID: <20091229073412.GN3601@balbir.in.ibm.com> (raw)
In-Reply-To: <20091228164733.A68A.A69D9226@jp.fujitsu.com>

* KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> [2009-12-28 16:48:06]:

> The get_scan_ratio() should have all scan-ratio related calculations.
> Thus, this patch move some calculation into get_scan_ratio.
> 
> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> ---
>  mm/vmscan.c |   23 ++++++++++++++---------
>  1 files changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 2bbee91..640486b 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -1501,6 +1501,13 @@ static void get_scan_ratio(struct zone *zone, struct scan_control *sc,
>  	unsigned long ap, fp;
>  	struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(zone, sc);
> 
> +	/* If we have no swap space, do not bother scanning anon pages. */
> +	if (!sc->may_swap || (nr_swap_pages <= 0)) {
> +		percent[0] = 0;
> +		percent[1] = 100;
> +		return;
> +	}
> +


>  	anon  = zone_nr_lru_pages(zone, sc, LRU_ACTIVE_ANON) +
>  		zone_nr_lru_pages(zone, sc, LRU_INACTIVE_ANON);
>  	file  = zone_nr_lru_pages(zone, sc, LRU_ACTIVE_FILE) +
> @@ -1598,22 +1605,20 @@ static void shrink_zone(int priority, struct zone *zone,
>  	unsigned long nr_reclaimed = sc->nr_reclaimed;
>  	unsigned long nr_to_reclaim = sc->nr_to_reclaim;
>  	struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(zone, sc);
> -	int noswap = 0;
> 
> -	/* If we have no swap space, do not bother scanning anon pages. */
> -	if (!sc->may_swap || (nr_swap_pages <= 0)) {
> -		noswap = 1;
> -		percent[0] = 0;
> -		percent[1] = 100;
> -	} else
> -		get_scan_ratio(zone, sc, percent);
> +	get_scan_ratio(zone, sc, percent);

Where do we set noswap? Is percent[0] == 0 used to indicate noswap =
1?

> 
>  	for_each_evictable_lru(l) {
>  		int file = is_file_lru(l);
>  		unsigned long scan;
> 
> +		if (percent[file] == 0) {
> +			nr[l] = 0;
> +			continue;
> +		}
> +

Is this really needed? Won't nr_scan_try_batch handle it correctly?

>  		scan = zone_nr_lru_pages(zone, sc, l);
> -		if (priority || noswap) {
> +		if (priority) {
>  			scan >>= priority;
>  			scan = (scan * percent[file]) / 100;
>  		}

-- 
	Balbir

--
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-12-29  7:34 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-28  7:47 [PATCH 1/4] vmstat: remove zone->lock from walk_zones_in_node KOSAKI Motohiro
2009-12-28  7:48 ` [PATCH 2/4] vmscan: get_scan_ratio cleanup KOSAKI Motohiro
2009-12-29  7:34   ` Balbir Singh [this message]
2009-12-30 13:06     ` KOSAKI Motohiro
2010-01-01 14:55   ` Rik van Riel
2010-01-03 23:45   ` KAMEZAWA Hiroyuki
2009-12-28  7:48 ` [PATCH 3/4] vmstat: add anon_scan_ratio field to zoneinfo KOSAKI Motohiro
2009-12-29 14:08   ` Balbir Singh
2009-12-30 13:13     ` KOSAKI Motohiro
2010-01-01 14:59   ` Rik van Riel
2010-01-03 23:47   ` KAMEZAWA Hiroyuki
2009-12-28  7:49 ` [PATCH 4/4] memcg: add anon_scan_ratio to memory.stat file KOSAKI Motohiro
2009-12-29 14:09   ` Balbir Singh
2009-12-30 12:53     ` KOSAKI Motohiro
2009-12-29  4:05 ` [PATCH 1/4] vmstat: remove zone->lock from walk_zones_in_node Minchan Kim
2009-12-29  6:34 ` Balbir Singh
2009-12-30 12:49   ` KOSAKI Motohiro
2010-01-03 18:59 ` Mel Gorman
2010-01-05  2:04   ` KOSAKI Motohiro
2010-01-05 10:18     ` Mel Gorman
2010-01-06  0:33       ` KOSAKI Motohiro
2010-01-03 23:48 ` KAMEZAWA Hiroyuki

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=20091229073412.GN3601@balbir.in.ibm.com \
    --to=balbir@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mel@csn.ul.ie \
    /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).