[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220607165008.451118873@linuxfoundation.org>
Date: Tue, 7 Jun 2022 19:04:10 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Rei Yamamoto <yamamoto.rei@...fujitsu.com>,
Miaohe Lin <linmiaohe@...wei.com>,
Mel Gorman <mgorman@...hsingularity.net>,
Oscar Salvador <osalvador@...e.de>,
Don Dutile <ddutile@...hat.com>,
Wonhyuk Yang <vvghjk1234@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: [PATCH 5.17 658/772] mm, compaction: fast_find_migrateblock() should return pfn in the target zone
From: Rei Yamamoto <yamamoto.rei@...fujitsu.com>
commit bbe832b9db2e1ad21522f8f0bf02775fff8a0e0e upstream.
At present, pages not in the target zone are added to cc->migratepages
list in isolate_migratepages_block(). As a result, pages may migrate
between nodes unintentionally.
This would be a serious problem for older kernels without commit
a984226f457f849e ("mm: memcontrol: remove the pgdata parameter of
mem_cgroup_page_lruvec"), because it can corrupt the lru list by
handling pages in list without holding proper lru_lock.
Avoid returning a pfn outside the target zone in the case that it is
not aligned with a pageblock boundary. Otherwise
isolate_migratepages_block() will handle pages not in the target zone.
Link: https://lkml.kernel.org/r/20220511044300.4069-1-yamamoto.rei@jp.fujitsu.com
Fixes: 70b44595eafe ("mm, compaction: use free lists to quickly locate a migration source")
Signed-off-by: Rei Yamamoto <yamamoto.rei@...fujitsu.com>
Reviewed-by: Miaohe Lin <linmiaohe@...wei.com>
Acked-by: Mel Gorman <mgorman@...hsingularity.net>
Reviewed-by: Oscar Salvador <osalvador@...e.de>
Cc: Don Dutile <ddutile@...hat.com>
Cc: Wonhyuk Yang <vvghjk1234@...il.com>
Cc: Rei Yamamoto <yamamoto.rei@...fujitsu.com>
Cc: <stable@...r.kernel.org>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
mm/compaction.c | 2 ++
1 file changed, 2 insertions(+)
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1821,6 +1821,8 @@ static unsigned long fast_find_migratebl
update_fast_start_pfn(cc, free_pfn);
pfn = pageblock_start_pfn(free_pfn);
+ if (pfn < cc->zone->zone_start_pfn)
+ pfn = cc->zone->zone_start_pfn;
cc->fast_search_fail = 0;
found_block = true;
set_pageblock_skip(freepage);
Powered by blists - more mailing lists