Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/32] mm: various (urgent?) fixes, part 3
@ 2026-11-29 10:06 David Hildenbrand (Arm)
  2026-11-29 10:06 ` [PATCH 01/32] mm/shmem: count only the swapped pages in the requested range David Hildenbrand (Arm)
                   ` (31 more replies)
  0 siblings, 32 replies; 45+ messages in thread
From: David Hildenbrand (Arm) @ 2026-11-29 10:06 UTC (permalink / raw)
  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, linux-kernel, linux-fsdevel, linux-cxl, linux-rt-devel,
	SJ Park, David Hildenbrand (Arm), Chris Mason, stable,
	Oleg Nesterov

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 19 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 fairly simple, but I consider the following more involved
and 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"
- "mm/khugepaged: check for uffd outside the i_pages lock"

And I am not 100% sure about the following uffd one. It closes a hole
where UFFDIO_COPY, UFFDIO_ZEROPAGE and UFFDIO_CONTINUE behave differently
than page faults while a hole is punched. But I don't see a more elegant
solution than just letting these ioctls fail with -EAGAIN, and I am not
sure about the real impact of the bug and the change:

- "mm/shmem: reject userfaultfd fills during hole punch"

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) <david@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) (22):
      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/mempolicy: don't wait for mems_allowed_seq in kmalloc_nolock()
      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

 include/linux/mempolicy.h |   2 +-
 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           | 124 ++++++++++++++++++++++++++--------------
 mm/ksm.c                  | 143 ++++++++++++++++++++++++++++++++++++----------
 mm/memory.c               |  46 ++++++++++-----
 mm/memory_hotplug.c       |  34 +++--------
 mm/mempolicy.c            |  38 ++++++++----
 mm/migrate.c              |  73 ++++++++++++-----------
 mm/migrate_device.c       |  34 ++++++++++-
 mm/rmap.c                 |   6 +-
 mm/shmem.c                |  97 ++++++++++++++++++++++++++-----
 mm/slub.c                 |  15 +++--
 mm/sparse-vmemmap.c       |  39 +++++++++----
 mm/userfaultfd.c          |  37 ++++++++++++
 21 files changed, 635 insertions(+), 233 deletions(-)
---
base-commit: c6f53520f32302ea64cbcfd7cc25a31081e34548
change-id: 20261110-fixes_core_3-701ac25d6d72

Best regards,
--  
David Hildenbrand (Arm) <david@kernel.org>



