From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DB96E606A322 for ; Thu, 3 Dec 2026 11:37:53 +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 kanga.kvack.org (Postfix) id 049AE6B05B2; Thu, 3 Dec 2026 06:37:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F3CD46B05B6; Thu, 3 Dec 2026 06:37:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E03C86B05B7; Thu, 3 Dec 2026 06:37:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 6D2676B05B2 for ; Thu, 3 Dec 2026 06:37:52 -0500 (EST) Received: from smtpin14.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay07.hostedemail.com (Postfix) with ESMTP id EE4461605E4 for ; Thu, 3 Dec 2026 11:37:51 +0000 (UTC) X-FDA: 85502472342.14.A138D2E Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by imf14.hostedemail.com (Postfix) with ESMTP id 27F85100013 for ; Thu, 3 Dec 2026 11:37:50 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=Uwn0izVE; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf14.hostedemail.com: domain of david@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=david@kernel.org ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796297870; b=aaRZdG6643j2w3SHxmquIfKrmfOefnvx1XdhuHkmo30XeK2Zaas+4TMBGDj/gHWumK3jIi vjR7ixJqpn1WyVAxRq+MRnr+i8x4D+YfGQrCBdcf4/r7QPbHEAaDIxaQDS0G8zxSDj9Kbq dgQ6HcXHt1u5E1eyCGB+7HHluhPIT2c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796297870; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=hi8kyZfs/dUNENWDIhj5/mayjF9Z6YKqcD5EBJcLNVI=; b=aWZBidAR/skuFqoeQrktWlwxX+Sz0lYA7ZoihqhmiH2eix7UWsYbV+PBbU8bY95rXbKCYm WNNdiw7BrBKDlWcKwrUG7GJbxy52rCb/7ZgNLlnFj2CW88B/tGKU3Ux7s0fb2oBX66tHMJ jsm+9x127B+KEbNCurjs/aX5R2tfmsk= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=Uwn0izVE; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf14.hostedemail.com: domain of david@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=david@kernel.org Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 8069D61B77; Thu, 3 Dec 2026 11:37:49 +0000 (UTC) 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-Archived-By: 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 X-Stat-Signature: nh5796kjm6wkqxoenxemtoobed3kpjxi X-Rspamd-Queue-Id: 27F85100013 X-Rspamd-Server: rspam10 X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Rspam-User: X-HE-Tag: 1796297870-507436 X-HE-Meta: U2FsdGVkX18rEi/OPbi5/nQGcyZSaZev8/INafnEe1HN5sEBpZVZD5fau3pQiEa/g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3xInjIbYo+pW5gaMZvFJjr+OG5PG+2we911h/9i3/poIsK+3XQYDzW5tO7Wt6nyJ0asxUt3u0v8d3olRPngH4oKWfBhYKv49PqztDC+WNazMcpXayJcV8LhhRgSN37WPX/C9fQfvTkj8zKx1ksg2QOBsntBCKfP9xGoLDtagDb9E7Zsi6M8zGQ4c4IpG5ideeA3dNx0BARyw2iEC8gP55hUikSYcZRHXHclfPhOLxEdsTYKkmdAOQHeLfOkV4GRKATtJVnPmlZlFno/HLf7U9QCtd8Q9T2Aa+cKjwm8vxwmPkHUU4SXnjpJ6gFqNTI/JEd1k5ooBXkW6i7X/9igC3ivInla7qAmHZVTzmBvsYqD0NllgXHqc9avoe+15lHaXUHEQ== Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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)