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=1796388628; b=pTLiJr08nINymYy64u54xQT/Ougw3lgaOpAb3ca2KCdIaD1GbNOUIdqV92VyjpbuNhPQ vET3fKsxW9NtF05xrslEg4REZhFenV34QzI+KhxSwhxbEtmwVyG5nBrxdlid+cefE2lD7 v11Lm2T5i4XesCdfRBoRLUKgAz1UoYvD6+/UNMm0BbGQdFKTxX2CdgIZHVg3Er428J/zq zRbk5lQmP8pXQj8rdhOPGKq6N6un3qPyvODHLEIh7NbkqipjXx5MRZqOUdGIAzzHE3zdR XfqiyDZ+SwJB6AiMz8uQavztazMl685/faoPwUhTe6ONWA1yHPwL6MnpaE/oTr+yUsA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388628; 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=GgnAIlzUTMDqj6JDqX/wSdaam+aGG7Snyx6zeqPhmxo=; b=TbzyZDCN7sIcAg5zL3GEYhC71qhJAEHqmaIYnuNWx65k3AoOPN+wHStWLUKwTpgTCu4D OZT0+SPGQ0FnGXyiOpXk2tBchWSlZQuIAzaK7sJYeWOU+4HFxA8P6iTmKOFMaAuwHBPsZ oZYRPwmYo+1nVQJRn8kXOjcgPJVIf5dK5TV3nxu5cuGNDF+xCVRLvAGJeX4afVFFmV2Ow N3JSWEQYeXAhnEJNwz5JQdWE5oonvk4tRbPMA+RG39vGWGReuCFakKwyLy2iy5+FeiMaN SoEj12Da8ilWbEOJ5Q/RGwNXylXAK5zUQIESmdBgVOz/lYHwFO55oZsb9izAbZTrzhA== 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=TLwlA+Ym; 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 6B616606A322; Fri, 4 Dec 2026 12:50:28 +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 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-Mailing-List: stable@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/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 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)