Skip to content

Commit c6e99c1

Browse files
committed
Merge tag 'mm-hotfixes-stable-2026-05-18-21-07' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull misc fixes from Andrew Morton: "14 hotfixes. 9 are for MM. 10 are cc:stable and the remainder are for post-7.1 issues or aren't deemed suitable for backporting. There's a two-patch MAINTAINERS series from Mike Rapoport which updates us for the new KEXEC/KDUMP/crash/LUO/etc arrangements. And another two-patch series from Muchun Song to fix a couple of memory-hotplug issues. Otherwise singletons, please see the changelogs for details" * tag 'mm-hotfixes-stable-2026-05-18-21-07' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: mm/memory: fix spurious warning when unmapping device-private/exclusive pages mm: fix __vm_normal_page() to handle missing support for pmd_special()/pud_special() drivers/base/memory: fix memory block reference leak in poison accounting mm/memory_hotplug: fix memory block reference leak on remove lib: kunit_iov_iter: fix test fail on powerpc mm/page_alloc: fix initialization of tags of the huge zero folio with init_on_free MAINTAINERS: add kexec@ list to LIVE UPDATE ENTRY MAINTAINERS: add tree for KDUMP and KEXEC selftests/mm: run_vmtests.sh: fix destructive tests invocation scripts/gdb: slab: update field names of struct kmem_cache scripts/gdb: mm: cast untyped symbols in x86_page_ops mm/damon: fix damos_stat tracepoint format for sz_applied mm/damon/sysfs-schemes: call missing mem_cgroup_iter_break() mm/migrate_device: fix spinlock leak in migrate_vma_insert_huge_pmd_page
2 parents ab5fce8 + be3f38d commit c6e99c1

17 files changed

Lines changed: 116 additions & 36 deletions

File tree

MAINTAINERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13869,6 +13869,7 @@ M: Pratyush Yadav <pratyush@kernel.org>
1386913869
R: Dave Young <ruirui.yang@linux.dev>
1387013870
L: kexec@lists.infradead.org
1387113871
S: Maintained
13872+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/liveupdate/linux.git
1387213873
F: Documentation/admin-guide/kdump/
1387313874
F: fs/proc/vmcore.c
1387413875
F: include/linux/crash_core.h
@@ -14186,6 +14187,7 @@ M: Pasha Tatashin <pasha.tatashin@soleen.com>
1418614187
M: Pratyush Yadav <pratyush@kernel.org>
1418714188
L: kexec@lists.infradead.org
1418814189
W: http://kernel.org/pub/linux/utils/kernel/kexec/
14190+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/liveupdate/linux.git
1418914191
F: include/linux/kexec.h
1419014192
F: include/uapi/linux/kexec.h
1419114193
F: kernel/kexec*
@@ -14902,6 +14904,7 @@ LIVE UPDATE
1490214904
M: Pasha Tatashin <pasha.tatashin@soleen.com>
1490314905
M: Mike Rapoport <rppt@kernel.org>
1490414906
M: Pratyush Yadav <pratyush@kernel.org>
14907+
L: kexec@lists.infradead.org
1490514908
L: linux-kernel@vger.kernel.org
1490614909
S: Maintained
1490714910
T: git git://git.kernel.org/pub/scm/linux/kernel/git/liveupdate/linux.git

arch/arm64/include/asm/page.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct folio *vma_alloc_zeroed_movable_folio(struct vm_area_struct *vma,
3333
unsigned long vaddr);
3434
#define vma_alloc_zeroed_movable_folio vma_alloc_zeroed_movable_folio
3535

36-
bool tag_clear_highpages(struct page *to, int numpages);
36+
bool tag_clear_highpages(struct page *to, int numpages, bool clear_pages);
3737
#define __HAVE_ARCH_TAG_CLEAR_HIGHPAGES
3838

3939
#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)

arch/arm64/mm/fault.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,21 +1018,24 @@ struct folio *vma_alloc_zeroed_movable_folio(struct vm_area_struct *vma,
10181018
return vma_alloc_folio(flags, 0, vma, vaddr);
10191019
}
10201020

1021-
bool tag_clear_highpages(struct page *page, int numpages)
1021+
bool tag_clear_highpages(struct page *page, int numpages, bool clear_pages)
10221022
{
10231023
/*
10241024
* Check if MTE is supported and fall back to clear_highpage().
10251025
* get_huge_zero_folio() unconditionally passes __GFP_ZEROTAGS and
10261026
* post_alloc_hook() will invoke tag_clear_highpages().
10271027
*/
10281028
if (!system_supports_mte())
1029-
return false;
1029+
return clear_pages;
10301030

10311031
/* Newly allocated pages, shouldn't have been tagged yet */
10321032
for (int i = 0; i < numpages; i++, page++) {
10331033
WARN_ON_ONCE(!try_page_mte_tagging(page));
1034-
mte_zero_clear_page_tags(page_address(page));
1034+
if (clear_pages)
1035+
mte_zero_clear_page_tags(page_address(page));
1036+
else
1037+
mte_clear_page_tags(page_address(page));
10351038
set_page_mte_tagged(page);
10361039
}
1037-
return true;
1040+
return false;
10381041
}

drivers/base/memory.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,17 +1230,21 @@ void memblk_nr_poison_inc(unsigned long pfn)
12301230
const unsigned long block_id = pfn_to_block_id(pfn);
12311231
struct memory_block *mem = find_memory_block_by_id(block_id);
12321232

1233-
if (mem)
1233+
if (mem) {
12341234
atomic_long_inc(&mem->nr_hwpoison);
1235+
put_device(&mem->dev);
1236+
}
12351237
}
12361238

12371239
void memblk_nr_poison_sub(unsigned long pfn, long i)
12381240
{
12391241
const unsigned long block_id = pfn_to_block_id(pfn);
12401242
struct memory_block *mem = find_memory_block_by_id(block_id);
12411243

1242-
if (mem)
1244+
if (mem) {
12431245
atomic_long_sub(i, &mem->nr_hwpoison);
1246+
put_device(&mem->dev);
1247+
}
12441248
}
12451249

12461250
static unsigned long memblk_nr_poison(struct memory_block *mem)

include/linux/gfp_types.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,11 +273,11 @@ enum {
273273
*
274274
* %__GFP_ZERO returns a zeroed page on success.
275275
*
276-
* %__GFP_ZEROTAGS zeroes memory tags at allocation time if the memory itself
277-
* is being zeroed (either via __GFP_ZERO or via init_on_alloc, provided that
278-
* __GFP_SKIP_ZERO is not set). This flag is intended for optimization: setting
279-
* memory tags at the same time as zeroing memory has minimal additional
280-
* performance impact.
276+
* %__GFP_ZEROTAGS zeroes memory tags at allocation time. Setting memory tags at
277+
* the same time as zeroing memory (e.g., with __GFP_ZERO) has minimal
278+
* additional performance impact. However, __GFP_ZEROTAGS also zeroes the tags
279+
* even if memory is not getting zeroed at allocation time (e.g.,
280+
* with init_on_free).
281281
*
282282
* %__GFP_SKIP_KASAN makes KASAN skip unpoisoning on page allocation.
283283
* Used for userspace and vmalloc pages; the latter are unpoisoned by

include/linux/highmem.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,11 @@ static inline void clear_highpage_kasan_tagged(struct page *page)
347347

348348
#ifndef __HAVE_ARCH_TAG_CLEAR_HIGHPAGES
349349

350-
/* Return false to let people know we did not initialize the pages */
351-
static inline bool tag_clear_highpages(struct page *page, int numpages)
350+
/* Returns true if the caller has to initialize the pages */
351+
static inline bool tag_clear_highpages(struct page *page, int numpages,
352+
bool clear_pages)
352353
{
353-
return false;
354+
return clear_pages;
354355
}
355356

356357
#endif

include/trace/events/damon.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ TRACE_EVENT(damos_stat_after_apply_interval,
4141
),
4242

4343
TP_printk("ctx_idx=%u scheme_idx=%u nr_tried=%lu sz_tried=%lu "
44-
"nr_applied=%lu sz_tried=%lu sz_ops_filter_passed=%lu "
44+
"nr_applied=%lu sz_applied=%lu sz_ops_filter_passed=%lu "
4545
"qt_exceeds=%lu nr_snapshots=%lu",
4646
__entry->context_idx, __entry->scheme_idx,
4747
__entry->nr_tried, __entry->sz_tried,

lib/tests/kunit_iov_iter.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,7 @@ static void __init iov_kunit_iter_to_sg_kvec(struct kunit *test)
11281128
struct kvec kvec;
11291129
size_t bufsize;
11301130

1131-
bufsize = 0x100000;
1131+
bufsize = 0x200000;
11321132
iov_kunit_iter_to_sg_init(test, bufsize, false, &data);
11331133

11341134
kvec.iov_base = data.buffer;
@@ -1146,7 +1146,7 @@ static void __init iov_kunit_iter_to_sg_bvec(struct kunit *test)
11461146
struct bio_vec *bvec;
11471147
struct iov_iter iter;
11481148

1149-
bufsize = 0x100000;
1149+
bufsize = 0x200000;
11501150
iov_kunit_iter_to_sg_init(test, bufsize, false, &data);
11511151

11521152
bvec = kunit_kmalloc_array(test, data.npages, sizeof(*bvec),
@@ -1173,7 +1173,7 @@ static void __init iov_kunit_iter_to_sg_folioq(struct kunit *test)
11731173
struct iov_iter iter;
11741174
size_t bufsize;
11751175

1176-
bufsize = 0x100000;
1176+
bufsize = 0x200000;
11771177
iov_kunit_iter_to_sg_init(test, bufsize, false, &data);
11781178

11791179
folioq = iov_kunit_create_folioq(test);
@@ -1190,7 +1190,7 @@ static void __init iov_kunit_iter_to_sg_xarray(struct kunit *test)
11901190
struct iov_iter iter;
11911191
size_t bufsize;
11921192

1193-
bufsize = 0x100000;
1193+
bufsize = 0x200000;
11941194
iov_kunit_iter_to_sg_init(test, bufsize, false, &data);
11951195

11961196
xarray = iov_kunit_create_xarray(test);
@@ -1206,7 +1206,7 @@ static void __init iov_kunit_iter_to_sg_ubuf(struct kunit *test)
12061206
struct iov_iter iter;
12071207
size_t bufsize;
12081208

1209-
bufsize = 0x100000;
1209+
bufsize = 0x200000;
12101210
iov_kunit_iter_to_sg_init(test, bufsize, true, &data);
12111211

12121212
iov_iter_ubuf(&iter, READ, data.ubuf, bufsize);

mm/damon/sysfs-schemes.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2594,6 +2594,7 @@ static int damon_sysfs_memcg_path_to_id(char *memcg_path, u64 *id)
25942594
if (damon_sysfs_memcg_path_eq(memcg, path, memcg_path)) {
25952595
*id = mem_cgroup_id(memcg);
25962596
found = true;
2597+
mem_cgroup_iter_break(NULL, memcg);
25972598
break;
25982599
}
25992600
}

mm/memory.c

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,21 @@ static void print_bad_page_map(struct vm_area_struct *vma,
612612
dump_stack();
613613
add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE);
614614
}
615+
616+
static inline bool pgtable_level_has_pxx_special(enum pgtable_level level)
617+
{
618+
switch (level) {
619+
case PGTABLE_LEVEL_PTE:
620+
return IS_ENABLED(CONFIG_ARCH_HAS_PTE_SPECIAL);
621+
case PGTABLE_LEVEL_PMD:
622+
return IS_ENABLED(CONFIG_ARCH_SUPPORTS_PMD_PFNMAP);
623+
case PGTABLE_LEVEL_PUD:
624+
return IS_ENABLED(CONFIG_ARCH_SUPPORTS_PUD_PFNMAP);
625+
default:
626+
return false;
627+
}
628+
}
629+
615630
#define print_bad_pte(vma, addr, pte, page) \
616631
print_bad_page_map(vma, addr, pte_val(pte), page, PGTABLE_LEVEL_PTE)
617632

@@ -684,7 +699,7 @@ static inline struct page *__vm_normal_page(struct vm_area_struct *vma,
684699
unsigned long addr, unsigned long pfn, bool special,
685700
unsigned long long entry, enum pgtable_level level)
686701
{
687-
if (IS_ENABLED(CONFIG_ARCH_HAS_PTE_SPECIAL)) {
702+
if (pgtable_level_has_pxx_special(level)) {
688703
if (unlikely(special)) {
689704
#ifdef CONFIG_FIND_NORMAL_PAGE
690705
if (vma->vm_ops && vma->vm_ops->find_normal_page)
@@ -699,8 +714,9 @@ static inline struct page *__vm_normal_page(struct vm_area_struct *vma,
699714
return NULL;
700715
}
701716
/*
702-
* With CONFIG_ARCH_HAS_PTE_SPECIAL, any special page table
703-
* mappings (incl. shared zero folios) are marked accordingly.
717+
* With working pte_special()/pmd_special()..., any special page
718+
* table mappings (incl. shared zero folios) are marked
719+
* accordingly.
704720
*/
705721
} else {
706722
if (unlikely(vma->vm_flags & (VM_PFNMAP | VM_MIXEDMAP))) {
@@ -1739,7 +1755,7 @@ static inline int zap_nonpresent_ptes(struct mmu_gather *tlb,
17391755
* consider uffd-wp bit when zap. For more information,
17401756
* see zap_install_uffd_wp_if_needed().
17411757
*/
1742-
WARN_ON_ONCE(!vma_is_anonymous(vma));
1758+
WARN_ON_ONCE(!folio_test_anon(folio));
17431759
rss[mm_counter(folio)]--;
17441760
folio_remove_rmap_pte(folio, page, vma);
17451761
folio_put(folio);

0 commit comments

Comments
 (0)