Re: [PATCH v2 08/13] mm/migrate_device: fix ksmd oops on a migrated KSM page
From: David Hildenbrand (Arm)
Date: Wed Nov 18 2026 - 10:33:20 EST
On 11/13/26 22:45, Lorenzo Stoakes (ARM) wrote:
> From: Chris Mason <mason@xxxxxxxxxx>
>
> After a KSM page is migrated to device private memory, ksmd can oops,
> and KSM then stops until reboot. A process that maps the page can also
> loop in page faults when it next accesses the page.
>
> The problem arises because KSM doesn't know not to try to look at device
> private memory that does not exist in the direct map.
>
> In addition, ksmd skips all device pages when it scans, so it drops its
> rmap of a KSM page which was migrated to device private or device
> coherent memory.
>
> Disallow migrating a KSM page to either by explicitly testing for this
> in __migrate_device_pages().
>
> Fixes: a5430dda8a3a ("mm/migrate: support un-addressable ZONE_DEVICE page in migration")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Chris Mason <mason@xxxxxxxxxx>
> [ ljs: tweak commit message, comment, also refuse device coherent ]
> Tested-by: Gregory Price (Meta) <gourry@xxxxxxxxxx>
> Acked-by: Balbir Singh <balbirs@xxxxxxxxxx>
> Reviewed-by: Alistair Popple <apopple@xxxxxxxxxx>
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>
> ---
Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
--
Cheers,
David