Skip to content

Commit 0f8c025

Browse files
committed
Merge tag 'mm-hotfixes-stable-2025-05-25-00-58' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull hotfixes from Andrew Morton: "22 hotfixes. 13 are cc:stable and the remainder address post-6.14 issues or aren't considered necessary for -stable kernels. 19 are for MM" * tag 'mm-hotfixes-stable-2025-05-25-00-58' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (22 commits) mailmap: add Jarkko's employer email address mm: fix copy_vma() error handling for hugetlb mappings memcg: always call cond_resched() after fn() mm/hugetlb: fix kernel NULL pointer dereference when replacing free hugetlb folios mm: vmalloc: only zero-init on vrealloc shrink mm: vmalloc: actually use the in-place vrealloc region alloc_tag: allocate percpu counters for module tags dynamically module: release codetag section when module load fails mm/cma: make detection of highmem_start more robust MAINTAINERS: add mm memory policy section MAINTAINERS: add mm ksm section kasan: avoid sleepable page allocation from atomic context highmem: add folio_test_partial_kmap() MAINTAINERS: add hung-task detector section taskstats: fix struct taskstats breaks backward compatibility since version 15 mm/truncate: fix out-of-bounds when doing a right-aligned split MAINTAINERS: add mm reclaim section MAINTAINERS: update page allocator section mm: fix VM_UFFD_MINOR == VM_SHADOW_STACK on USERFAULTFD=y && ARM64_GCS=y mm: mmap: map MAP_STACK to VM_NOHUGEPAGE only if THP is enabled ...
2 parents d0c22de + 1ec971d commit 0f8c025

File tree

23 files changed

+338
-91
lines changed

23 files changed

+338
-91
lines changed

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ Jan Glauber <[email protected]> <[email protected]>
313313
314314
315315
316+
316317
317318
318319

MAINTAINERS

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11106,6 +11106,14 @@ L: [email protected]
1110611106
S: Odd Fixes
1110711107
F: drivers/tty/hvc/
1110811108

11109+
HUNG TASK DETECTOR
11110+
M: Andrew Morton <[email protected]>
11111+
R: Lance Yang <[email protected]>
11112+
11113+
S: Maintained
11114+
F: include/linux/hung_task.h
11115+
F: kernel/hung_task.c
11116+
1110911117
I2C ACPI SUPPORT
1111011118
M: Mika Westerberg <[email protected]>
1111111119
@@ -15561,6 +15569,41 @@ W: http://www.linux-mm.org
1556115569
T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
1556215570
F: mm/gup.c
1556315571

15572+
MEMORY MANAGEMENT - KSM (Kernel Samepage Merging)
15573+
M: Andrew Morton <[email protected]>
15574+
M: David Hildenbrand <[email protected]>
15575+
R: Xu Xin <[email protected]>
15576+
R: Chengming Zhou <[email protected]>
15577+
15578+
S: Maintained
15579+
W: http://www.linux-mm.org
15580+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
15581+
F: Documentation/admin-guide/mm/ksm.rst
15582+
F: Documentation/mm/ksm.rst
15583+
F: include/linux/ksm.h
15584+
F: include/trace/events/ksm.h
15585+
F: mm/ksm.c
15586+
15587+
MEMORY MANAGEMENT - MEMORY POLICY AND MIGRATION
15588+
M: Andrew Morton <[email protected]>
15589+
M: David Hildenbrand <[email protected]>
15590+
R: Zi Yan <[email protected]>
15591+
R: Matthew Brost <[email protected]>
15592+
R: Joshua Hahn <[email protected]>
15593+
R: Rakie Kim <[email protected]>
15594+
R: Byungchul Park <[email protected]>
15595+
R: Gregory Price <[email protected]>
15596+
R: Ying Huang <[email protected]>
15597+
15598+
S: Maintained
15599+
W: http://www.linux-mm.org
15600+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
15601+
F: include/linux/mempolicy.h
15602+
F: include/linux/migrate.h
15603+
F: mm/mempolicy.c
15604+
F: mm/migrate.c
15605+
F: mm/migrate_device.c
15606+
1556415607
MEMORY MANAGEMENT - NUMA MEMBLOCKS AND NUMA EMULATION
1556515608
M: Andrew Morton <[email protected]>
1556615609
M: Mike Rapoport <[email protected]>
@@ -15573,18 +15616,33 @@ F: mm/numa_memblks.c
1557315616

