From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58CC439B497 for ; Mon, 30 Mar 2026 19:44:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774899849; cv=none; b=s6RQqHJe3Wcebh+xm1adSdHeNWZxm5Mn8UfjOP83TaVgOhRNLrJJMnfjB4Ml5xU67HgarR/OXeAucZoRh3FxE5Mrf49CRthpVDGOYnlKHgwmuMUk9D722ykrXFzSPPTD28UIWxiHJMWIoobXc2OPYK/3SCB9TdI6Fa2zqefgK0c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774899849; c=relaxed/simple; bh=DBlXJDp7zz/4uuHUX4Lp+pWBYnJfbM/ZypsOqRoius0=; h=Date:To:From:Subject:Message-Id; b=rrSyT16//6q6Q8uVlKUo5ShCzmaLyVKDuLK55/Bun7FW6OZzJW8pkVaM+yuMnQ3OlmA5+lSgG9L14K6ycaW+wvIjrVja2fNckHA6J1qLWvrVvxd522vBHqhvC+ITrcXwBZBP3+hVpjLHSbKhH5JaklZIKtatQigQRfi3qoI9Cno= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=N9kodY1a; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="N9kodY1a" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FA71C4CEF7; Mon, 30 Mar 2026 19:44:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1774899849; bh=DBlXJDp7zz/4uuHUX4Lp+pWBYnJfbM/ZypsOqRoius0=; h=Date:To:From:Subject:From; b=N9kodY1a9bAbXfZ/OgICExcPvEhUp/0Seu7EC5CxHkS2YfWSUdV7OSXaiRQFALEug 3aj8FW+oFjJu/WP/CMGkz3DIMcNrdqkmbUrDYycU03MXhKmgFcPs2znKdrhYzZqVGY lA0+91lRuePpoO23o3ch8e356rELQgyiRKaHkwnU= Date: Mon, 30 Mar 2026 12:44:08 -0700 To: mm-commits@vger.kernel.org,rppt@kernel.org,akpm@linux-foundation.org From: Andrew Morton Subject: + userfaultfd-mfill_atomic-remove-retry-logic.patch added to mm-unstable branch Message-Id: <20260330194409.2FA71C4CEF7@smtp.kernel.org> Precedence: bulk X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The patch titled Subject: userfaultfd: mfill_atomic(): remove retry logic has been added to the -mm mm-unstable branch. Its filename is userfaultfd-mfill_atomic-remove-retry-logic.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/userfaultfd-mfill_atomic-remove-retry-logic.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: "Mike Rapoport (Microsoft)" Subject: userfaultfd: mfill_atomic(): remove retry logic Date: Mon, 30 Mar 2026 13:11:12 +0300 Since __mfill_atomic_pte() handles the retry for both anonymous and shmem, there is no need to retry copying the date from the userspace in the loop in mfill_atomic(). Drop the retry logic from mfill_atomic(). Link: https://lkml.kernel.org/r/20260330101116.1117699-12-rppt@kernel.org Signed-off-by: Mike Rapoport (Microsoft) Cc: Andrea Arcangeli Cc: Andrei Vagin Cc: Axel Rasmussen Cc: Baolin Wang Cc: David Hildenbrand (Arm) Cc: Harry Yoo Cc: Hugh Dickins Cc: James Houghton Cc: Liam Howlett Cc: Lorenzo Stoakes (Oracle) Cc: Matthew Wilcox (Oracle) Cc: Michal Hocko Cc: Muchun Song Cc: Nikita Kalyazin Cc: Oscar Salvador Cc: Paolo Bonzini Cc: Peter Xu Cc: Sean Christopherson Cc: Shuah Khan Cc: Suren Baghdasaryan Cc: Vlastimil Babka Signed-off-by: Andrew Morton --- mm/userfaultfd.c | 24 ------------------------ 1 file changed, 24 deletions(-) --- a/mm/userfaultfd.c~userfaultfd-mfill_atomic-remove-retry-logic +++ a/mm/userfaultfd.c @@ -29,7 +29,6 @@ struct mfill_state { struct vm_area_struct *vma; unsigned long src_addr; unsigned long dst_addr; - struct folio *folio; pmd_t *pmd; }; @@ -899,7 +898,6 @@ static __always_inline ssize_t mfill_ato VM_WARN_ON_ONCE(src_start + len <= src_start); VM_WARN_ON_ONCE(dst_start + len <= dst_start); -retry: err = mfill_get_vma(&state); if (err) goto out; @@ -926,26 +924,6 @@ retry: err = mfill_atomic_pte(&state); cond_resched(); - if (unlikely(err == -ENOENT)) { - void *kaddr; - - mfill_put_vma(&state); - VM_WARN_ON_ONCE(!state.folio); - - kaddr = kmap_local_folio(state.folio, 0); - err = copy_from_user(kaddr, - (const void __user *)state.src_addr, - PAGE_SIZE); - kunmap_local(kaddr); - if (unlikely(err)) { - err = -EFAULT; - goto out; - } - flush_dcache_folio(state.folio); - goto retry; - } else - VM_WARN_ON_ONCE(state.folio); - if (!err) { state.dst_addr += PAGE_SIZE; state.src_addr += PAGE_SIZE; @@ -960,8 +938,6 @@ retry: mfill_put_vma(&state); out: - if (state.folio) - folio_put(state.folio); VM_WARN_ON_ONCE(copied < 0); VM_WARN_ON_ONCE(err > 0); VM_WARN_ON_ONCE(!copied && !err); _ Patches currently in -mm which might be from rppt@kernel.org are userfaultfd-introduce-mfill_copy_folio_locked-helper.patch userfaultfd-introduce-struct-mfill_state.patch userfaultfd-introduce-mfill_establish_pmd-helper.patch userfaultfd-introduce-mfill_get_vma-and-mfill_put_vma.patch userfaultfd-retry-copying-with-locks-dropped-in-mfill_atomic_pte_copy.patch userfaultfd-move-vma_can_userfault-out-of-line.patch userfaultfd-introduce-vm_uffd_ops.patch shmem-userfaultfd-use-a-vma-callback-to-handle-uffdio_continue.patch userfaultfd-introduce-vm_uffd_ops-alloc_folio.patch shmem-userfaultfd-implement-shmem-uffd-operations-using-vm_uffd_ops.patch userfaultfd-mfill_atomic-remove-retry-logic.patch