Skip to content

Commit 40735a6

Browse files
committed
Merge tag 'mm-stable-2026-04-18-02-14' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull more MM updates from Andrew Morton: - "Eliminate Dying Memory Cgroup" (Qi Zheng and Muchun Song) Address the longstanding "dying memcg problem". A situation wherein a no-longer-used memory control group will hang around for an extended period pointlessly consuming memory - "fix unexpected type conversions and potential overflows" (Qi Zheng) Fix a couple of potential 32-bit/64-bit issues which were identified during review of the "Eliminate Dying Memory Cgroup" series - "kho: history: track previous kernel version and kexec boot count" (Breno Leitao) Use Kexec Handover (KHO) to pass the previous kernel's version string and the number of kexec reboots since the last cold boot to the next kernel, and print it at boot time - "liveupdate: prevent double preservation" (Pasha Tatashin) Teach LUO to avoid managing the same file across different active sessions - "liveupdate: Fix module unloading and unregister API" (Pasha Tatashin) Address an issue with how LUO handles module reference counting and unregistration during module unloading - "zswap pool per-CPU acomp_ctx simplifications" (Kanchana Sridhar) Simplify and clean up the zswap crypto compression handling and improve the lifecycle management of zswap pool's per-CPU acomp_ctx resources - "mm/damon/core: fix damon_call()/damos_walk() vs kdmond exit race" (SeongJae Park) Address unlikely but possible leaks and deadlocks in damon_call() and damon_walk() - "mm/damon/core: validate damos_quota_goal->nid" (SeongJae Park) Fix a couple of root-only wild pointer dereferences - "Docs/admin-guide/mm/damon: warn commit_inputs vs other params race" (SeongJae Park) Update the DAMON documentation to warn operators about potential races which can occur if the commit_inputs parameter is altered at the wrong time - "Minor hmm_test fixes and cleanups" (Alistair Popple) Bugfixes and a cleanup for the HMM kernel selftests - "Modify memfd_luo code" (Chenghao Duan) Cleanups, simplifications and speedups to the memfd_lou code - "mm, kvm: allow uffd support in guest_memfd" (Mike Rapoport) Support for userfaultfd in guest_memfd - "selftests/mm: skip several tests when thp is not available" (Chunyu Hu) Fix several issues in the selftests code which were causing breakage when the tests were run on CONFIG_THP=n kernels - "mm/mprotect: micro-optimization work" (Pedro Falcato) A couple of nice speedups for mprotect() - "MAINTAINERS: update KHO and LIVE UPDATE entries" (Pratyush Yadav) Document upcoming changes in the maintenance of KHO, LUO, memfd_luo, kexec, crash, kdump and probably other kexec-based things - they are being moved out of mm.git and into a new git tree * tag 'mm-stable-2026-04-18-02-14' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (121 commits) MAINTAINERS: add page cache reviewer mm/vmscan: avoid false-positive -Wuninitialized warning MAINTAINERS: update Dave's kdump reviewer email address MAINTAINERS: drop include/linux/liveupdate from LIVE UPDATE MAINTAINERS: drop include/linux/kho/abi/ from KHO MAINTAINERS: update KHO and LIVE UPDATE maintainers MAINTAINERS: update kexec/kdump maintainers entries mm/migrate_device: remove dead migration entry check in migrate_vma_collect_huge_pmd() selftests: mm: skip charge_reserved_hugetlb without killall userfaultfd: allow registration of ranges below mmap_min_addr mm/vmstat: fix vmstat_shepherd double-scheduling vmstat_update mm/hugetlb: fix early boot crash on parameters without '=' separator zram: reject unrecognized type= values in recompress_store() docs: proc: document ProtectionKey in smaps mm/mprotect: special-case small folios when applying permissions mm/mprotect: move softleaf code out of the main function mm: remove '!root_reclaim' checking in should_abort_scan() mm/sparse: fix comment for section map alignment mm/page_io: use sio->len for PSWPIN accounting in sio_read_complete() selftests/mm: transhuge_stress: skip the test when thp not available ...
2 parents faeab16 + 0b5e8d7 commit 40735a6

84 files changed

Lines changed: 2814 additions & 1675 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CREDITS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,6 +1451,14 @@ N: Andy Gospodarek
14511451
E: andy@greyhouse.net
14521452
D: Maintenance and contributions to the network interface bonding driver.
14531453

1454+
N: Vivek Goyal
1455+
E: vgoyal@redhat.com
1456+
D: KDUMP, KEXEC, and VIRTIO FILE SYSTEM
1457+
1458+
N: Alexander Graf
1459+
E: graf@amazon.com
1460+
D: Kexec Handover (KHO)
1461+
14541462
N: Wolfgang Grandegger
14551463
E: wg@grandegger.com
14561464
D: Controller Area Network (device drivers)

Documentation/admin-guide/mm/damon/lru_sort.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ of parametrs except ``enabled`` again. Once the re-reading is done, this
7979
parameter is set as ``N``. If invalid parameters are found while the
8080
re-reading, DAMON_LRU_SORT will be disabled.
8181

82+
Once ``Y`` is written to this parameter, the user must not write to any
83+
parameters until reading ``commit_inputs`` again returns ``N``. If users
84+
violate this rule, the kernel may exhibit undefined behavior.
85+
8286
active_mem_bp
8387
-------------
8488

Documentation/admin-guide/mm/damon/reclaim.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ of parametrs except ``enabled`` again. Once the re-reading is done, this
7171
parameter is set as ``N``. If invalid parameters are found while the
7272
re-reading, DAMON_RECLAIM will be disabled.
7373

74+
Once ``Y`` is written to this parameter, the user must not write to any
75+
parameters until reading ``commit_inputs`` again returns ``N``. If users
76+
violate this rule, the kernel may exhibit undefined behavior.
77+
7478
min_age
7579
-------
7680

Documentation/admin-guide/mm/kho.rst

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,45 @@ For example, if you used ``reserve_mem`` command line parameter to create
4242
an early memory reservation, the new kernel will have that memory at the
4343
same physical address as the old kernel.
4444

45+
Kexec Metadata
46+
==============
47+
48+
KHO automatically tracks metadata about the kexec chain, passing information
49+
about the previous kernel to the next kernel. This feature helps diagnose
50+
bugs that only reproduce when kexecing from specific kernel versions.
51+
52+
On each KHO kexec, the kernel logs the previous kernel's version and the
53+
number of kexec reboots since the last cold boot::
54+
55+
[ 0.000000] KHO: exec from: 6.19.0-rc4-next-20260107 (count 1)
56+
57+
The metadata includes:
58+
59+
``previous_release``
60+
The kernel version string (from ``uname -r``) of the kernel that
61+
initiated the kexec.
62+
63+
``kexec_count``
64+
The number of kexec boots since the last cold boot. On cold boot,
65+
this counter starts at 0 and increments with each kexec. This helps
66+
identify issues that only manifest after multiple consecutive kexec
67+
reboots.
68+
69+
Use Cases
70+
---------
71+
72+
This metadata is particularly useful for debugging kexec transition bugs,
73+
where a buggy kernel kexecs into a new kernel and the bug manifests only
74+
in the second kernel. Examples of such bugs include:
75+
76+
- Memory corruption from the previous kernel affecting the new kernel
77+
- Incorrect hardware state left by the previous kernel
78+
- Firmware/ACPI state issues that only appear in kexec scenarios
79+
80+
At scale, correlating crashes to the previous kernel version enables
81+
faster root cause analysis when issues only occur in specific kernel
82+
transition scenarios.
83+
4584
debugfs Interfaces
4685
==================
4786

@@ -80,5 +119,5 @@ stabilized.
80119
it finished to interpret their metadata.
81120

82121
``/sys/kernel/debug/kho/in/sub_fdts/``
83-
Similar to ``kho/out/sub_fdts/``, but contains sub FDT blobs
122+
Similar to ``kho/out/sub_fdts/``, but contains sub blobs
84123
of KHO producers passed from the old kernel.

Documentation/filesystems/proc.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,10 @@ does not take into account swapped out page of underlying shmem objects.
565565
naturally aligned THP pages of any currently enabled size. 1 if true, 0
566566
otherwise.
567567

568+
If both the kernel and the CPU support protection keys (pkeys),
569+
"ProtectionKey" indicates the memory protection key associated with the
570+
virtual memory area.
571+
568572
"VmFlags" field deserves a separate description. This member represents the
569573
kernel flags associated with the particular virtual memory area in two letter
570574
encoded manner. The codes are the following:

