linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: Chen Yucong <slaoub@gmail.com>
Cc: mgorman@suse.de, mhocko@suse.cz, akpm@linux-foundation.org,
	linux-mm@kvack.org
Subject: Re: [PATCH] mm/vmscan.c: avoid scanning the whole targets[*] when scan_balance equals SCAN_FILE/SCAN_ANON
Date: Fri, 6 Jun 2014 09:12:51 -0400	[thread overview]
Message-ID: <20140606131251.GB2878@cmpxchg.org> (raw)
In-Reply-To: <1402044866-15313-1-git-send-email-slaoub@gmail.com>

Hi Chen,

On Fri, Jun 06, 2014 at 04:54:26PM +0800, Chen Yucong wrote:
> If (scan_balance == SCAN_FILE) is true for shrink_lruvec, then  the value of
> targets[LRU_INACTIVE_ANON] and targets[LRU_ACTIVE_ANON] will be zero. As a result,
> the value of 'percentage' will also be  zero, and the *whole* targets[LRU_INACTIVE_FILE]
> and targets[LRU_ACTIVE_FILE] will be scanned.
> 
> For (scan_balance == SCAN_ANON), there is the same conditions stated above.
> 
> But via https://lkml.org/lkml/2013/4/10/334, we can find that the kernel does not prefer
> reclaiming too many pages from the other LRU. So before recalculating the other LRU scan
> count based on its original scan targets and the percentage scanning already complete, we
> should need to check whether 'scan_balance' equals SCAN_FILE/SCAN_ANON.
> 
> Signed-off-by: Chen Yucong <slaoub@gmail.com>
> ---
>  mm/vmscan.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index d51f7e0..ca3f5f1 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -2120,6 +2120,9 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)
>  			percentage = nr_file * 100 / scan_target;
>  		}
>  
> +		if (targets[lru] == 0 && targets[lru + LRU_ACTIVE] == 0)
> +			break;

We have meanwhile included a change that bails out if nr_anon or
nr_file are zero, right before that percentage calculation, that
should cover the scenario you're describing.  It's called:

mm: vmscan: use proportional scanning during direct reclaim and full scan at DEF_PRIORITY

--
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:[~2014-06-06 13:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-06  8:54 Chen Yucong
2014-06-06 13:12 ` Johannes Weiner [this message]
2014-06-06 13:47   ` Chen Yucong

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=20140606131251.GB2878@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.cz \
    --cc=slaoub@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox