Re: [PATCH] mm/compaction: clear total_{migrate,free}_scanned before scanning a new zone

Andrew Morton
2019-07-23T00:17:04Z

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