linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Pádraig Brady" <P@draigBrady.com>
To: Mel Gorman <mgorman@suse.de>
Cc: linux-mm@kvack.org
Subject: Re: sandy bridge kswapd0 livelock with pagecache
Date: Thu, 23 Jun 2011 14:04:15 +0100	[thread overview]
Message-ID: <4E0339CF.8080407@draigBrady.com> (raw)
In-Reply-To: <20110623114646.GM9396@suse.de>

On 23/06/11 12:46, Mel Gorman wrote:
> Based on the information you have provided from sysrq and the profile,
> I put together a theory as to what is going wrong for your machine at
> least although I somehow doubt the same fix will work for Dan. Can you
> try out the following please? It's against 2.6.38.8 (and presumably
> Fedora) but will apply with offset against 2.6.39 and 3.0-rc4.
> 
> ==== CUT HERE ====
> mm: vmscan: Correct check for kswapd sleeping in sleeping_prematurely
> 
> During allocator-intensive workloads, kswapd will be woken frequently
> causing free memory to oscillate between the high and min watermark.
> This is expected behaviour.
> 
> A problem occurs if the highest zone is small that keeps kswapd awake.
> balance_pgdat() only considers unreclaimable zones when priority
> is DEF_PRIORITY but sleeping_prematurely considers all zones. It's
> possible for this sequence to occur
> 
>   1. kswapd wakes up and enters balance_pgdat()
>   2. At DEF_PRIORITY, marks highest zone unreclaimable
>   3. At DEF_PRIORITY-1, ignores highest zone setting end_zone
>   4. At DEF_PRIORITY-1, calls shrink_slab freeing memory from
>         highest zone, clearing all_unreclaimable. Highest zone
>         is still unbalanced
>   5. kswapd returns and calls sleeping_prematurely before sleep
>   6. sleeping_prematurely looks at *all* zones, not just the ones
>      being considered by balance_pgdat. The highest small zone
>      has all_unreclaimable cleared but the zone is not
>      balanced. all_zones_ok is false so kswapd stays awake
> 
> The impact is that kswapd chews up a lot of CPU as it avoids most of
> the scheduling points and reclaims excessively from the lower zones.
> This patch corrects the behaviour of sleeping_prematurely to check
> the zones balance_pgdat() checked.
> 
> Reported-by: Padraig Brady <P@draigBrady.com>
> Not-signed-off-awaiting-confirmation: Mel Gorman <mgorman@suse.de>
> ---
>  mm/vmscan.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index a74bf72..a578535 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -2261,7 +2261,7 @@ static bool sleeping_prematurely(pg_data_t *pgdat, int order, long remaining,
>  		return true;
>  
>  	/* Check the watermark levels */
> -	for (i = 0; i < pgdat->nr_zones; i++) {
> +	for (i = 0; i <= classzone_idx; i++) {
>  		struct zone *zone = pgdat->node_zones + i;
>  
>  		if (!populated_zone(zone))

No joy :(

cheers,
Padraig.

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2011-06-23 13:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-21  9:53 Pádraig Brady
2011-06-21 10:39 ` Mel Gorman
2011-06-21 10:47   ` Pádraig Brady
2011-06-21 11:34     ` Mel Gorman
2011-06-21 11:59       ` Pádraig Brady
2011-06-21 13:07         ` Mel Gorman
2011-06-21 14:23           ` Pádraig Brady
2011-06-22  9:44             ` Mel Gorman
2011-06-22 10:19               ` Pádraig Brady
2011-06-23 11:46                 ` Mel Gorman
2011-06-23 13:04                   ` Pádraig Brady [this message]
2011-06-23 15:24                     ` Mel Gorman
2011-06-23 15:32                       ` Pádraig Brady
2011-06-23 16:59                         ` Mel Gorman
2011-06-23 19:25                           ` Pádraig Brady
2011-06-24 11:44                             ` Mel Gorman
2011-06-24 13:10                               ` Pádraig Brady
2011-06-24 15:04                                 ` Mel Gorman
2011-06-24  6:33             ` Shaohua Li
2011-06-21 14:34         ` Mel Gorman
2011-06-21 15:29           ` Pádraig Brady

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=4E0339CF.8080407@draigBrady.com \
    --to=p@draigbrady.com \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    /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