]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/memory_hotplug: make HWPoisoned dirty swapcache pages unmovable
authorMiaohe Lin <linmiaohe@huawei.com>
Mon, 23 Aug 2021 23:59:43 +0000 (09:59 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 25 Aug 2021 23:34:26 +0000 (09:34 +1000)
HWPoisoned dirty swapcache pages are kept for killing owner processes.  We
should not offline these pages or do_swap_page() would access the offline
pages and lead to bad ending.

Link: https://lkml.kernel.org/r/20210821094246.10149-4-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Cc: Chris Goldsworthy <cgoldswo@codeaurora.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Naoya Horiguchi <naoya.horiguchi@nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
mm/memory_hotplug.c

index 9fd0be32a281e238cb17061690435777f40fe3d9..0488eed3327c0a288ae4b5b036a7c18971d4a8ba 100644 (file)
@@ -1664,6 +1664,12 @@ static int scan_movable_pages(unsigned long start, unsigned long end,
                 */
                if (PageOffline(page) && page_count(page))
                        return -EBUSY;
+               /*
+                * HWPoisoned dirty swapcache pages are definitely unmovable
+                * because they are kept for killing owner processes.
+                */
+               if (PageHWPoison(page) && PageSwapCache(page))
+                       return -EBUSY;
 
                if (!PageHuge(page))
                        continue;