]> git.baikalelectronics.ru Git - kernel.git/commit
mm, compaction: fast_find_migrateblock() should return pfn in the target zone
authorRei Yamamoto <yamamoto.rei@jp.fujitsu.com>
Fri, 13 May 2022 23:48:57 +0000 (16:48 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 13 May 2022 23:48:57 +0000 (16:48 -0700)
commit9397af09bde8d0314af9ec3a377a67e8a5725232
treec119e9205c64f6a6f6c188f98e58ee78138a3da2
parente55697582444e8162cc2ca8ab58dd04f8552057f
mm, compaction: fast_find_migrateblock() should return pfn in the target zone

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
e2c39f25d6cbe734 ("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: 58e9c79542f5 ("mm, compaction: use free lists to quickly locate a migration source")
Signed-off-by: Rei Yamamoto <yamamoto.rei@jp.fujitsu.com>
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Cc: Don Dutile <ddutile@redhat.com>
Cc: Wonhyuk Yang <vvghjk1234@gmail.com>
Cc: Rei Yamamoto <yamamoto.rei@jp.fujitsu.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/compaction.c