1557415617
MEMORY MANAGEMENT - PAGE ALLOCATOR
1557515618
M: Andrew Morton <[email protected]>
15576-
R: Vlastimil Babka <[email protected]>
15619+
M: Vlastimil Babka <[email protected]>
1557715620
R: Suren Baghdasaryan <[email protected]>
1557815621
R: Michal Hocko <[email protected]>
1557915622
R: Brendan Jackman <[email protected]>
1558015623
R: Johannes Weiner <[email protected]>
1558115624
R: Zi Yan <[email protected]>
1558215625
1558315626
S: Maintained
15627+
F: include/linux/compaction.h
15628+
F: include/linux/gfp.h
15629+
F: include/linux/page-isolation.h
1558415630
F: mm/compaction.c
1558515631
F: mm/page_alloc.c
15586-
F: include/linux/gfp.h
15587-
F: include/linux/compaction.h
15632+
F: mm/page_isolation.c
15633+
15634+
MEMORY MANAGEMENT - RECLAIM
15635+
M: Andrew Morton <[email protected]>
15636+
M: Johannes Weiner <[email protected]>
15637+
R: David Hildenbrand <[email protected]>
15638+
R: Michal Hocko <[email protected]>
15639+
R: Qi Zheng <[email protected]>
15640+
R: Shakeel Butt <[email protected]>
15641+
R: Lorenzo Stoakes <[email protected]>
15642+
15643+
S: Maintained
15644+
F: mm/pt_reclaim.c
15645+
F: mm/vmscan.c
1558815646

1558915647
MEMORY MANAGEMENT - RMAP (REVERSE MAPPING)
1559015648
M: Andrew Morton <[email protected]>
@@ -25912,7 +25970,7 @@ F: tools/testing/vsock/
2591225970

2591325971
VMALLOC
2591425972
M: Andrew Morton <[email protected]>
25915-
R: Uladzislau Rezki <[email protected]>
25973+
M: Uladzislau Rezki <[email protected]>
2591625974
2591725975
S: Maintained
2591825976
W: http://www.linux-mm.org

include/linux/alloc_tag.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,25 @@ DECLARE_PER_CPU(struct alloc_tag_counters, _shared_alloc_tag);
104104

105105
#else /* ARCH_NEEDS_WEAK_PER_CPU */
106106

107+
#ifdef MODULE
108+
109+
#define DEFINE_ALLOC_TAG(_alloc_tag) \
110+
static struct alloc_tag _alloc_tag __used __aligned(8) \
111+
__section(ALLOC_TAG_SECTION_NAME) = { \
112+
.ct = CODE_TAG_INIT, \
113+
.counters = NULL };
114+
115+
#else /* MODULE */
116+
107117
#define DEFINE_ALLOC_TAG(_alloc_tag) \
108118
static DEFINE_PER_CPU(struct alloc_tag_counters, _alloc_tag_cntr); \
109119
static struct alloc_tag _alloc_tag __used __aligned(8) \
110120
__section(ALLOC_TAG_SECTION_NAME) = { \
111121
.ct = CODE_TAG_INIT, \
112122
.counters = &_alloc_tag_cntr };
113123

124+
#endif /* MODULE */
125+
114126
#endif /* ARCH_NEEDS_WEAK_PER_CPU */
115127

