linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Mel Gorman <mgorman@techsingularity.net>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	David Rientjes <rientjes@google.com>,
	Rik van Riel <riel@redhat.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 04/11] mm, compaction: don't recheck watermarks after COMPACT_SUCCESS
Date: Thu, 18 Aug 2016 11:03:14 +0200	[thread overview]
Message-ID: <20160818090314.GE30162@dhcp22.suse.cz> (raw)
In-Reply-To: <20160810091226.6709-5-vbabka@suse.cz>

On Wed 10-08-16 11:12:19, Vlastimil Babka wrote:
> Joonsoo has reminded me that in a later patch changing watermark checks
> throughout compaction I forgot to update checks in try_to_compact_pages() and
> compactd_do_work(). Closer inspection however shows that they are redundant now
> that compact_zone() reliably reports success with COMPACT_SUCCESS, as they just
> repeat (a subset) of checks that have just passed. So instead of checking
> watermarks again, just test the return value.

the less watermark checks we do the better because they just increase a
probability of subtle and hard to explain corner cases.

> Also remove the stray "bool success" variable from kcompactd_do_work().
> 
> Reported-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  mm/compaction.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/mm/compaction.c b/mm/compaction.c
> index c355bf0d8599..a144f58f7193 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -1698,9 +1698,8 @@ enum compact_result try_to_compact_pages(gfp_t gfp_mask, unsigned int order,
>  					alloc_flags, ac_classzone_idx(ac));
>  		rc = max(status, rc);
>  
> -		/* If a normal allocation would succeed, stop compacting */
> -		if (zone_watermark_ok(zone, order, low_wmark_pages(zone),
> -					ac_classzone_idx(ac), alloc_flags)) {
> +		/* The allocation should succeed, stop compacting */
> +		if (status == COMPACT_SUCCESS) {
>  			/*
>  			 * We think the allocation will succeed in this zone,
>  			 * but it is not certain, hence the false. The caller
> @@ -1873,8 +1872,6 @@ static void kcompactd_do_work(pg_data_t *pgdat)
>  		.ignore_skip_hint = true,
>  
>  	};
> -	bool success = false;
> -
>  	trace_mm_compaction_kcompactd_wake(pgdat->node_id, cc.order,
>  							cc.classzone_idx);
>  	count_vm_event(KCOMPACTD_WAKE);
> @@ -1903,9 +1900,7 @@ static void kcompactd_do_work(pg_data_t *pgdat)
>  			return;
>  		status = compact_zone(zone, &cc);
>  
> -		if (zone_watermark_ok(zone, cc.order, low_wmark_pages(zone),
> -						cc.classzone_idx, 0)) {
> -			success = true;
> +		if (status == COMPACT_SUCCESS) {
>  			compaction_defer_reset(zone, cc.order, false);
>  		} else if (status == COMPACT_PARTIAL_SKIPPED || status == COMPACT_COMPLETE) {
>  			/*
> -- 
> 2.9.2
> 
> --
> 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>

-- 
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:[~2016-08-18  9:03 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-10  9:12 [PATCH v6 00/11] make direct compaction more deterministic Vlastimil Babka
2016-08-10  9:12 ` [PATCH v6 01/11] mm, compaction: make whole_zone flag ignore cached scanner positions Vlastimil Babka
2016-08-10  9:12 ` [PATCH v6 02/11] mm, compaction: cleanup unused functions Vlastimil Babka
2016-08-10  9:12 ` [PATCH v6 03/11] mm, compaction: rename COMPACT_PARTIAL to COMPACT_SUCCESS Vlastimil Babka
2016-08-18  9:01   ` Michal Hocko
2016-08-10  9:12 ` [PATCH v6 04/11] mm, compaction: don't recheck watermarks after COMPACT_SUCCESS Vlastimil Babka
2016-08-16  6:12   ` Joonsoo Kim
2016-08-16  6:11     ` Vlastimil Babka
2016-08-18 11:59     ` Vlastimil Babka
2016-08-18  9:03   ` Michal Hocko [this message]
2016-08-10  9:12 ` [PATCH v6 05/11] mm, compaction: add the ultimate direct compaction priority Vlastimil Babka
2016-08-16  5:58   ` Joonsoo Kim
2016-08-18 12:23     ` Vlastimil Babka
2016-08-10  9:12 ` [PATCH v6 06/11] mm, compaction: more reliably increase " Vlastimil Babka
2016-08-16  6:07   ` Joonsoo Kim
2016-08-16  6:31     ` Vlastimil Babka
2016-08-18  9:10   ` Michal Hocko
2016-08-18  9:44     ` Vlastimil Babka
2016-08-18  9:48       ` Michal Hocko
2016-08-10  9:12 ` [PATCH v6 07/11] mm, compaction: use correct watermark when checking compaction success Vlastimil Babka
2016-08-10  9:12 ` [PATCH v6 08/11] mm, compaction: create compact_gap wrapper Vlastimil Babka
2016-08-16  6:15   ` Joonsoo Kim
2016-08-16  6:15     ` Vlastimil Babka
2016-08-16  6:41       ` Joonsoo Kim
2016-08-18 12:13         ` Vlastimil Babka
2016-08-10  9:12 ` [PATCH v6 09/11] mm, compaction: use proper alloc_flags in __compaction_suitable() Vlastimil Babka
2016-08-10  9:12 ` [PATCH v6 10/11] mm, compaction: require only min watermarks for non-costly orders Vlastimil Babka
2016-08-16  6:16   ` Joonsoo Kim
2016-08-16  6:36     ` Vlastimil Babka
2016-08-16  6:46       ` Joonsoo Kim
2016-08-18 12:20         ` Vlastimil Babka
2016-08-10  9:12 ` [PATCH v6 11/11] mm, vmscan: make compaction_ready() more accurate and readable 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=20160818090314.GE30162@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=riel@redhat.com \
    --cc=rientjes@google.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).