The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: "Mike Rapoport (Microsoft)" <rppt@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Xu <peterx@redhat.com>,
	Suren Baghdasaryan <surenb@google.com>,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-mm@kvack.org
Subject: Re: [PATCH 3/4] userfaultfd: mark THPs moved by UFFDIO_MOVE soft-dirty
Date: Thu, 3 Dec 2026 16:27:03 +0100	[thread overview]
Message-ID: <6d5eafe9-2abb-4473-b487-0b0a2ce2f619@kernel.org> (raw)
In-Reply-To: <20261202-fixes-uffd-sashiko-v1-3-a6f5a874334a@kernel.org>

On 12/2/26 19:20, Mike Rapoport (Microsoft) wrote:
> UFFDIO_MOVE marks moved PTEs and a moved huge zero page soft-dirty, like
> mremap() does.
> 
> A THP is the exception. move_pages_huge_pmd() creates the destination PMD
> from scratch and does not mark it soft-dirty, so soft-dirty trackers such
> as CRIU miss the move.
> 
> Mark the moved THP PMD soft-dirty with move_soft_dirty_pmd(), like
> mremap() does for PMDs.
> 
> Fixes: adef440691ba ("userfaultfd: UFFDIO_MOVE uABI")
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> ---
>  mm/huge_memory.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index d065b26a94dfa..f0cb8b0e469f4 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -3014,6 +3014,7 @@ int move_pages_huge_pmd(struct mm_struct *mm, pmd_t *dst_pmd, pmd_t *src_pmd, pm
>  		_dst_pmd = folio_mk_pmd(src_folio, dst_vma->vm_page_prot);
>  		/* Follow mremap() behavior and treat the entry dirty after the move */
>  		_dst_pmd = pmd_mkwrite(pmd_mkdirty(_dst_pmd), dst_vma);
> +		_dst_pmd = move_soft_dirty_pmd(_dst_pmd);

Reviewed-by: David Hildenbrand (Arm) <david@kernel.org>

-- 
Cheers,

David

  reply	other threads:[~2026-12-03 15:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 18:20 [PATCH 0/4] userfaultfd: fixes for sashiko reports Mike Rapoport (Microsoft)
2026-12-02 18:20 ` [PATCH 1/4] userfaultfd: write-lock the VMA before clearing its uffd state Mike Rapoport (Microsoft)
2026-12-02 20:08   ` Suren Baghdasaryan
2026-12-02 18:20 ` [PATCH 2/4] userfaultfd: mark zero pages moved by UFFDIO_MOVE soft-dirty Mike Rapoport (Microsoft)
2026-12-03 15:24   ` David Hildenbrand (Arm)
2026-12-02 18:20 ` [PATCH 3/4] userfaultfd: mark THPs " Mike Rapoport (Microsoft)
2026-12-03 15:27   ` David Hildenbrand (Arm) [this message]
2026-12-02 18:20 ` [PATCH 4/4] selftests/mm: free the test context when uffd_test_ctx_init() fails Mike Rapoport (Microsoft)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6d5eafe9-2abb-4473-b487-0b0a2ce2f619@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=peterx@redhat.com \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox