Skip to content

Commit 0fd39af

Browse files
committed
Merge tag 'mm-hotfixes-stable-2025-06-27-16-56' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull misc fixes from Andrew Morton: "16 hotfixes. 6 are cc:stable and the remainder address post-6.15 issues or aren't considered necessary for -stable kernels. 5 are for MM" * tag 'mm-hotfixes-stable-2025-06-27-16-56' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: MAINTAINERS: add Lorenzo as THP co-maintainer mailmap: update Duje Mihanović's email address selftests/mm: fix validate_addr() helper crashdump: add CONFIG_KEYS dependency mailmap: correct name for a historical account of Zijun Hu mailmap: add entries for Zijun Hu fuse: fix runtime warning on truncate_folio_batch_exceptionals() scripts/gdb: fix dentry_name() lookup mm/damon/sysfs-schemes: free old damon_sysfs_scheme_filter->memcg_path on write mm/alloc_tag: fix the kmemleak false positive issue in the allocation of the percpu variable tag->counters lib/group_cpus: fix NULL pointer dereference from group_cpus_evenly() mm/hugetlb: remove unnecessary holding of hugetlb_lock MAINTAINERS: add missing files to mm page alloc section MAINTAINERS: add tree entry to mm init block mm: add OOM killer maintainer structure fs/proc/task_mmu: fix PAGE_IS_PFNZERO detection for the huge zero folio
2 parents 867b998 + c0cb210 commit 0fd39af

File tree

13 files changed

+90
-44
lines changed

13 files changed

+90
-44
lines changed

.mailmap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ Dmitry Safonov <[email protected]> <[email protected]>
224224
Domen Puncer <[email protected]>
225225
Douglas Gilbert <[email protected]>
226226
227+
227228
Ed L. Cashin <[email protected]>
228229
229230
Enric Balletbo i Serra <[email protected]> <[email protected]>
@@ -831,3 +832,6 @@ Yosry Ahmed <[email protected]> <[email protected]>
831832
Yusuke Goda <[email protected]>
832833
833834
835+
836+
837+

MAINTAINERS

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15676,6 +15676,8 @@ MEMBLOCK AND MEMORY MANAGEMENT INITIALIZATION
1567615676
M: Mike Rapoport <[email protected]>
1567715677
1567815678
S: Maintained
15679+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock.git for-next
15680+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock.git fixes
1567915681
F: Documentation/core-api/boot-time-mm.rst
1568015682
F: Documentation/core-api/kho/bindings/memblock/*
1568115683
F: include/linux/memblock.h
@@ -15848,6 +15850,17 @@ F: mm/numa.c
1584815850
F: mm/numa_emulation.c
1584915851
F: mm/numa_memblks.c
1585015852

15853+
MEMORY MANAGEMENT - OOM KILLER
15854+
M: Michal Hocko <[email protected]>
15855+
R: David Rientjes <[email protected]>
15856+
R: Shakeel Butt <[email protected]>
15857+
15858+
S: Maintained
15859+
F: include/linux/oom.h
15860+
F: include/trace/events/oom.h
15861+
F: include/uapi/linux/oom.h
15862+
F: mm/oom_kill.c
15863+
1585115864
MEMORY MANAGEMENT - PAGE ALLOCATOR
1585215865
M: Andrew Morton <[email protected]>
1585315866
M: Vlastimil Babka <[email protected]>
@@ -15862,8 +15875,17 @@ F: include/linux/compaction.h
1586215875
F: include/linux/gfp.h
1586315876
F: include/linux/page-isolation.h
1586415877
F: mm/compaction.c
15878+
F: mm/debug_page_alloc.c
15879+
F: mm/fail_page_alloc.c
1586515880
F: mm/page_alloc.c
15881+
F: mm/page_ext.c
15882+
F: mm/page_frag_cache.c
1586615883
F: mm/page_isolation.c
15884+
F: mm/page_owner.c
15885+
F: mm/page_poison.c
15886+
F: mm/page_reporting.c
15887+
F: mm/show_mem.c
15888+
F: mm/shuffle.c
1586715889

1586815890
MEMORY MANAGEMENT - RECLAIM
1586915891
M: Andrew Morton <[email protected]>
@@ -15923,9 +15945,9 @@ F: mm/swapfile.c
1592315945
MEMORY MANAGEMENT - THP (TRANSPARENT HUGE PAGE)
1592415946
M: Andrew Morton <[email protected]>
1592515947
M: David Hildenbrand <[email protected]>
15948+
M: Lorenzo Stoakes <[email protected]>
1592615949
R: Zi Yan <[email protected]>
1592715950
R: Baolin Wang <[email protected]>
15928-
R: Lorenzo Stoakes <[email protected]>
1592915951
R: Liam R. Howlett <[email protected]>
1593015952
R: Nico Pache <[email protected]>
1593115953
R: Ryan Roberts <[email protected]>

fs/fuse/inode.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "fuse_i.h"
1010
#include "dev_uring_i.h"
1111

12+
#include <linux/dax.h>
1213
#include <linux/pagemap.h>
1314
#include <linux/slab.h>
1415
#include <linux/file.h>
@@ -162,6 +163,9 @@ static void fuse_evict_inode(struct inode *inode)
162163
/* Will write inode on close/munmap and in all other dirtiers */
163164
WARN_ON(inode->i_state & I_DIRTY_INODE);
164165

166+
if (FUSE_IS_DAX(inode))
167+
dax_break_layout_final(inode);
168+
165169
truncate_inode_pages_final(&inode->i_data);
166170
clear_inode(inode);
167171
if (inode->i_sb->s_flags & SB_ACTIVE) {

fs/proc/task_mmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2182,7 +2182,7 @@ static unsigned long pagemap_thp_category(struct pagemap_scan_private *p,
21822182
categories |= PAGE_IS_FILE;
21832183
}
21842184

2185-
if (is_zero_pfn(pmd_pfn(pmd)))
2185+
if (is_huge_zero_pmd(pmd))
21862186
categories |= PAGE_IS_PFNZERO;
21872187
if (pmd_soft_dirty(pmd))
21882188
categories |= PAGE_IS_SOFT_DIRTY;

include/linux/kmemleak.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ extern void kmemleak_update_trace(const void *ptr) __ref;
2828
extern void kmemleak_not_leak(const void *ptr) __ref;
2929
extern void kmemleak_transient_leak(const void *ptr) __ref;
3030
extern void kmemleak_ignore(const void *ptr) __ref;
31+
extern void kmemleak_ignore_percpu(const void __percpu *ptr) __ref;
3132
extern void kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp) __ref;
3233
extern void kmemleak_no_scan(const void *ptr) __ref;
3334
extern void kmemleak_alloc_phys(phys_addr_t phys, size_t size,
@@ -97,6 +98,9 @@ static inline void kmemleak_not_leak(const void *ptr)
9798
static inline void kmemleak_transient_leak(const void *ptr)
9899
{
99100
}
101+
static inline void kmemleak_ignore_percpu(const void __percpu *ptr)
102+
{
103+
}
100104
static inline void kmemleak_ignore(const void *ptr)
101105
{
102106
}

kernel/Kconfig.kexec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ config CRASH_DM_CRYPT
134134
depends on KEXEC_FILE
135135
depends on CRASH_DUMP
136136
depends on DM_CRYPT
137+
depends on KEYS
137138
help
138139
With this option enabled, user space can intereact with
139140
/sys/kernel/config/crash_dm_crypt_keys to make the dm crypt keys

lib/alloc_tag.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/seq_buf.h>
1111
#include <linux/seq_file.h>
1212
#include <linux/vmalloc.h>
13+
#include <linux/kmemleak.h>
1314

1415
#define ALLOCINFO_FILE_NAME "allocinfo"
1516
#define MODULE_ALLOC_TAG_VMAP_SIZE (100000UL * sizeof(struct alloc_tag))
@@ -632,8 +633,13 @@ static int load_module(struct module *mod, struct codetag *start, struct codetag
632633
mod->name);
633634
return -ENOMEM;
634635
}
635-
}
636636

637+
/*
638+
* Avoid a kmemleak false positive. The pointer to the counters is stored
639+
* in the alloc_tag section of the module and cannot be directly accessed.
640+
*/
641+
kmemleak_ignore_percpu(tag->counters);
642+
}
637643
return 0;
638644
}
639645

lib/group_cpus.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,9 @@ struct cpumask *group_cpus_evenly(unsigned int numgrps)
352352
int ret = -ENOMEM;
353353
struct cpumask *masks = NULL;
354354

355+
if (numgrps == 0)
356+
return NULL;
357+
355358
if (!zalloc_cpumask_var(&nmsk, GFP_KERNEL))
356359
return NULL;
357360