MAINTAINERS

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13859,8 +13859,10 @@ F: scripts/Makefile.kcsan
1385913859
KDUMP
1386013860
M: Andrew Morton <akpm@linux-foundation.org>
1386113861
M: Baoquan He <bhe@redhat.com>
13862-
R: Vivek Goyal <vgoyal@redhat.com>
13863-
R: Dave Young <dyoung@redhat.com>
13862+
M: Mike Rapoport <rppt@kernel.org>
13863+
M: Pasha Tatashin <pasha.tatashin@soleen.com>
13864+
M: Pratyush Yadav <pratyush@kernel.org>
13865+
R: Dave Young <ruirui.yang@linux.dev>
1386413866
L: kexec@lists.infradead.org
1386513867
S: Maintained
1386613868
W: http://lse.sourceforge.net/kdump/
@@ -14175,25 +14177,28 @@ F: include/linux/kernfs.h
1417514177
KEXEC
1417614178
M: Andrew Morton <akpm@linux-foundation.org>
1417714179
M: Baoquan He <bhe@redhat.com>
14180+
M: Mike Rapoport <rppt@kernel.org>
14181+
M: Pasha Tatashin <pasha.tatashin@soleen.com>
14182+
M: Pratyush Yadav <pratyush@kernel.org>
1417814183
L: kexec@lists.infradead.org
1417914184
W: http://kernel.org/pub/linux/utils/kernel/kexec/
1418014185
F: include/linux/kexec.h
1418114186
F: include/uapi/linux/kexec.h
1418214187
F: kernel/kexec*
1418314188

1418414189
KEXEC HANDOVER (KHO)
14185-
M: Alexander Graf <graf@amazon.com>
1418614190
M: Mike Rapoport <rppt@kernel.org>
1418714191
M: Pasha Tatashin <pasha.tatashin@soleen.com>
14188-
R: Pratyush Yadav <pratyush@kernel.org>
14192+
M: Pratyush Yadav <pratyush@kernel.org>
14193+
R: Alexander Graf <graf@amazon.com>
1418914194
L: kexec@lists.infradead.org
1419014195
L: linux-mm@kvack.org
1419114196
S: Maintained
14197+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/liveupdate/linux.git
1419214198
F: Documentation/admin-guide/mm/kho.rst
1419314199
F: Documentation/core-api/kho/*
1419414200
F: include/linux/kexec_handover.h
1419514201
F: include/linux/kho/
14196-
F: include/linux/kho/abi/
1419714202
F: kernel/liveupdate/kexec_handover*
1419814203
F: lib/test_kho.c
1419914204
F: tools/testing/selftests/kho/
@@ -14892,15 +14897,15 @@ F: tools/testing/selftests/livepatch/
1489214897
LIVE UPDATE
1489314898
M: Pasha Tatashin <pasha.tatashin@soleen.com>
1489414899
M: Mike Rapoport <rppt@kernel.org>
14895-
R: Pratyush Yadav <pratyush@kernel.org>
14900+
M: Pratyush Yadav <pratyush@kernel.org>
1489614901
L: linux-kernel@vger.kernel.org
1489714902
S: Maintained
14903+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/liveupdate/linux.git
1489814904
F: Documentation/core-api/liveupdate.rst
1489914905
F: Documentation/mm/memfd_preservation.rst
1490014906
F: Documentation/userspace-api/liveupdate.rst
1490114907
F: include/linux/kho/abi/
1490214908
F: include/linux/liveupdate.h
14903-
F: include/linux/liveupdate/
1490414909
F: include/uapi/linux/liveupdate.h
1490514910
F: kernel/liveupdate/
1490614911
F: lib/tests/liveupdate.c
@@ -16859,8 +16864,12 @@ F: mm/migrate_device.c
1685916864

1686016865
MEMORY MANAGEMENT - MGLRU (MULTI-GEN LRU)
1686116866
M: Andrew Morton <akpm@linux-foundation.org>
16862-
M: Axel Rasmussen <axelrasmussen@google.com>
16863-
M: Yuanchu Xie <yuanchu@google.com>
16867+
R: Kairui Song <kasong@tencent.com>
16868+
R: Qi Zheng <qi.zheng@linux.dev>
16869+
R: Shakeel Butt <shakeel.butt@linux.dev>
16870+
R: Barry Song <baohua@kernel.org>
16871+
R: Axel Rasmussen <axelrasmussen@google.com>
16872+
R: Yuanchu Xie <yuanchu@google.com>
1686416873
R: Wei Xu <weixugc@google.com>
1686516874
L: linux-mm@kvack.org
1686616875
S: Maintained
@@ -20115,7 +20124,9 @@ F: kernel/padata.c
2011520124

2011620125
PAGE CACHE
2011720126
M: Matthew Wilcox (Oracle) <willy@infradead.org>
20127+
R: Jan Kara <jack@suse.cz>
2011820128
L: linux-fsdevel@vger.kernel.org
20129+
L: linux-mm@kvack.org
2011920130
S: Supported
2012020131
T: git git://git.infradead.org/users/willy/pagecache.git
2012120132
F: Documentation/filesystems/locking.rst

drivers/block/zram/zram_drv.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2546,6 +2546,8 @@ static ssize_t recompress_store(struct device *dev,
25462546
mode = RECOMPRESS_HUGE;
25472547
if (!strcmp(val, "huge_idle"))
25482548
mode = RECOMPRESS_IDLE | RECOMPRESS_HUGE;
2549+
if (!mode)
2550+
return -EINVAL;
25492551
continue;
25502552
}
25512553

@@ -2678,7 +2680,7 @@ static void zram_bio_discard(struct zram *zram, struct bio *bio)
26782680
*/
26792681
if (offset) {
26802682
if (n <= (PAGE_SIZE - offset))
2681-
return;
2683+
goto end_bio;
26822684

26832685
n -= (PAGE_SIZE - offset);
26842686
index++;
@@ -2693,6 +2695,7 @@ static void zram_bio_discard(struct zram *zram, struct bio *bio)
26932695
n -= PAGE_SIZE;
26942696
}
26952697

2698+
end_bio:
26962699
bio_endio(bio);
26972700
}
26982701

fs/buffer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -822,8 +822,7 @@ struct buffer_head *folio_alloc_buffers(struct folio *folio, unsigned long size,
822822
long offset;
823823
struct mem_cgroup *memcg, *old_memcg;
824824

825-
/* The folio lock pins the memcg */
826-
memcg = folio_memcg(folio);
825+
memcg = get_mem_cgroup_from_folio(folio);
827826
old_memcg = set_active_memcg(memcg);
828827

829828
head = NULL;
@@ -844,6 +843,7 @@ struct buffer_head *folio_alloc_buffers(struct folio *folio, unsigned long size,
844843
}
845844
out:
846845
set_active_memcg(old_memcg);
846+
mem_cgroup_put(memcg);
847847
return head;
848848
/*
849849
* In case anything failed, we just free everything we got.

fs/fs-writeback.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -280,15 +280,13 @@ void __inode_attach_wb(struct inode *inode, struct folio *folio)
280280
if (inode_cgwb_enabled(inode)) {
281281
struct cgroup_subsys_state *memcg_css;
282282

283-
if (folio) {
284-
memcg_css = mem_cgroup_css_from_folio(folio);
285-
wb = wb_get_create(bdi, memcg_css, GFP_ATOMIC);
286-
} else {
287-
/* must pin memcg_css, see wb_get_create() */
283+
/* must pin memcg_css, see wb_get_create() */
284+
if (folio)
285+
memcg_css = get_mem_cgroup_css_from_folio(folio);
286+
else
288287
memcg_css = task_get_css(current, memory_cgrp_id);
289-
wb = wb_get_create(bdi, memcg_css, GFP_ATOMIC);
290-
css_put(memcg_css);
291-
}
288+
wb = wb_get_create(bdi, memcg_css, GFP_ATOMIC);
289+
css_put(memcg_css);
292290
}
293291

294292
if (!wb)
@@ -979,16 +977,16 @@ void wbc_account_cgroup_owner(struct writeback_control *wbc, struct folio *folio
979977
if (!wbc->wb || wbc->no_cgroup_owner)
980978
return;
981979

982-
css = mem_cgroup_css_from_folio(folio);
980+
css = get_mem_cgroup_css_from_folio(folio);
983981
/* dead cgroups shouldn't contribute to inode ownership arbitration */
984982
if (!css_is_online(css))
985-
return;
983+
goto out;
986984

987985
id = css->id;
988986

989987
if (id == wbc->wb_id) {
990988
wbc->wb_bytes += bytes;
991-
return;
989+
goto out;
992990
}
993991

994992
if (id == wbc->wb_lcand_id)
@@ -1001,6 +999,8 @@ void wbc_account_cgroup_owner(struct writeback_control *wbc, struct folio *folio
1001999
wbc->wb_tcand_bytes += bytes;
10021000
else
10031001
wbc->wb_tcand_bytes -= min(bytes, wbc->wb_tcand_bytes);
1002+
out:
1003+
css_put(css);
10041004
}
10051005
EXPORT_SYMBOL_GPL(wbc_account_cgroup_owner);
10061006

fs/userfaultfd.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,8 +1238,6 @@ static __always_inline int validate_unaligned_range(
12381238
return -EINVAL;
12391239
if (!len)
12401240
return -EINVAL;
1241-
if (start < mmap_min_addr)
1242-
return -EINVAL;
12431241
if (start >= task_size)
12441242
return -EINVAL;
12451243
if (len > task_size - start)

0 commit comments

Comments
 (0)