linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.com>
To: Yafang Shao <laoar.shao@gmail.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
	David Rientjes <rientjes@google.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	Yafang Shao <shaoyafang@didiglobal.com>
Subject: Re: [PATCH] mm/compaction: clear total_{migrate,free}_scanned before scanning a new zone
Date: Tue, 23 Jul 2019 07:36:45 +0200	[thread overview]
Message-ID: <20190723053645.GA4656@dhcp22.suse.cz> (raw)
In-Reply-To: <1563789275-9639-1-git-send-email-laoar.shao@gmail.com>

On Mon 22-07-19 05:54:35, Yafang Shao wrote:
> total_{migrate,free}_scanned will be added to COMPACTMIGRATE_SCANNED and
> COMPACTFREE_SCANNED in compact_zone(). We should clear them before scanning
> a new zone.
> In the proc triggered compaction, we forgot clearing them.

Wouldn't it be more robust to move zeroying to compact_zone so that none
of the three current callers has to duplicate (and forget) to do that?

> Fixes: 7f354a548d1c ("mm, compaction: add vmstats for kcompactd work")
> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> Cc: David Rientjes <rientjes@google.com>
> Cc: Vlastimil Babka <vbabka@suse.cz>
> Cc: Yafang Shao <shaoyafang@didiglobal.com>
> ---
>  mm/compaction.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/compaction.c b/mm/compaction.c
> index 9e1b9ac..a109b45 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -2405,8 +2405,6 @@ static void compact_node(int nid)
>  	struct zone *zone;
>  	struct compact_control cc = {
>  		.order = -1,
> -		.total_migrate_scanned = 0,
> -		.total_free_scanned = 0,
>  		.mode = MIGRATE_SYNC,
>  		.ignore_skip_hint = true,
>  		.whole_zone = true,
> @@ -2422,6 +2420,8 @@ static void compact_node(int nid)
>  
>  		cc.nr_freepages = 0;
>  		cc.nr_migratepages = 0;
> +		cc.total_migrate_scanned = 0;
> +		cc.total_free_scanned = 0;
>  		cc.zone = zone;
>  		INIT_LIST_HEAD(&cc.freepages);
>  		INIT_LIST_HEAD(&cc.migratepages);
> -- 
> 1.8.3.1

-- 
Michal Hocko
SUSE Labs


  parent reply	other threads:[~2019-07-23  5:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-22  9:54 Yafang Shao
2019-07-23  0:17 ` Andrew Morton
2019-07-23  6:59   ` Mel Gorman
2019-07-23  5:36 ` Michal Hocko [this message]
2019-07-23  5:55   ` Yafang Shao

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=20190723053645.GA4656@dhcp22.suse.cz \
    --to=mhocko@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=laoar.shao@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    --cc=shaoyafang@didiglobal.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