The quilt patch titled Subject: mm: migrate: Fix THP's mapcount on isolation has been removed from the -mm tree. Its filename was mm-migrate-fix-thps-mapcount-on-isolation.patch This patch was dropped because an updated version will be merged ------------------------------------------------------ From: Gavin Shan <gshan@xxxxxxxxxx> Subject: mm: migrate: Fix THP's mapcount on isolation Date: Wed, 23 Nov 2022 08:57:52 +0800 The issue is reported when removing memory through virtio_mem device. The transparent huge page, experienced copy-on-write fault, is wrongly regarded as pinned. The transparent huge page is escaped from being isolated in isolate_migratepages_block(). The transparent huge page can't be migrated and the corresponding memory block can't be put into offline state. Fix it by replacing page_mapcount() with total_mapcount(). With this, the transparent huge page can be isolated and migrated, and the memory block can be put into offline state. Link: https://lkml.kernel.org/r/20221123005752.161003-1-gshan@xxxxxxxxxx Fixes: 3917c80280c9 ("thp: change CoW semantics for anon-THP") Signed-off-by: Gavin Shan <gshan@xxxxxxxxxx> Reported-by: Zhenyu Zhang <zhenyzha@xxxxxxxxxx> Suggested-by: David Hildenbrand <david@xxxxxxxxxx> Cc: David Hildenbrand <david@xxxxxxxxxx> Cc: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: William Kucharski <william.kucharski@xxxxxxxxxx> Cc: Zi Yan <ziy@xxxxxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx> [v5.8+] Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/compaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/compaction.c~mm-migrate-fix-thps-mapcount-on-isolation +++ a/mm/compaction.c @@ -990,7 +990,7 @@ isolate_migratepages_block(struct compac * admittedly racy check. */ mapping = page_mapping(page); - if (!mapping && page_count(page) > page_mapcount(page)) + if (!mapping && page_count(page) > total_mapcount(page)) goto isolate_fail; /* _ Patches currently in -mm which might be from gshan@xxxxxxxxxx are