On Wed, Sep 23, 2026 at 12:18:30PM +0100, Kiryl Shutsemau wrote:
> Putting it in the 'else' is wrong. Clear uffd on the source
> unconditionally and re-arm based on the target VMA:
>
>       orig_src_pte = pte_swp_clear_uffd(orig_src_pte);
>       /* Re-arm RWP on the moved swap entry if dst_vma is RWP-registered. */
>       if (userfaultfd_rwp(dst_vma))
>               orig_src_pte = pte_swp_mkuffd(orig_src_pte);
>
> That is what move_pages_huge_pmd() does with clear_uffd_wp_pmd() before
> its own re-arm, and it is the logically correct way to do this: the
> source's state is gone, the destination decides.

Done in v2:
https://lore.kernel.org/all/[email protected]/

Thanks,
Donggeun

Reply via email to