Re: [PATCH] mm: fix up softleaf vs thp device-private in remove_migration_pmd()

From: Balbir Singh

Date: Thu Nov 13 2025 - 20:26:02 EST


On 11/14/25 12:21, Balbir Singh wrote:
> A fix-up in the thp device-private patch
> mm/rmap: extend rmap and migration support device-private entries
> introduces conflicts with the softleaf series, this is a fix up patch
> to resolve the issue
>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: David Hildenbrand <david@xxxxxxxxxx>
> Cc: Zi Yan <ziy@xxxxxxxxxx>
> Cc: Joshua Hahn <joshua.hahnjy@xxxxxxxxx>
> Cc: Rakie Kim <rakie.kim@xxxxxx>
> Cc: Byungchul Park <byungchul@xxxxxx>
> Cc: Gregory Price <gourry@xxxxxxxxxx>
> Cc: Ying Huang <ying.huang@xxxxxxxxxxxxxxxxx>
> Cc: Alistair Popple <apopple@xxxxxxxxxx>
> Cc: Oscar Salvador <osalvador@xxxxxxx>
> Cc: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
> Cc: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>
> Cc: "Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>
> Cc: Nico Pache <npache@xxxxxxxxxx>
> Cc: Ryan Roberts <ryan.roberts@xxxxxxx>
> Cc: Dev Jain <dev.jain@xxxxxxx>
> Cc: Barry Song <baohua@xxxxxxxxxx>
> Cc: Lyude Paul <lyude@xxxxxxxxxx>
> Cc: Danilo Krummrich <dakr@xxxxxxxxxx>
> Cc: David Airlie <airlied@xxxxxxxxx>
> Cc: Simona Vetter <simona@xxxxxxxx>
> Cc: Ralph Campbell <rcampbell@xxxxxxxxxx>
> Cc: Mika Penttilä <mpenttil@xxxxxxxxxx>
> Cc: Matthew Brost <matthew.brost@xxxxxxxxx>
> Cc: Francois Dugast <francois.dugast@xxxxxxxxx>
>
> Signed-off-by: Balbir Singh <balbirs@xxxxxxxxxx>
> ---
> mm/huge_memory.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 3a8f0c4143c5..4d65c51bc0fe 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -4760,7 +4760,7 @@ void remove_migration_pmd(struct page_vma_mapped_walk *pvmw, struct page *new)
> folio_get(folio);
> pmde = folio_mk_pmd(folio, READ_ONCE(vma->vm_page_prot));
>
> - if (is_writable_migration_entry(entry))
> + if (softleaf_is_migration_write(entry))
> pmde = pmd_mkwrite(pmde, vma);
>
> if (folio_is_device_private(folio)) {
> @@ -4777,8 +4777,6 @@ void remove_migration_pmd(struct page_vma_mapped_walk *pvmw, struct page *new)
>
> if (pmd_swp_soft_dirty(*pvmw->pmd))
> pmde = pmd_mksoft_dirty(pmde);
> - if (softleaf_is_migration_write(entry))
> - pmde = pmd_mkwrite(pmde, vma);
> if (pmd_swp_uffd_wp(*pvmw->pmd))
> pmde = pmd_mkuffd_wp(pmde);
> if (!softleaf_is_migration_young(entry))

Hi, Andrew

This is the fixup for the rebase issue that might occur after applying
the previous patch to fixup mm/rmap: extend rmap and migration support device-private entries.
I've not done fixs up rebases as a separate patch, but I resolved the conflict
in favour of the existing patch and applied this on top of the series.

Balbir