[PATCH v2 00/35] mm/hugetlb: various fixes (2)
From: David Hildenbrand (Arm)
Date: Thu Dec 03 2026 - 06:37:57 EST
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@xxxxxxxxxx
To: Muchun Song <muchun.song@xxxxxxxxx>
To: Oscar Salvador <osalvador@xxxxxxxxxx>
To: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
To: Hongfu Li <lihongfu@xxxxxxxxxx>
To: Jinmeng Zhou <jinmengzhou22@xxxxxxxxx>
To: Mina Almasry <almasrymina@xxxxxxxxxx>
To: Davidlohr Bueso <dave@xxxxxxxxxxxx>
To: Naoya Horiguchi <nao.horiguchi@xxxxxxxxx>
To: "Liam R. Howlett" <liam@xxxxxxxxxxxxx>
To: Vlastimil Babka <vbabka@xxxxxxxxxx>
To: Mike Rapoport <rppt@xxxxxxxxxx>
To: Michal Hocko <mhocko@xxxxxxxx>
To: Jonathan Corbet <corbet@xxxxxxx>
To: Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>
To: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
To: Vivek Kasireddy <vivek.kasireddy@xxxxxxxxx>
To: Mel Gorman <mgorman@xxxxxxx>
To: Hugh Dickins <hughd@xxxxxxxxxx>
To: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>
To: Dave Airlie <airlied@xxxxxxxxxx>
To: Jason Gunthorpe <jgg@xxxxxxxx>
To: Andy Whitcroft <apw@xxxxxxxxxxxxx>
To: Roman Gushchin <roman.gushchin@xxxxxxxxx>
To: Barry Song <baohua@xxxxxxxxxx>
To: Andrea Arcangeli <aarcange@xxxxxxxxxx>
To: Lorenzo Stoakes <ljs@xxxxxxxxxx>
To: Suren Baghdasaryan <surenb@xxxxxxxxxx>
To: Shakeel Butt <shakeel.butt@xxxxxxxxx>
To: Pedro Falcato <pfalcato@xxxxxxx>
To: Jann Horn <jannh@xxxxxxxxxx>
To: Guillaume Morin <guillaume@xxxxxxxxxxx>
To: Yang Shi <shy828301@xxxxxxxxx>
To: James Houghton <jthoughton@xxxxxxxxxx>
To: Rik van Riel <riel@xxxxxxxxxxx>
To: Harry Yoo <harry@xxxxxxxxxx>
To: Lance Yang <lance.yang@xxxxxxxxx>
To: Axel Rasmussen <axelrasmussen@xxxxxxxxxx>
To: Peter Xu <peterx@xxxxxxxxxx>
To: Sasha Levin <sashal@xxxxxxxxxx>
To: Kiryl Shutsemau <kas@xxxxxxxxxx>
To: Christian Brauner <brauner@xxxxxxxxxx>
To: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx>
To: Hongbo Li <lihongbo22@xxxxxxxxxx>
To: Gregory Price <gourry@xxxxxxxxxx>
To: Zi Yan <ziy@xxxxxxxxxx>
To: Joshua Hahn <joshua.hahnjy@xxxxxxxxx>
To: Rakie Kim <rakie.kim@xxxxxx>
To: Ying Huang <ying.huang@xxxxxxxxxxxxxxxxx>
To: Matthew Brost <matthew.brost@xxxxxxxxx>
To: Byungchul Park <byungchul@xxxxxx>
To: Alistair Popple <apopple@xxxxxxxxxx>
To: Andi Kleen <ak@xxxxxxxxxxxxxxx>
To: David Rientjes <rientjes@xxxxxxxxxx>
To: Joern Engel <joern@xxxxxxxxxxxxxxx>
To: "Aneesh Kumar K.V" <aneesh.kumar@xxxxxxxxxx>
Cc: linux-mm@xxxxxxxxx
Cc: linux-doc@xxxxxxxxxxxxxxx
Cc: Gerd Hoffmann <kraxel@xxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
Cc: linux-fsdevel@xxxxxxxxxxxxxxx
Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
Cc: Chris Mason <mason@xxxxxxxxxx>
Cc: Jiaqi Yan <jiaqiyan@xxxxxxxxxx>
---
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) <david@xxxxxxxxxx>