FAILED: patch "[PATCH] mm/compaction.c: clear total_{migrate,free}_scanned before" failed to apply to 4.19-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From a94b525241c0fff3598809131d7cfcfe1d572d8c Mon Sep 17 00:00:00 2001
From: Yafang Shao <[email protected]>
Date: Mon, 23 Sep 2019 15:36:54 -0700
Subject: [PATCH] mm/compaction.c: clear total_{migrate,free}_scanned before
scanning a new zone
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.
mm/compaction.c +13 -22
@@ -2078,6 +2078,17 @@ compact_zone(struct compact_control *cc, struct capture_control *capc)const bool sync = cc->mode !=MIGRATE_ASYNC ;bool update_cached; +/* +* These counters track activities during zone compaction. Initialize +* them before compacting a new zone. +*/ + cc->total_migrate_scanned =0 ; + cc->total_free_scanned =0 ; + cc->nr_migratepages =0 ; + cc->nr_freepages =0 ; +INIT_LIST_HEAD (&cc->freepages); +INIT_LIST_HEAD (&cc->migratepages); + cc->migratetype =gfpflags_to_migratetype (cc->gfp_mask); ret =compaction_suitable (cc->zone, cc->order, cc->alloc_flags, cc->classzone_idx);
@@ -2281,10 +2292,6 @@ static enum compact_result compact_zone_order(struct zone *zone, int order, {enum compact_result ret;struct compact_control cc = { - .nr_freepages =0 , - .nr_migratepages =0 , - .total_migrate_scanned =0 , - .total_free_scanned =0 , .order = order, .search_order = order, .gfp_mask = gfp_mask,
@@ -2305,8 +2312,6 @@ static enum compact_result compact_zone_order(struct zone *zone, int order,if (capture) current->capture_control = &capc; -INIT_LIST_HEAD (&cc.freepages); -INIT_LIST_HEAD (&cc.migratepages); ret =compact_zone (&cc, &capc);
@@ -2408,8 +2413,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,
@@ -2423,11 +2426,7 @@ static void compact_node(int nid)if (!populated_zone (zone))continue ; - cc.nr_freepages =0 ; - cc.nr_migratepages =0 ; cc.zone = zone; -INIT_LIST_HEAD (&cc.freepages); -INIT_LIST_HEAD (&cc.migratepages);compact_zone (&cc,NULL );
@@ -2529,8 +2528,6 @@ static void kcompactd_do_work(pg_data_t *pgdat)struct compact_control cc = { .order = pgdat->kcompactd_max_order, .search_order = pgdat->kcompactd_max_order, - .total_migrate_scanned =0 , - .total_free_scanned =0 , .classzone_idx = pgdat->kcompactd_classzone_idx, .mode =MIGRATE_SYNC_LIGHT , .ignore_skip_hint = false,
@@ -2554,16 +2551,10 @@ static void kcompactd_do_work(pg_data_t *pgdat) COMPACT_CONTINUE)continue ; - 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); -if (kthread_should_stop ())return ; + + cc.zone = zone; status =compact_zone (&cc,NULL );if (status ==COMPACT_SUCCESS ) {
Sasha Levin
maintainerQuoted 33 lines · On Thu, Oct 03, 2019 at 01:38:46PM +0200, [email protected] wrote:
The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From
a94b525241c0fff3598809131d7cfcfe1d572d8cMon Sep 17 00:00:00 2001
From: Yafang Shao <[email protected]>
Date: Mon, 23 Sep 2019 15:36:54 -0700
Subject: [PATCH]mm/compaction.c: clear total_{migrate,free}_scanned before scanning a new zonetotal_{migrate,free}_scanned will be added to
COMPACTMIGRATE_SCANNEDandCOMPACTFREE_SCANNEDincompact_zone(). We should clear them before scanning a new zone. In the proc triggered compaction, we forgot clearing them.[[email protected]: introduce a helper compact_zone_counters_init()][[email protected]: expand compact_zone_counters_init() into its single callsite, per mhocko][[email protected]: squash compact_zone() list_head init as well][[email protected]: kcompactd_do_work(): avoid unnecessary initialization of cc.zone]Fixes 7f354a548d1c ("mm, compaction: add vmstats for kcompactd work")Signed-off-by Yafang Shao <[email protected]>Signed-off-by Vlastimil Babka <[email protected]>
Quoted 8 lines
Reviewed-by Vlastimil Babka <[email protected]>Cc David Rientjes <[email protected]>Cc Yafang Shao <[email protected]>Cc Mel Gorman <[email protected]>Cc Michal Hocko <[email protected]>Cc <[email protected]>Signed-off-by Andrew Morton <[email protected]>Signed-off-by Linus Torvalds <[email protected]>
This was mostly due to unrelated code cleanups. I've queued up a backport for 4.19 and 4.14, it's not needed on older kernels.
--
Thanks,
Sasha