@@ -426,8 +429,12 @@ struct cpumask *group_cpus_evenly(unsigned int numgrps)
426429
#else /* CONFIG_SMP */
427430
struct cpumask *group_cpus_evenly(unsigned int numgrps)
428431
{
429-
struct cpumask *masks = kcalloc(numgrps, sizeof(*masks), GFP_KERNEL);
432+
struct cpumask *masks;
430433

434+
if (numgrps == 0)
435+
return NULL;
436+
437+
masks = kcalloc(numgrps, sizeof(*masks), GFP_KERNEL);
431438
if (!masks)
432439
return NULL;
433440

mm/damon/sysfs-schemes.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ static ssize_t memcg_path_store(struct kobject *kobj,
472472
return -ENOMEM;
473473

474474
strscpy(path, buf, count + 1);
475+
kfree(filter->memcg_path);
475476
filter->memcg_path = path;
476477
return count;
477478
}

mm/hugetlb.c

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2787,20 +2787,24 @@ void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma,
27872787
/*
27882788
* alloc_and_dissolve_hugetlb_folio - Allocate a new folio and dissolve
27892789
* the old one
2790-
* @h: struct hstate old page belongs to
27912790
* @old_folio: Old folio to dissolve
27922791
* @list: List to isolate the page in case we need to
27932792
* Returns 0 on success, otherwise negated error.
27942793
*/
2795-
static int alloc_and_dissolve_hugetlb_folio(struct hstate *h,
2796-
struct folio *old_folio, struct list_head *list)
2794+
static int alloc_and_dissolve_hugetlb_folio(struct folio *old_folio,
2795+
struct list_head *list)
27972796
{
2798-
gfp_t gfp_mask = htlb_alloc_mask(h) | __GFP_THISNODE;
2797+
gfp_t gfp_mask;
2798+
struct hstate *h;
27992799
int nid = folio_nid(old_folio);
28002800
struct folio *new_folio = NULL;
28012801
int ret = 0;
28022802

28032803
retry:
2804+
/*
2805+
* The old_folio might have been dissolved from under our feet, so make sure
2806+
* to carefully check the state under the lock.
2807+
*/
28042808
spin_lock_irq(&hugetlb_lock);
28052809
if (!folio_test_hugetlb(old_folio)) {
28062810
/*
@@ -2829,8 +2833,10 @@ static int alloc_and_dissolve_hugetlb_folio(struct hstate *h,
28292833
cond_resched();
28302834
goto retry;
28312835
} else {
2836+
h = folio_hstate(old_folio);
28322837
if (!new_folio) {
28332838
spin_unlock_irq(&hugetlb_lock);
2839+
gfp_mask = htlb_alloc_mask(h) | __GFP_THISNODE;
28342840
new_folio = alloc_buddy_hugetlb_folio(h, gfp_mask, nid,
28352841
NULL, NULL);
28362842
if (!new_folio)
@@ -2874,35 +2880,24 @@ static int alloc_and_dissolve_hugetlb_folio(struct hstate *h,
28742880

28752881
int isolate_or_dissolve_huge_folio(struct folio *folio, struct list_head *list)
28762882
{
2877-
struct hstate *h;
28782883
int ret = -EBUSY;
28792884

2880-
/*
2881-
* The page might have been dissolved from under our feet, so make sure
2882-
* to carefully check the state under the lock.
2883-
* Return success when racing as if we dissolved the page ourselves.
2884-
*/
2885-
spin_lock_irq(&hugetlb_lock);
2886-
if (folio_test_hugetlb(folio)) {
2887-
h = folio_hstate(folio);
2888-
} else {
2889-
spin_unlock_irq(&hugetlb_lock);
2885+
/* Not to disrupt normal path by vainly holding hugetlb_lock */
2886+
if (!folio_test_hugetlb(folio))
28902887
return 0;
2891-
}
2892-
spin_unlock_irq(&hugetlb_lock);
28932888

28942889
/*
28952890
* Fence off gigantic pages as there is a cyclic dependency between
28962891
* alloc_contig_range and them. Return -ENOMEM as this has the effect
28972892
* of bailing out right away without further retrying.
28982893
*/
2899-
if (hstate_is_gigantic(h))
2894+
if (folio_order(folio) > MAX_PAGE_ORDER)
29002895
return -ENOMEM;
29012896

29022897
if (folio_ref_count(folio) && folio_isolate_hugetlb(folio, list))
29032898
ret = 0;
29042899
else if (!folio_ref_count(folio))
2905-
ret = alloc_and_dissolve_hugetlb_folio(h, folio, list);
2900+
ret = alloc_and_dissolve_hugetlb_folio(folio, list);
29062901

29072902
return ret;
29082903
}
@@ -2916,7 +2911,6 @@ int isolate_or_dissolve_huge_folio(struct folio *folio, struct list_head *list)
29162911
*/
29172912
int replace_free_hugepage_folios(unsigned long start_pfn, unsigned long end_pfn)
29182913
{
2919-
struct hstate *h;
29202914
struct folio *folio;
29212915
int ret = 0;
29222916

@@ -2925,23 +2919,9 @@ int replace_free_hugepage_folios(unsigned long start_pfn, unsigned long end_pfn)
29252919
while (start_pfn < end_pfn) {
29262920
folio = pfn_folio(start_pfn);
29272921

2928-
/*
2929-
* The folio might have been dissolved from under our feet, so make sure
2930-
* to carefully check the state under the lock.
2931-
*/
2932-
spin_lock_irq(&hugetlb_lock);
2933-
if (folio_test_hugetlb(folio)) {
2934-
h = folio_hstate(folio);
2935-
} else {
2936-
spin_unlock_irq(&hugetlb_lock);
2937-
start_pfn++;
2938-
continue;
2939-
}
2940-
spin_unlock_irq(&hugetlb_lock);
2941-
2942-
if (!folio_ref_count(folio)) {
2943-
ret = alloc_and_dissolve_hugetlb_folio(h, folio,
2944-
&isolate_list);
2922+
/* Not to disrupt normal path by vainly holding hugetlb_lock */
2923+
if (folio_test_hugetlb(folio) && !folio_ref_count(folio)) {
2924+
ret = alloc_and_dissolve_hugetlb_folio(folio, &isolate_list);
29452925
if (ret)
29462926
break;
29472927

0 commit comments

Comments
 (0)