Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796324399; b=33dBq5gujwBM4mFx/IUdJZ2ketoyvn4KbGjMigG3M9xBRMLHdjmZaqFRUnWxfgzwJ8Fo k+zjZf1u1yQOrLtrFhKeVDV/cBNOm8oQuZyRsGdyOyMhwgzKttmGQ5ofUdHZzAitoyyMR +Zr2OpTyuYhFZldE/CgOS2JzEB0G7t219mJcq/qjMyYJMCnFOpWfsBA2xjm8/T4jBGcZm L+/8pcnNxEQzVjHeJ8we9B4+4VEqFcLMmHD8cZMNcPpLmBLllkY/6VFWkBK2LFvcX69Jd cVPp7X+UwL8VuHXN1M1XliLAJGr7AMMC963ytAa4xwZLUp93EK0orms4RZIp8D1+AfQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796324399; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=cQz1zz0llCNxKtDHGDJA4i3B0T3uMhFhFnq9FoiwRIQ=; b=Nqh3H14QQjwuS6g7dTqqW16hKvRW6dBILn8cIVNJV6gmcbhEEy6/ZcSDrAt6K77oaFSv 6l1vyyRWt1AmDWyq1Yrp5m2amQHQ/ORVkX5CLLz7nSMgNHqp1Kf6wYO46sojTkCTZ0ZX3 x93uvl6uSuQOIXKRoQkOwHTLEo8KwiSNbmoINmMj7mNk5S74IWDIWOyvU3RpH74OnrrAD mvRhBm/ZVYxrrH2Xc76MQxWCukgap9+D1f7U6XNpJSdAn24pg78IZtJ/3OsUOUsSAPebL KKy4WupdS6z0HaFykx2cFH5boxUJEViDewXFMDbq4N1I8YVh57mr+uI9SbeNIzLsnDg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=Et4LvoO6; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B52A606A330 for ; Thu, 3 Dec 2026 18:59:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=Et4LvoO6 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 361BA1F00893; Thu, 3 Dec 2026 18:59:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796324399; bh=cQz1zz0llCNxKtDHGDJA4i3B0T3uMhFhFnq9FoiwRIQ=; h=Date:To:From:In-Reply-To:References:Subject; b=Et4LvoO6B8qHXxpuVybtYSAqwfzZsC8i9ijHHapIIAIUJiSSiCxPNXbBZZf+Nf6XO NNtbQtCEVCw1uy4OlvpvBjr5raNQ2EKLN/AI6SbSyFjYiJQAJihuGwb9BLgu8eQZeP tqc3yaoEg+wJpwL2Qj0p3/Av5FgGdROLfHAz/Ypk= Date: Thu, 03 Dec 2026 10:59:58 -0800 To: mm-commits@vger.kernel.org,mason@kernel.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20261125-hugetlb_fixes_2-v1-9-db27fd2f71a8@kernel.org> References: <20261125-hugetlb_fixes_2-v1-9-db27fd2f71a8@kernel.org> Subject: [to-be-updated] mm-hugetlb-dont-zap-non-present-entries-when-unmapping-a-folio.patch removed from -mm tree Message-Id: <20261203185959.361BA1F00893@smtp.kernel.org> X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list The quilt patch titled Subject: mm/hugetlb: don't zap non-present entries when unmapping a folio has been removed from the -mm tree. Its filename was mm-hugetlb-dont-zap-non-present-entries-when-unmapping-a-folio.patch This patch was dropped because an updated version will be issued ------------------------------------------------------ From: Chris Mason Subject: mm/hugetlb: don't zap non-present entries when unmapping a folio Date: Wed, 25 Nov 2026 23:33:07 +0100 When the owner of a private hugetlb mapping fails to allocate a folio for COW, unmap_ref_private() unmaps the old folio from the forked children, and marks them with HPAGE_RESV_UNMAPPED, so they get a SIGBUS on their next access. hugetlb_unmap_range() is supposed to only unmap that folio, but it clears non-present page table entries unconditionally. A child can silently lose its COWed folio while it is getting migrated, or a hwpoison entry or uffd poison marker, without HPAGE_RESV_UNMAPPED getting set. Consequently, it would not SIGBUS on the next access. Let's fix it by ignoring non-present entries when unmapping a folio. As the folio is locked, migration entries of that folio do not apply. This has low urgency, as it requires a failing COW allocation in the owner racing with migration or memory failure in the child. Let's not CC stable. [david@kernel.org: adjust comment and description] Link: https://patch.msgid.link/20261125-hugetlb_fixes_2-v1-9-db27fd2f71a8@kernel.org Fixes: 8c4894c6bc79 ("hwpoison, hugetlbfs: fix "bad pmd" warning in unmapping hwpoisoned hugepage") Signed-off-by: Chris Mason Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Andrew Morton Reviewed-by: Muchun Song (ByteDance) Cc: Oscar Salvador Cc: Jinmeng Zhou Cc: Hongfu Li Cc: Andrea Arcangeli Cc: Naoya Horiguchi Cc: Hugh Dickins Cc: Baolin Wang Cc: Dave Airlie Cc: Vivek Kasireddy Cc: Gerd Hoffmann Cc: Mike Rapoport Cc: Mel Gorman Cc: Dave McCracken Cc: Andy Whitcroft Cc: Adam Litke Cc: Lorenzo Stoakes Cc: Rik van Riel Cc: Liam R. Howlett Cc: Vlastimil Babka Cc: Harry Yoo Cc: Jann Horn Cc: Lance Yang Cc: James Houghton Cc: Yang Shi Cc: Suren Baghdasaryan Cc: Shakeel Butt Cc: Pedro Falcato Cc: Gregory Price Cc: Zi Yan Cc: Joshua Hahn Cc: Rakie Kim Cc: Ying Huang Cc: Matthew Brost Cc: Byungchul Park Cc: Alistair Popple Cc: Wanpeng Li Cc: Andi Kleen Cc: Kenneth W Chen Cc: Michal Hocko Cc: David Rientjes Cc: Joern Engel Cc: Jonathan Corbet Cc: Shuah Khan Cc: Randy Dunlap Cc: Aneesh Kumar K.V Cc: KAMEZAWA Hiroyuki Cc: Kiryl Shutsemau Cc: Sasha Levin Cc: Guillaume Morin Cc: Jason Gunthorpe Cc: luojiajun Cc: Josef Bacik Cc: Daehyeon Ko <4ncienth@gmail.com> Cc: Ackerley Tng Cc: Jiaqi Yan mm/hugetlb.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/mm/hugetlb.c~mm-hugetlb-dont-zap-non-present-entries-when-unmapping-a-folio +++ a/mm/hugetlb.c @@ -5435,6 +5435,14 @@ static void hugetlb_unmap_range(struct m */ if (unlikely(!pte_present(pte))) { /* + * If we have a folio provided, we only care about + * present page table entries (folio is locked). + */ + if (folio_provided) { + spin_unlock(ptl); + continue; + } + /* * If the pte was wr-protected by uffd-wp in any of the * swap forms, meanwhile the caller does not want to * drop the uffd-wp bit in this zap, then replace the _ Patches currently in -mm which might be from mason@kernel.org are mm-swap-fix-large-swap-in-across-swap-file-extents.patch hugetlbfs-do-not-grow-a-sealed-file-in-mmap.patch mm-hugetlb-keep-surplus-folios-that-are-reserved.patch mm-hugetlb-fix-reservation-leak-on-min_size=-mounts.patch mm-cachestat-count-each-page-only-once.patch mm-cachestat-restart-the-walk-after-each-entry.patch percpu-queue-the-balance-work-on-an-unbound-workqueue.patch mm-vma-fix-uncharge-after-failed-stack-relocation.patch mm-mremap-apply-the-mmap-offset-limits-on-expansion.patch mm-mremap-respect-guard-gaps-on-in-place-expansion.patch mm-vma-make-brk-mappings-non-executable-under-mdwe.patch kfence-use-a-nofault-store-to-zero-the-guard-page.patch mm-filemap-update-the-folio-order-range-atomically.patch mm-userfaultfd-account-memory-allocated-for-unmap-events.patch mm-userfaultfd-drop-fork-context-reference-outside-event_wqhlock.patch mm-madvise-dont-declare-oom-for-madv_willneed-swapin.patch mm-mprotect-fix-unpaired-notifier-start-at-address-0.patch mm-hmm-refuse-secretmem-vmas-in-hmm_range_fault.patch mm-mglru-count-all-generations-as-evictable.patch mm-mglru-test-pg_lru-before-taking-a-folio-reference.patch mm-mglru-report-root-reclaim-to-memorypressure_level.patch mm-hugetlb-unshare-pmds-of-a-split-vma-if-allocating-its-lock-fails.patch mm-hugetlb_cgroup-track-in-use-folios-per-cgroup.patch hugetlbfs-seal-shm_hugetlb-files-against-growth.patch mm-hugetlb-resolve-protnone-faults-without-a-uffd-bit.patch a.patch