116128
DECLARE_STATIC_KEY_MAYBE(CONFIG_MEM_ALLOC_PROFILING_ENABLED_BY_DEFAULT,

include/linux/codetag.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ union codetag_ref {
3636
struct codetag_type_desc {
3737
const char *section;
3838
size_t tag_size;
39-
void (*module_load)(struct codetag_type *cttype,
40-
struct codetag_module *cmod);
41-
void (*module_unload)(struct codetag_type *cttype,
42-
struct codetag_module *cmod);
39+
void (*module_load)(struct module *mod,
40+
struct codetag *start, struct codetag *end);
41+
void (*module_unload)(struct module *mod,
42+
struct codetag *start, struct codetag *end);
4343
#ifdef CONFIG_MODULES
4444
void (*module_replaced)(struct module *mod, struct module *new_mod);
4545
bool (*needs_section_mem)(struct module *mod, unsigned long size);

include/linux/highmem.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ static inline void memcpy_from_folio(char *to, struct folio *folio,
461461
const char *from = kmap_local_folio(folio, offset);
462462
size_t chunk = len;
463463

464-
if (folio_test_highmem(folio) &&
464+
if (folio_test_partial_kmap(folio) &&
465465
chunk > PAGE_SIZE - offset_in_page(offset))
466466
chunk = PAGE_SIZE - offset_in_page(offset);
467467
memcpy(to, from, chunk);
@@ -489,7 +489,7 @@ static inline void memcpy_to_folio(struct folio *folio, size_t offset,
489489
char *to = kmap_local_folio(folio, offset);
490490
size_t chunk = len;
491491

492-
if (folio_test_highmem(folio) &&
492+
if (folio_test_partial_kmap(folio) &&
493493
chunk > PAGE_SIZE - offset_in_page(offset))
494494
chunk = PAGE_SIZE - offset_in_page(offset);
495495
memcpy(to, from, chunk);
@@ -522,7 +522,7 @@ static inline __must_check void *folio_zero_tail(struct folio *folio,
522522
{
523523
size_t len = folio_size(folio) - offset;
524524

525-
if (folio_test_highmem(folio)) {
525+
if (folio_test_partial_kmap(folio)) {
526526
size_t max = PAGE_SIZE - offset_in_page(offset);
527527

528528
while (len > max) {
@@ -560,7 +560,7 @@ static inline void folio_fill_tail(struct folio *folio, size_t offset,
560560

561561
VM_BUG_ON(offset + len > folio_size(folio));
562562

563-
if (folio_test_highmem(folio)) {
563+
if (folio_test_partial_kmap(folio)) {
564564
size_t max = PAGE_SIZE - offset_in_page(offset);
565565

566566
while (len > max) {
@@ -597,7 +597,7 @@ static inline size_t memcpy_from_file_folio(char *to, struct folio *folio,
597597
size_t offset = offset_in_folio(folio, pos);
598598
char *from = kmap_local_folio(folio, offset);
599599

600-
if (folio_test_highmem(folio)) {
600+
if (folio_test_partial_kmap(folio)) {
601601
offset = offset_in_page(offset);
602602
len = min_t(size_t, len, PAGE_SIZE - offset);
603603
} else

include/linux/hugetlb.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ long hugetlb_change_protection(struct vm_area_struct *vma,
275275
bool is_hugetlb_entry_migration(pte_t pte);
276276
bool is_hugetlb_entry_hwpoisoned(pte_t pte);
277277
void hugetlb_unshare_all_pmds(struct vm_area_struct *vma);
278+
void fixup_hugetlb_reservations(struct vm_area_struct *vma);
278279

279280
#else /* !CONFIG_HUGETLB_PAGE */
280281

@@ -468,6 +469,10 @@ static inline vm_fault_t hugetlb_fault(struct mm_struct *mm,
468469

469470
static inline void hugetlb_unshare_all_pmds(struct vm_area_struct *vma) { }
470471

472+
static inline void fixup_hugetlb_reservations(struct vm_area_struct *vma)
473+
{
474+
}
475+
471476
#endif /* !CONFIG_HUGETLB_PAGE */
472477

473478
#ifndef pgd_write

include/linux/mm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ extern unsigned int kobjsize(const void *objp);
385385
#endif
386386

387387
#ifdef CONFIG_HAVE_ARCH_USERFAULTFD_MINOR
388-
# define VM_UFFD_MINOR_BIT 38
388+
# define VM_UFFD_MINOR_BIT 41
389389
# define VM_UFFD_MINOR BIT(VM_UFFD_MINOR_BIT) /* UFFD minor faults */
390390
#else /* !CONFIG_HAVE_ARCH_USERFAULTFD_MINOR */
391391
# define VM_UFFD_MINOR VM_NONE

include/linux/mman.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,9 @@ calc_vm_flag_bits(struct file *file, unsigned long flags)
155155
return _calc_vm_trans(flags, MAP_GROWSDOWN, VM_GROWSDOWN ) |
156156
_calc_vm_trans(flags, MAP_LOCKED, VM_LOCKED ) |
157157
_calc_vm_trans(flags, MAP_SYNC, VM_SYNC ) |
158+
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
158159
_calc_vm_trans(flags, MAP_STACK, VM_NOHUGEPAGE) |
160+
#endif
159161
arch_calc_vm_flag_bits(file, flags);
160162
}
161163

include/linux/page-flags.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,13 @@ FOLIO_FLAG(dropbehind, FOLIO_HEAD_PAGE)
615615
PAGEFLAG_FALSE(HighMem, highmem)
616616
#endif
617617

618+
/* Does kmap_local_folio() only allow access to one page of the folio? */
619+
#ifdef CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP
620+
#define folio_test_partial_kmap(f) true
621+
#else
622+
#define folio_test_partial_kmap(f) folio_test_highmem(f)
623+
#endif
624+
618625
#ifdef CONFIG_SWAP
619626
static __always_inline bool folio_test_swapcache(const struct folio *folio)
620627
{

include/linux/percpu.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@
1515

1616
/* enough to cover all DEFINE_PER_CPUs in modules */
1717
#ifdef CONFIG_MODULES
18-
#ifdef CONFIG_MEM_ALLOC_PROFILING
19-
#define PERCPU_MODULE_RESERVE (8 << 13)
20-
#else
2118
#define PERCPU_MODULE_RESERVE (8 << 10)
22-
#endif
2319
#else
2420
#define PERCPU_MODULE_RESERVE 0
2521
#endif

include/uapi/linux/taskstats.h

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
*/
3535

3636

37-
#define TASKSTATS_VERSION 15
37+
#define TASKSTATS_VERSION 16
3838
#define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN
3939
* in linux/sched.h */
4040

@@ -72,8 +72,6 @@ struct taskstats {
7272
*/
7373
__u64 cpu_count __attribute__((aligned(8)));
7474
__u64 cpu_delay_total;
75-
__u64 cpu_delay_max;
76-
__u64 cpu_delay_min;
7775

7876
/* Following four fields atomically updated using task->delays->lock */
7977

@@ -82,14 +80,10 @@ struct taskstats {
8280
*/
8381
__u64 blkio_count;
8482
__u64 blkio_delay_total;
85-
__u64 blkio_delay_max;
86-
__u64 blkio_delay_min;
8783

8884
/* Delay waiting for page fault I/O (swap in only) */
8985
__u64 swapin_count;
9086
__u64 swapin_delay_total;
91-
__u64 swapin_delay_max;
92-
__u64 swapin_delay_min;
9387

9488
/* cpu "wall-clock" running time
9589
* On some architectures, value will adjust for cpu time stolen
@@ -172,23 +166,18 @@ struct taskstats {
172166
/* Delay waiting for memory reclaim */
173167
__u64 freepages_count;
174168
__u64 freepages_delay_total;
175-
__u64 freepages_delay_max;
176-
__u64 freepages_delay_min;
169+
177170

178171
/* Delay waiting for thrashing page */
179172
__u64 thrashing_count;
180173
__u64 thrashing_delay_total;
181-
__u64 thrashing_delay_max;
182-
__u64 thrashing_delay_min;
183174

184175
/* v10: 64-bit btime to avoid overflow */
185176
__u64 ac_btime64; /* 64-bit begin time */
186177

187178
/* v11: Delay waiting for memory compact */
188179
__u64 compact_count;
189180
__u64 compact_delay_total;
190-
__u64 compact_delay_max;
191-
__u64 compact_delay_min;
192181

193182
/* v12 begin */
194183
__u32 ac_tgid; /* thread group ID */
@@ -210,15 +199,37 @@ struct taskstats {
210199
/* v13: Delay waiting for write-protect copy */
211200
__u64 wpcopy_count;
212201
__u64 wpcopy_delay_total;
213-
__u64 wpcopy_delay_max;
214-
__u64 wpcopy_delay_min;
215202

216203
/* v14: Delay waiting for IRQ/SOFTIRQ */
217204
__u64 irq_count;
218205
__u64 irq_delay_total;
219-
__u64 irq_delay_max;
220-
__u64 irq_delay_min;
221-
/* v15: add Delay max */
206+
207+
/* v15: add Delay max and Delay min */
208+
209+
/* v16: move Delay max and Delay min to the end of taskstat */
210+
__u64 cpu_delay_max;
211+
__u64 cpu_delay_min;
212+
213+
__u64 blkio_delay_max;
214+
__u64 blkio_delay_min;
215+
216+
__u64 swapin_delay_max;
217+
__u64 swapin_delay_min;
218+
219+
__u64 freepages_delay_max;
220+
__u64 freepages_delay_min;
221+
222+
__u64 thrashing_delay_max;
223+
__u64 thrashing_delay_min;
224+
225+
__u64 compact_delay_max;
226+
__u64 compact_delay_min;
227+
228+
__u64 wpcopy_delay_max;
229+
__u64 wpcopy_delay_min;
230+
231+
__u64 irq_delay_max;
232+
__u64 irq_delay_min;
222233
};
223234

224235

kernel/module/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2829,6 +2829,7 @@ static void module_deallocate(struct module *mod, struct load_info *info)
28292829
{
28302830
percpu_modfree(mod);
28312831
module_arch_freeing_init(mod);
2832+
codetag_free_module_sections(mod);
28322833

28332834
free_mod_mem(mod);
28342835
}

0 commit comments

Comments
 (0)