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 4DD32606A336 for ; Fri, 4 Dec 2026 12:50:34 +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=TLwlA+Ym Received: by kanga.kvack.org (Postfix) id 5A56B6B05B5; Fri, 4 Dec 2026 07:50:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 555E76B05B9; Fri, 4 Dec 2026 07:50:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 44A556B05B5; Fri, 4 Dec 2026 07:50:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 1F12D6B05B5 for ; Fri, 4 Dec 2026 07:50:32 -0500 (EST) Received: from smtpin27.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 0E5DE1203C2 for ; Fri, 4 Dec 2026 12:50:31 +0000 (UTC) X-FDA: 85506284262.27.FE1A99F Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf07.hostedemail.com (Postfix) with ESMTP id 38E9940007 for ; Fri, 4 Dec 2026 12:50:29 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=TLwlA+Ym; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf07.hostedemail.com: domain of david@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=david@kernel.org ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796388629; b=YtDB3kBdRLE78OlIH4uYCMsHmg0hTYC75i7WgOepA+FVzvLh0p1PJh6AE+H3YvX1zJG1ms RLqcZA1G3NydFF+5ufu7fYCNNEB/PXg0UW3P4OTZSV3erF8UPtnJVubysEg+3u8uezrmbj pGCSsGHz/t2HOxTIPq28+3yiWXehnBM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796388629; 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=GgnAIlzUTMDqj6JDqX/wSdaam+aGG7Snyx6zeqPhmxo=; b=HQe5JPu/TSRk4uTaaJXfoPpA4wXs3674Igu4kohO2CjnS1mn6opv/xIosprTvWjBtR5wcg MPWAWvj1Kd0oNUq2qdp/lRNyQexeFRui/eqinUe3pQo2c0P1GCyIIWUeOXAWlCGlbYqx3H 2lYoIDInHiHPpITZlDXkxfRPKvhodQQ= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=TLwlA+Ym; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf07.hostedemail.com: domain of david@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=david@kernel.org Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 52673435D3; Fri, 4 Dec 2026 12:50:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 206331F000CE; Fri, 4 Dec 2026 12:50:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796388628; bh=GgnAIlzUTMDqj6JDqX/wSdaam+aGG7Snyx6zeqPhmxo=; h=From:Subject:Date:To:Cc; b=TLwlA+YmW1m9J44z0PytI+dIwN8Zb3AmHLjfUQ7kaZf7Qs2xglstXMA9kAH7xe0fE xe50DBxezoS4k9y9lSf7NHzJROKdgc0C1jHh8oNgvuqgO2Tl2nS59bsrRxSTWubXNs jZxYaa3Ne1vHTLzue6dCzrs/TZqr6D+DjLWuYQbZKAmFk8nWt832C44X1QWKpzMpBK O/y3mt8QNk8MWFPiGZIQyZUUw7WvmaVNQhrW8LnBU+lZBF+Bk2AWPVkAu/42dThEhr wW5lPsofWh8dXbO9x4N6PAfrn4YYKRJ0u3LA2m1+7zpKZrNgHXa4mbg2dso1Rd6uGE oHb6DFCruucig== From: "David Hildenbrand (Arm)" Subject: [PATCH v2 00/31] mm: various (urgent?) fixes, part 3 Date: Fri, 04 Dec 2026 13:49:51 +0100 Message-Id: <20261204-fixes_core_3-v2-0-9aad65727632@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/1WNQQ6CMBBFr9LMmppO1SJdeQ9DCJYBqqQ1UyQaw t0N6Mblz3t5f4ZE7CmBFTMwTT75GMAKnQlwfR06kr4BK0ArbRBRyda/KFUuMlV7mSusnT42psk 1ZAIeTBsHKy7ld6fn9UZuXBur0fs0Rn5vfxOu3i+ti//0hFLJ1hhVHBDNSeH5Thxo2EXuoFyW5 QPvTVHluwAAAA== X-Change-ID: 20261110-fixes_core_3-701ac25d6d72 To: Hugh Dickins , Baolin Wang , Andrew Morton , Mike Rapoport , Peter Xu , Michal Hocko , Kiryl Shutsemau , Manfred Spraul , Davidlohr Bueso , Cyrill Gorcunov , Zi Yan , "Liam R. Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Usama Arif , Lorenzo Stoakes , Rik van Riel , Vlastimil Babka , Harry Yoo , Jann Horn , Yang Shi , Zach O'Keefe , Song Liu , David Stevens , Kefeng Wang , Alex Williamson , Suren Baghdasaryan , Dave Jiang , Matthew Wilcox , Miaohe Lin , David Rientjes , Shakeel Butt , Jan Kara , Mel Gorman , Jason Gunthorpe , John Hubbard , Gerd Hoffmann , Vivek Kasireddy , Dave Airlie , Matthew Brost , Joshua Hahn , Byungchul Park , Gregory Price , Ying Huang , Alistair Popple , Hagen Paul Pfeifer , James Bottomley , Felix Kuehling , Alex Sierra , Balbir Singh , Kairui Song , Qi Zheng , Axel Rasmussen , Yuanchu Xie , Wei Xu , Baoquan He , Oscar Salvador , Muchun Song , Dan Williams , Rakie Kim , Hao Li , Christoph Lameter , Roman Gushchin , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt , Alexei Starovoitov , Xu Xin , Chengming Zhou , Shivank Garg Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-cxl@vger.kernel.org, linux-rt-devel@lists.linux.dev, SJ Park , "David Hildenbrand (Arm)" , Chris Mason , stable@vger.kernel.org, "Jose A. Perez de Azpillaga" , Christian Brauner , Oleg Nesterov X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6190; i=david@kernel.org; h=from:subject:message-id; bh=JY5nwmxZruFrW2UvG/nUN/72q/FjryQ5L7bHHbxS7sM=; b=owGbwMvMwCF2/OVpCdfQ3ZWMp9WSGLKFtn0VTtcRX5xcuE/5iYf97xZb+WK9NbXzEq3d5iv9u ZJ/JedERykLgxgHg6yYIktQ8H2Dly/X1Va78THDzGFlAhnCwMUpABPRXsnwz/qJVMDu6QxNFqvv PcnvC+5mYX0/RdV8x7FnpoH7X05n2sbwPynzwOtYtWM/2/eH978W+JLygilsyq2D1+VbJ02f+dK 9mBEA X-Developer-Key: i=david@kernel.org; a=openpgp; fpr=1BD9CAAD735C4C3A460DFCCA4DDE10F700FF835A X-Rspamd-Server: rspam11 X-Rspam-User: X-Stat-Signature: gmm91ok98iyk444jt7y4nwh7aezf79cj X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Rspamd-Queue-Id: 38E9940007 X-HE-Tag: 1796388629-708553 X-HE-Meta: U2FsdGVkX1/wD1Ty8l+r1aTGl4Ynrls07ccYL6MzJlnL4FVEkg1IpoLc9qPX/3a2Mgj9bZ9Ty6ELirkqveTmLlbnPc7exWQjV447C6yvFBaElu4s6j6Zpr3hya+zK2KqYtb8af85rnCtjc2otNpJmrVDIQZlpBiDNS+nlNdchDs0VHLazoHdr4k0HgfA5HurXv28IF2h+ogqJKZuZCQ0DR038qcSIMOb/p/WPPVuDCFLHXVfxuWPTpVeHBFzPwegnoADKe1agXzS1B5Oqe+d45D+5hKczgxU0s/RSxH3CmMdh2RRl8vtFhcZX/tx4ondvYTeR8jS27aT5oz9UgpwGeZPsiXLun0YGrfxTx2a6yrgRSPFXueTdhKX6sBASGc/oIgWR/8LhLvJICA2FCkZ05EX6831zrNVdZwDal/MBJyluclT9Mbvi4S/TbOw1aWBEd1eh1J0oOUH61mVp602YbywBn3p/Vqx7/3K5OSsgLgv9uwJK2/as+iuGZqlVP6nfaa5jtsdPTzuUpjtWOWFag+UrKBMP0BNQ/oRUNGzda/0PTTphFmxjWhKZxHTQrWj0FMYRFRbESmdCbrbl34J9JWUhucZ5+Ie8zOVddpaEHhCOXibqU7sJtLfjx4s3Zqcr2zfmpn9pdm6+Ytr3igRVW5hitCjFnlxlqKhWtmINkbXKZIwl3Qu3ciUM1r9zF5gUpCn/sxXq/aH4MoovM3cxk89evB2LPDLCE0zQEdtOO6UAQSyjD5TCM0kkXww0KONsz1zqkDDu283zpzeYRU0yoNaxmRgCAy7RcmrrCG3drM4/660M+SW3jW0ucAp6QIb09jITubVFrlwZy2SzCEdRdwG3D9Qitg74P9ZgBrYNi0QbVBynUaK7S8W/drS7lcpw6GNSBcSX89KfDzyIuRrULYPEB5T0UzH87uPJ7cLQH+HVBGJoUR6XcsC4h4c0/OxGLE6RLnMZ6ZpOAbDXjZ vhM3hOLb 2CkTYwGf5miQz2g+6GHouAfLC+IrF2/EgbXrkiV/22w0VEhujABhcJWcsvNBCh5wbZSs65/6Ia0NpC+Y2Fytz1Jrn2TjCqKNJ7I0OEifEqU9+MmAzFTRnZwiCDHNClgG4RtwVmiPH+x38+t8qD2S/XrAKPnsjKVatb8ETfjKtvtr+pKOE8qHJEsyESN814QLAOhkbo7hSmIAEIyJReSzvYMYmHOX5/KV5Ja003GwLuds6Jwv9eo5nTFdCCSUQpS9tr57RzsKR7eNQsIo1c5LtuW/bDnty5JgTzk9Qc52jZX5DZIDs8+CbKrabW/o69EKtvqlLDN8nGLOY+d6vuQFuhBcChaz413pH5RV6foLRnnPQBNFtfGNzR4hEDmoCES4WyPtlUmenZ3CDr0SYnBKn2LKDas0F+UAyxndrhWvTm7i+QeYoF0R0pNP/tq745xfT9ugOaGV++I4Q/ZoCsukD/s0w3ptfgXGmU8M5IX3/4W9zjTPF8fc6UxOrkaY6sokRAUh1+kRvFWJfCkLwhRvsqAobllcLvPwDqCXckpuo8M6rPssWf07hUbpAyc79EIVb1Eq8BBifz0qCU1n8860NJUx+xUq/spt6jGV767KNc8iyGmBXd98jdidseUlMepRStdBR5a3GkF37k1kU46TSiTW6X1Ov3cC3Yhbq7xJtvgCaAcY= 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 actually part 3. I didn't indicate part 2 properly, and it caused confusion for people monitoring these fixes :) So, here is another set of fixes for core MM that I will pick up once reviewed. This time it's mostly shmem, khugepaged and some nasty, nasty KSM things. Mostly AI-reported fixes, with some fixes found while redoing some of them properly. 1 fix has high urgency, 12 have medium urgency and 17 have low urgency. The last patch is not a fix; for a while I thought it would be one. It's all confusing. But it's a reasonable locking consistency change in migration code. The really critical ones IMHO are: - "mm/khugepaged: check the VMA before walking page tables when collapsing" (high) - "mm/ksm: copy KSM folios at swap-in without VM_MERGEABLE" (medium) - "mm/ksm: don't convert a shared anon folio into a KSM folio" (medium) - "mm/memory: don't clear a PUD leaf as bad in a zap" (medium) - "mm/migrate_device: don't collect KSM folios" (medium) I might pick these early to send them to Linus before the merge window. OTOH, the merge window is just around the corner ... and the KSM things require systems with KSM enabled. Most fixes are reviewed by now. The following two are still missing review and are more involved, so I would appreciate some extra careful eyes: - "mm/ksm: don't convert a shared anon folio into a KSM folio" - "mm: taint device sections before setting subsections valid" This is based on mm-core/for-next. I did a bunch of testing (selftests, some targeted reproducers/tests), but more testing will be highly appreciated. Again, thanks to everyone helping out with moving the flood of fixes forward :) Signed-off-by: David Hildenbrand (Arm) --- Changes in v2: - Rebased on top of mm-core/for-next. - Collected tags (thanks!). - Dropped "mm/mempolicy: don't wait for mems_allowed_seq in kmalloc_nolock()". - "mm/shmem: reject userfaultfd fills during hole punch" - Drop the comment above __shmem_faults_blocked(). - "mm/khugepaged: don't wait for userfaultfd" - Clarify in the description that MISSING mode is required as well. - "mm/khugepaged: check PMD support with the folios locked" - Also check shmem and drop the outdated comment. - Update the patch description. - "mm/migrate_device: don't collect secretmem pages" - Refuse secretmem VMAs in migrate_vma_setup() instead. - "mm/ksm: don't convert a shared anon folio into a KSM folio" - Document that some shared pages might not get merged. - "mm/migrate: fix KSM oddity by checking expected refcount without mappings" - Clarify the description. - Link to v1: https://patch.msgid.link/20261129-fixes_core_3-v1-0-f66094116801@kernel.org --- Chris Mason (10): mm/khugepaged: flush file after unlocking folios in collapse_file() mm/khugepaged: store new folio before adding it to LRU mm/khugepaged: check PMD support with the folios locked mm/memory: drop the swap device ref before do_wp_page() mm/migrate_device: don't collect secretmem pages mm/mempolicy: check access under exec_update_lock mm/mempolicy: reject an empty set of allowed nodes mm/ksm: look up the folio again in cmp_and_merge_page() mm/ksm: copy KSM folios at swap-in without VM_MERGEABLE mm/migrate_device: don't collect KSM folios David Hildenbrand (Arm) (21): mm/shmem: count only the swapped pages in the requested range mm/shmem: don't skip parts of a split swap entry when punching holes mm/shmem: reject userfaultfd fills during hole punch mm/shmem: fix commit limit bypass with very large shmem sizes mm/shmem: don't pin inodes with eviction held off in the huge shrinker mm/shmem: seal the size of SysV and shared anon files mm/khugepaged: check the VMA before walking page tables when collapsing mm/khugepaged: check for uffd outside the i_pages lock mm/khugepaged: don't wait for userfaultfd mm/khugepaged: stop MADV_COLLAPSE on a fatal signal mm/huge_memory: split huge zero PMDs on unshare faults mm/huge_memory: don't map huge PFN entries if the arch restricts PFNs mm/memory: don't clear a PUD leaf as bad in a zap mm: consistently check MMF_UNSTABLE when populating in CoW mappings mm/gup: check for fatal signals in memfd_pin_folios() mm/migrate_device: mark folios leaving device memory dirty mm: taint device sections before setting subsections valid mm/ksm: don't convert a shared anon folio into a KSM folio mm/ksm: use a migration counter to detect KSM folio migration mm/migrate: fix KSM oddity by checking expected refcount without mappings mm/migrate: use consistent folio locking logic Documentation/admin-guide/mm/ksm.rst | 3 + include/linux/mm.h | 62 +++++++++------ include/linux/mmzone.h | 9 +++ include/linux/oom.h | 48 +++++++++--- include/linux/shmem_fs.h | 11 +++ ipc/shm.c | 2 + mm/filemap.c | 9 +++ mm/gup.c | 5 ++ mm/huge_memory.c | 34 ++++++++- mm/khugepaged.c | 119 ++++++++++++++++++----------- mm/ksm.c | 143 +++++++++++++++++++++++++++-------- mm/memory.c | 46 +++++++---- mm/memory_hotplug.c | 34 ++------- mm/mempolicy.c | 30 +++++--- mm/migrate.c | 73 +++++++++--------- mm/migrate_device.c | 30 +++++++- mm/rmap.c | 6 +- mm/shmem.c | 96 +++++++++++++++++++---- mm/sparse-vmemmap.c | 39 +++++++--- mm/userfaultfd.c | 37 +++++++++ 20 files changed, 611 insertions(+), 225 deletions(-) --- base-commit: 9ae069c329809d5206bd03470d033bd899970087 change-id: 20261110-fixes_core_3-701ac25d6d72 Best regards, -- David Hildenbrand (Arm)