^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2026-11-29 20:50 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29 10:06 [PATCH 00/32] mm: various (urgent?) fixes, part 3 David Hildenbrand (Arm)
2026-11-29 10:06 ` [PATCH 01/32] mm/shmem: count only the swapped pages in the requested range David Hildenbrand (Arm)
2026-11-29 10:06 ` [PATCH 02/32] mm/shmem: don't skip parts of a split swap entry when punching holes David Hildenbrand (Arm)
2026-11-29 10:06 ` [PATCH 03/32] mm/shmem: reject userfaultfd fills during hole punch David Hildenbrand (Arm)
2026-11-29 19:47   ` Jose A. Perez de Azpillaga
2026-11-29 10:06 ` [PATCH 04/32] mm/shmem: fix commit limit bypass with very large shmem sizes David Hildenbrand (Arm)
2026-11-29 10:06 ` [PATCH 05/32] mm/shmem: don't pin inodes with eviction held off in the huge shrinker David Hildenbrand (Arm)
2026-11-29 10:06 ` [PATCH 06/32] mm/shmem: seal the size of SysV and shared anon files David Hildenbrand (Arm)
2026-11-29 10:06 ` [PATCH 07/32] mm/khugepaged: check the VMA before walking page tables when collapsing David Hildenbrand (Arm)
2026-11-29 19:55   ` Jose A. Perez de Azpillaga
2026-11-29 10:06 ` [PATCH 08/32] mm/khugepaged: flush file after unlocking folios in collapse_file() David Hildenbrand (Arm)
2026-11-29 19:58   ` Jose A. Perez de Azpillaga
2026-11-29 10:06 ` [PATCH 09/32] mm/khugepaged: check for uffd outside the i_pages lock David Hildenbrand (Arm)
2026-11-29 20:07   ` Jose A. Perez de Azpillaga
2026-11-29 10:06 ` [PATCH 10/32] mm/khugepaged: don't wait for userfaultfd David Hildenbrand (Arm)
2026-11-29 20:16   ` Jose A. Perez de Azpillaga
2026-11-29 10:06 ` [PATCH 11/32] mm/khugepaged: store new folio before adding it to LRU David Hildenbrand (Arm)
2026-11-29 20:22   ` Jose A. Perez de Azpillaga
2026-11-29 10:06 ` [PATCH 12/32] mm/khugepaged: check PMD support with the folios locked David Hildenbrand (Arm)
2026-11-29 20:27   ` Jose A. Perez de Azpillaga
2026-11-29 10:06 ` [PATCH 13/32] mm/khugepaged: stop MADV_COLLAPSE on a fatal signal David Hildenbrand (Arm)
2026-11-29 20:29   ` Jose A. Perez de Azpillaga
2026-11-29 10:06 ` [PATCH 14/32] mm/huge_memory: split huge zero PMDs on unshare faults David Hildenbrand (Arm)
2026-11-29 20:33   ` Jose A. Perez de Azpillaga
2026-11-29 10:06 ` [PATCH 15/32] mm/huge_memory: don't map huge PFN entries if the arch restricts PFNs David Hildenbrand (Arm)
2026-11-29 20:41   ` Jose A. Perez de Azpillaga
2026-11-29 10:06 ` [PATCH 16/32] mm/memory: don't clear a PUD leaf as bad in a zap David Hildenbrand (Arm)
2026-11-29 20:47   ` Jose A. Perez de Azpillaga
2026-11-29 10:06 ` [PATCH 17/32] mm/memory: drop the swap device ref before do_wp_page() David Hildenbrand (Arm)
2026-11-29 20:50   ` Jose A. Perez de Azpillaga
2026-11-29 10:06 ` [PATCH 18/32] mm: consistently check MMF_UNSTABLE when populating in CoW mappings David Hildenbrand (Arm)
2026-11-29 10:06 ` [PATCH 19/32] mm/gup: check for fatal signals in memfd_pin_folios() David Hildenbrand (Arm)
2026-11-29 10:06 ` [PATCH 20/32] mm/migrate_device: don't collect secretmem pages David Hildenbrand (Arm)
2026-11-29 10:06 ` [PATCH 21/32] mm/migrate_device: mark folios leaving device memory dirty David Hildenbrand (Arm)
2026-11-29 10:06 ` [PATCH 22/32] mm: taint device sections before setting subsections valid David Hildenbrand (Arm)
2026-11-29 10:06 ` [PATCH 23/32] mm/mempolicy: check access under exec_update_lock David Hildenbrand (Arm)
2026-11-29 10:06 ` [PATCH 24/32] mm/mempolicy: reject an empty set of allowed nodes David Hildenbrand (Arm)
2026-11-29 10:06 ` [PATCH 25/32] mm/mempolicy: don't wait for mems_allowed_seq in kmalloc_nolock() David Hildenbrand (Arm)
2026-11-29 10:06 ` [PATCH 26/32] mm/ksm: look up the folio again in cmp_and_merge_page() David Hildenbrand (Arm)
2026-11-29 10:06 ` [PATCH 27/32] mm/ksm: copy KSM folios at swap-in without VM_MERGEABLE David Hildenbrand (Arm)
2026-11-29 10:06 ` [PATCH 28/32] mm/ksm: don't convert a shared anon folio into a KSM folio David Hildenbrand (Arm)
2026-11-29 10:07 ` [PATCH 29/32] mm/ksm: use a migration counter to detect KSM folio migration David Hildenbrand (Arm)
2026-11-29 10:07 ` [PATCH 30/32] mm/migrate: fix KSM oddity by checking expected refcount without mappings David Hildenbrand (Arm)
2026-11-29 10:07 ` [PATCH 31/32] mm/migrate_device: don't collect KSM folios David Hildenbrand (Arm)
2026-11-29 10:07 ` [PATCH 32/32] mm/migrate: use consistent folio locking logic David Hildenbrand (Arm)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox