From mboxrd@z Thu Jan 1 00:00:00 1970 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=1796297869; b=w+d3sdPXrs3nwykXD+2v4Pevc8fS2sSyhhh4OD1q6OjrZ20sgdRFo/dVIxNJhph2gdAj mGfR5rbAaTNY6hCuH82s+T9SE2o0P4IXmeyjLs/fiWBLakuSoJ9DD6nO4szY2lkfHETKh nveDVmvc4Un6oVOBZB2wviysySmzVWPyYv+2zYtLgAQivAq12CcRJqwVWgdrHdgdy46Hz Fl8WWgCWx4UhbQfduTX+4TeNFQl5gpTYXOQop9LSuoB4FUPP/Q4i5OEO7yOCGRJ9aOLHc sggN3Gb78FgHi5SJpxAOhj1Mwctaoj15MjqES/LGbYT150LmiqQm+K3YaKTxKu4v44Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796297869; h=Received:DKIM-Signature:From:Subject:Date:Message-Id:MIME-Version: Content-Type:Content-Transfer-Encoding:X-B4-Tracking:X-Change-ID:To: Cc:X-Mailer:X-Developer-Signature:X-Developer-Key; bh=hi8kyZfs/dUNENWDIhj5/mayjF9Z6YKqcD5EBJcLNVI=; b=uR2tXi76Za8j0v1KeYs68LspJep59EMov2yinunA0d3182SwJc6zQOpp0dmuswFXeGm6 zMBm+uOpB4l730ilhqTQ6n8Gem6GTEDAFgjQpOBUw4croR2TLz3VHwd+oKFvAYhi6jvaz RjmsqUvCe6Kout6RVZK5m1ZiEQ6VnELkEQZiRmsr+kGxAUf11Zw6JtORx4etLLco0rSot aiMGnUlEyvd4Jb6k4d9E8dQAVe/Rucfi8m8zi6q+Q28l5jkkMouVR2w4yHsNYSoywUsjB WGQPiV7DhToo8x7uykxUoP6oHCGv+bLTTYnrYIgDPcqxuX6f0T0aZO5Uffk4lHg4Jew== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Uwn0izVE; 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 92E00606A322; Thu, 3 Dec 2026 11:37:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Uwn0izVE Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EC6B1F00893; Thu, 3 Dec 2026 11:37:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796297869; bh=hi8kyZfs/dUNENWDIhj5/mayjF9Z6YKqcD5EBJcLNVI=; h=From:Subject:Date:To:Cc; b=Uwn0izVEUlPZtj5Qzyu9nd2Qwk7j0SJCWsVnTniNAyDnhVOcaYEFW9+fw9yzL8sA+ Qz+Tel68vxfMigwL4xeiSbRPsYrHcf3Yf3P77I56R446ZxJ41o3QEoHp08abCoG51g sD4J/MQ3cWEtzJToh3fnIJib0U3AWO3uYuWrevsW2WTeDtjRUAVE+Ggm2XFxiis0YU 6MJLITlHQjh5lckreSaUu+stWysWuzm7gUk6M+oU7Jz5noc4h7k7XH6R0+ypBRY5DA WBuhb8rX1HA8J+IW861JvOKdoeiYCV7Ca9o8987T1422hnQ/9D4Aa1GLHvi+Pr2it8 zIr7/7OWq/xOg== From: "David Hildenbrand (Arm)" Subject: [PATCH v2 00/35] mm/hugetlb: various fixes (2) Date: Thu, 03 Dec 2026 12:37:23 +0100 Message-Id: <20261203-hugetlb_fixes_2-v2-0-9bbeabb555d2@kernel.org> X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAAAAAAAA/2WNywqDMBBFfyXM2hQzGJWs+h9FxMfEpBVTEpUWy b+XWLrq8nIO5x4QyFsKoNgBnnYbrFtAMcwYDKZbJuJ2BMUAcyyFwJybbaJ17lttXxRa5FgWUg6 yLnRBkDF4ejoRKHZrvjts/Z2GNWWSYWxYnX+fl7tI3q8u/+q74Dkfe6z0iLoSXX19kF9ovjg/Q RNj/ACg0F/wwQAAAA== X-Change-ID: 20261120-hugetlb_fixes_2-26455c584f4e To: Muchun Song , Oscar Salvador , Andrew Morton , Hongfu Li , Jinmeng Zhou , Mina Almasry , Davidlohr Bueso , Naoya Horiguchi , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Michal Hocko , Jonathan Corbet , Shuah Khan , Randy Dunlap , Vivek Kasireddy , Mel Gorman , Hugh Dickins , Baolin Wang , Dave Airlie , Jason Gunthorpe , Andy Whitcroft , Roman Gushchin , Barry Song , Andrea Arcangeli , Lorenzo Stoakes , Suren Baghdasaryan , Shakeel Butt , Pedro Falcato , Jann Horn , Guillaume Morin , Yang Shi , James Houghton , Rik van Riel , Harry Yoo , Lance Yang , Axel Rasmussen , Peter Xu , Sasha Levin , Kiryl Shutsemau , Christian Brauner , "Steven Rostedt (Google)" , Hongbo Li , Gregory Price , Zi Yan , Joshua Hahn , Rakie Kim , Ying Huang , Matthew Brost , Byungchul Park , Alistair Popple , Andi Kleen , David Rientjes , Joern Engel , "Aneesh Kumar K.V" Cc: linux-mm@kvack.org, linux-doc@vger.kernel.org, Gerd Hoffmann , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Johannes Weiner , Chris Mason , Jiaqi Yan , "David Hildenbrand (Arm)" , Sashiko , stable@vger.kernel.org X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=8621; i=david@kernel.org; h=from:subject:message-id; bh=fXpciEDSYQ3SScQxH3pCGmXMwLjFGQu5GhPPBLPgz/Q=; b=owGbwMvMwCF2/OVpCdfQ3ZWMp9WSGLIFQyqeTntZZ5HWFNe1xOVQxATjK8WzvRN73N6wym+MP CW1eeqqjlIWBjEOBlkxRZag4PsGL1+uq61242OGmcPKBDKEgYtTACbSG8PwP7Rtya2NcRen3rJr Fw724Zybt/HEN7U/9drRh3z9zdc+e83IsH9+aKAUU7BIm+udBxPispk6auvipQ3PVR3cHs3G6CL ADgA= X-Developer-Key: i=david@kernel.org; a=openpgp; fpr=1BD9CAAD735C4C3A460DFCCA4DDE10F700FF835A Hi, this is v2 with a bunch more fixes, which I didn't want to send separately to not cause a mess on the list. Most of the new ones are from Sashiko reports, and some found while working on them. Chris reported two more. This is likely the last hugetlb fixes series I'll be sending; I'll delegate from now on :) I was able to reproduce and test most of them. Based on the same base as v1. - Patch #1: hotfix for v7.4 (already in mm-hotfixes-stable) - Patch #2 - #6: reservation handling fixes - Patch #7 - #11: folio allocation and freeing fixes - Patch #12 - #13: userfaultfd and soft-dirty fixes - Patch #14 - #25: truncation, hole punching, fallocate() and inode fixes - Patch #26 - #30: PMD table sharing and VMA lock fixes - Patch #31 - #33: accounting fixes - Patch #34: a hugetlb cgroup fix - Patch #35: a cleanup / hardening patch I un-RFCed #34 and dropped the controversial VMA-lock optimization fix. Nothing here is urgent. A lot are low-priority issues, but we might just fix them in bulk instead of getting random fixes for these things upstream. --- Changes in v2: - Collected tags (thanks!). - Dropped "mm/hugetlb: use the VMA lock to stabilize flags for PMD sharing". - "mm/hugetlb_cgroup: charge faults to mm->owner" - Dropped the RFC label. - Fall back to current->mm like memcg, and also charge reservations to the mm of the VMA. - Minor patch description fixups. - Added new fixes: - "mm/hugetlb: restore the reservation if vma_needs_reservation() fails" - "mm/hugetlb: restore the reservation when racing with another reservation" - "mm/hugetlb: return the reservation to the subpool on error" - "mm/hugetlb: report reservations that we actually added from hugetlb_reserve_pages()" - "mm/hugetlb: keep HPAGE_RESV_UNMAPPED when forking" - "mm/hugetlb: wait for deferred frees before failing an allocation" - "mm/hugetlb_cma: reset hugetlb_cma_size if the arch doesn't support it" - "hugetlbfs: fix integer overflow when punching holes" - "hugetlbfs: don't overflow the pseudo VMA address in fallocate()" - "hugetlbfs: don't overflow the end of the unmap range on 32-bit" - "hugetlbfs: don't skip private VMAs when unmapping on truncation" - "mm/hugetlb: serialize private faults with truncation" - "mm/hugetlb: check EOF for UFFDIO_COPY and UFFDIO_POISON" - "hugetlbfs: zero all hugetlbfs-specific fields of new inodes" - "mm/rmap: don't fail unmapping hugetlb folios from private VMAs" - Reordered the patches by topic. - Link to v1: https://patch.msgid.link/20261125-hugetlb_fixes_2-v1-0-db27fd2f71a8@kernel.org To: Muchun Song To: Oscar Salvador To: Andrew Morton To: Hongfu Li To: Jinmeng Zhou To: Mina Almasry To: Davidlohr Bueso To: Naoya Horiguchi To: "Liam R. Howlett" To: Vlastimil Babka To: Mike Rapoport To: Michal Hocko To: Jonathan Corbet To: Shuah Khan To: Randy Dunlap To: Vivek Kasireddy To: Mel Gorman To: Hugh Dickins To: Baolin Wang To: Dave Airlie To: Jason Gunthorpe To: Andy Whitcroft To: Roman Gushchin To: Barry Song To: Andrea Arcangeli To: Lorenzo Stoakes To: Suren Baghdasaryan To: Shakeel Butt To: Pedro Falcato To: Jann Horn To: Guillaume Morin To: Yang Shi To: James Houghton To: Rik van Riel To: Harry Yoo To: Lance Yang To: Axel Rasmussen To: Peter Xu To: Sasha Levin To: Kiryl Shutsemau To: Christian Brauner To: "Steven Rostedt (Google)" To: Hongbo Li To: Gregory Price To: Zi Yan To: Joshua Hahn To: Rakie Kim To: Ying Huang To: Matthew Brost To: Byungchul Park To: Alistair Popple To: Andi Kleen To: David Rientjes To: Joern Engel To: "Aneesh Kumar K.V" Cc: linux-mm@kvack.org Cc: linux-doc@vger.kernel.org Cc: Gerd Hoffmann Cc: linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org Cc: Johannes Weiner Cc: Chris Mason Cc: Jiaqi Yan --- Chris Mason (8): mm/hugetlb: fix truncated copy result in UFFDIO_COPY hugetlbfs: fix deadlock between hole punching and memory failure hugetlbfs: recheck the vma range after the lock wait mm/hugetlb: don't zap non-present entries when unmapping a folio hugetlbfs: seal SHM_HUGETLB files against growth mm/hugetlb: unshare PMDs of a split VMA if allocating its lock fails mm/hugetlb_cgroup: track in-use folios per cgroup mm/hugetlb: resolve protnone faults without a uffd bit David Hildenbrand (Arm) (27): mm/hugetlb: charge the copy made at fork to the parent mm/hugetlb: restore the reservation if vma_needs_reservation() fails mm/hugetlb: restore the reservation when racing with another reservation mm/hugetlb: return the reservation to the subpool on error mm/hugetlb: report reservations that we actually added from hugetlb_reserve_pages() mm/hugetlb: keep HPAGE_RESV_UNMAPPED when forking mm/hugetlb: always mark new page cache folios migratable mm/memfd: mark new hugetlb folios migratable mm/hugetlb: free surplus folios of other nodes on free mm/hugetlb: wait for deferred frees before failing an allocation mm/hugetlb_cma: reset hugetlb_cma_size if the arch doesn't support it fs/proc/task_mmu: don't clear VM_SOFTDIRTY on hugetlb VMAs hugetlbfs: fix integer overflow when punching holes hugetlbfs: don't zero poisoned pages in a hole punch hugetlbfs: don't overflow the pseudo VMA address in fallocate() hugetlbfs: don't overflow the end of the unmap range on 32-bit hugetlbfs: don't skip private VMAs when unmapping on truncation mm/hugetlb: serialize private faults with truncation mm/hugetlb: check EOF for UFFDIO_COPY and UFFDIO_POISON hugetlbfs: zero all hugetlbfs-specific fields of new inodes mm/rmap: don't fail unmapping hugetlb folios from private VMAs mm/hugetlb: only check PMD table sharing for PMD-sized folios mm/migrate: check hugetlb PMD sharing in move_pages() mm/hugetlb: don't share page tables of a VMA during mprotect() mm/hugetlb: count migration entries at fork and unmap mm/hugetlb: stop accounting HugetlbPages once PMD tables were shared mm/hugetlb_cgroup: charge faults to mm->owner Documentation/filesystems/proc.rst | 3 +- Documentation/mm/hugetlbfs_reserv.rst | 4 +- fs/hugetlbfs/inode.c | 64 ++++--- fs/proc/task_mmu.c | 9 +- include/linux/hugetlb.h | 22 ++- include/linux/hugetlb_cgroup.h | 30 +++- include/linux/leafops.h | 11 ++ mm/hugetlb.c | 330 +++++++++++++++++++++++----------- mm/hugetlb_cgroup.c | 66 ++++--- mm/hugetlb_cma.c | 1 + mm/memfd.c | 1 + mm/mempolicy.c | 2 +- mm/migrate.c | 23 ++- mm/rmap.c | 12 +- mm/vma.c | 2 +- tools/testing/vma/include/stubs.h | 3 +- 16 files changed, 389 insertions(+), 194 deletions(-) --- base-commit: c8117bff684306f5c1f959d055cc2b24dd67b1eb change-id: 20261120-hugetlb_fixes_2-26455c584f4e Best regards, -- David Hildenbrand (Arm)