linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Shantanu Goel <sgoel01@yahoo.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	Vlastimil Babka <vbabka@suse.cz>
Subject: Re: [PATCH] vmscan: fix zone balance check in prepare_kswapd_sleep
Date: Mon, 6 Feb 2017 09:31:28 +0100	[thread overview]
Message-ID: <20170206083128.GC3085@dhcp22.suse.cz> (raw)
In-Reply-To: <719282122.1183240.1486298780546@mail.yahoo.com>

[CC Vlastimil]

On Sun 05-02-17 12:46:20, Shantanu Goel wrote:
> Hi,
> 
> On 4.9.7 kswapd is failing to wake up kcompactd due to a mismatch in the zone balance check between balance_pgdat() and prepare_kswapd_sleep().  balance_pgdat() returns as soon as a single zone satisfies the allocation but prepare_kswapd_sleep() requires all zones to do the same.  This causes prepare_kswapd_sleep() to never succeed except in the order == 0 case and consequently, wakeup_kcompactd() is never called.  On my machine prior to apply this patch, the state of compaction from /proc/vmstat looked this way after a day and a half of uptime:
> 
> compact_migrate_scanned 240496
> compact_free_scanned 76238632
> compact_isolated 123472
> compact_stall 1791
> compact_fail 29
> compact_success 1762
> compact_daemon_wake 0
> 
> 
> After applying the patch and about 10 hours of uptime the state looks like this:
> 
> compact_migrate_scanned 59927299
> compact_free_scanned 2021075136
> compact_isolated 640926
> compact_stall 4
> compact_fail 2
> compact_success 2
> compact_daemon_wake 5160
> 
> 
> Thanks,
> Shantanu

> From 46f2e4b02ac263bf50d69cdab3bcbd7bcdea7415 Mon Sep 17 00:00:00 2001
> From: Shantanu Goel <sgoel01@yahoo.com>
> Date: Sat, 4 Feb 2017 19:07:53 -0500
> Subject: [PATCH] vmscan: fix zone balance check in prepare_kswapd_sleep
> 
> The check in prepare_kswapd_sleep needs to match the one in balance_pgdat
> since the latter will return as soon as any one of the zones in the
> classzone is above the watermark.  This is specially important for
> higher order allocations since balance_pgdat will typically reset
> the order to zero relying on compaction to create the higher order
> pages.  Without this patch, prepare_kswapd_sleep fails to wake up
> kcompactd since the zone balance check fails.
> 
> Signed-off-by: Shantanu Goel <sgoel01@yahoo.com>
> ---
>  mm/vmscan.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 7682469..11899ff 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -3142,11 +3142,11 @@ static bool prepare_kswapd_sleep(pg_data_t *pgdat, int order, int classzone_idx)
>  		if (!managed_zone(zone))
>  			continue;
>  
> -		if (!zone_balanced(zone, order, classzone_idx))
> -			return false;
> +		if (zone_balanced(zone, order, classzone_idx))
> +			return true;
>  	}
>  
> -	return true;
> +	return false;
>  }
>  
>  /*
> -- 
> 2.7.4
> 


-- 
Michal Hocko
SUSE Labs

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

  parent reply	other threads:[~2017-02-06  8:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <719282122.1183240.1486298780546.ref@mail.yahoo.com>
2017-02-05 12:46 ` [PATCH] vmscan: fix zone balance check in prepare_kswapd_sleep Shantanu Goel
2017-02-06  3:19   ` Hillf Danton
2017-02-06  8:31   ` Michal Hocko [this message]
2017-02-06 11:51     ` Vlastimil Babka
2017-02-06 16:17   ` Mel Gorman
2017-02-06 17:43     ` Vlastimil Babka
2017-02-06 22:24       ` Mel Gorman
2017-02-07  0:16     ` Shantanu Goel
2017-02-07  9:54       ` Mel Gorman
2017-02-10 13:11       ` Vlastimil Babka

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=20170206083128.GC3085@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sgoel01@yahoo.com \
    --cc=vbabka@suse.cz \
    /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).