* [PATCH] mm/compaction: clear total_{migrate,free}_scanned before scanning a new zone
@ 2019-07-22 9:54 Yafang Shao
2019-07-23 0:17 ` Andrew Morton
2019-07-23 5:36 ` Michal Hocko
0 siblings, 2 replies; 5+ messages in thread
From: Yafang Shao @ 2019-07-22 9:54 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, Yafang Shao, David Rientjes, Vlastimil Babka, Yafang Shao
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.
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] mm/compaction: clear total_{migrate,free}_scanned before scanning a new zone
2019-07-22 9:54 [PATCH] mm/compaction: clear total_{migrate,free}_scanned before scanning a new zone Yafang Shao
@ 2019-07-23 0:17 ` Andrew Morton
2019-07-23 6:59 ` Mel Gorman
2019-07-23 5:36 ` Michal Hocko
1 sibling, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2019-07-23 0:17 UTC (permalink / raw)
To: Yafang Shao
Cc: linux-mm, David Rientjes, Vlastimil Babka, Yafang Shao, Mel Gorman
On Mon, 22 Jul 2019 05:54:35 -0400 Yafang Shao <laoar.shao@gmail.com> 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.
It isn't the worst bug we've ever had, but I'm thinking we should
backport the fix into -stable kernels?
> --- 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);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm/compaction: clear total_{migrate,free}_scanned before scanning a new zone
2019-07-22 9:54 [PATCH] mm/compaction: clear total_{migrate,free}_scanned before scanning a new zone Yafang Shao
2019-07-23 0:17 ` Andrew Morton
@ 2019-07-23 5:36 ` Michal Hocko
2019-07-23 5:55 ` Yafang Shao
1 sibling, 1 reply; 5+ messages in thread
From: Michal Hocko @ 2019-07-23 5:36 UTC (permalink / raw)
To: Yafang Shao; +Cc: akpm, linux-mm, David Rientjes, Vlastimil Babka, Yafang Shao
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm/compaction: clear total_{migrate,free}_scanned before scanning a new zone
2019-07-23 5:36 ` Michal Hocko
@ 2019-07-23 5:55 ` Yafang Shao
0 siblings, 0 replies; 5+ messages in thread
From: Yafang Shao @ 2019-07-23 5:55 UTC (permalink / raw)
To: Michal Hocko
Cc: Andrew Morton, Linux MM, David Rientjes, Vlastimil Babka, Yafang Shao
On Tue, Jul 23, 2019 at 1:36 PM Michal Hocko <mhocko@suse.com> wrote:
>
> 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?
>
Seems that is better.
I will post an update.
Thanks
Yafang
> > 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm/compaction: clear total_{migrate,free}_scanned before scanning a new zone
2019-07-23 0:17 ` Andrew Morton
@ 2019-07-23 6:59 ` Mel Gorman
0 siblings, 0 replies; 5+ messages in thread
From: Mel Gorman @ 2019-07-23 6:59 UTC (permalink / raw)
To: Andrew Morton
Cc: Yafang Shao, linux-mm, David Rientjes, Vlastimil Babka, Yafang Shao
On Mon, Jul 22, 2019 at 05:17:00PM -0700, Andrew Morton wrote:
> On Mon, 22 Jul 2019 05:54:35 -0400 Yafang Shao <laoar.shao@gmail.com> 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.
>
> It isn't the worst bug we've ever had, but I'm thinking we should
> backport the fix into -stable kernels?
>
There is no harm in having it in -stable. It may matter for those trying
to debug excessive compaction activity and getting misleading stats.
--
Mel Gorman
SUSE Labs
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-07-23 7:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-22 9:54 [PATCH] mm/compaction: clear total_{migrate,free}_scanned before scanning a new zone Yafang Shao
2019-07-23 0:17 ` Andrew Morton
2019-07-23 6:59 ` Mel Gorman
2019-07-23 5:36 ` Michal Hocko
2019-07-23 5:55 ` Yafang Shao
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.