Skip to content

Commit 6eba757

Browse files
committed
Merge tag 'mm-hotfixes-stable-2025-08-21-18-17' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull misc fixes from Andrew Morton: "20 hotfixes. 10 are cc:stable and the remainder address post-6.16 issues or aren't considered necessary for -stable kernels. 17 of these fixes are for MM. As usual, singletons all over the place, apart from a three-patch series of KHO followup work from Pasha which is actually also a bunch of singletons" * tag 'mm-hotfixes-stable-2025-08-21-18-17' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: mm/mremap: fix WARN with uffd that has remap events disabled mm/damon/sysfs-schemes: put damos dests dir after removing its files mm/migrate: fix NULL movable_ops if CONFIG_ZSMALLOC=m mm/damon/core: fix damos_commit_filter not changing allow mm/memory-failure: fix infinite UCE for VM_PFNMAP pfn MAINTAINERS: mark MGLRU as maintained mm: rust: add page.rs to MEMORY MANAGEMENT - RUST iov_iter: iterate_folioq: fix handling of offset >= folio size selftests/damon: fix selftests by installing drgn related script .mailmap: add entry for Easwar Hariharan selftests/mm: add test for invalid multi VMA operations mm/mremap: catch invalid multi VMA moves earlier mm/mremap: allow multi-VMA move when filesystem uses thp_get_unmapped_area mm/damon/core: fix commit_ops_filters by using correct nth function tools/testing: add linux/args.h header and fix radix, VMA tests mm/debug_vm_pgtable: clear page table entries at destroy_args() squashfs: fix memory leak in squashfs_fill_super kho: warn if KHO is disabled due to an error kho: mm: don't allow deferred struct page with KHO kho: init new_physxa->phys_bits to fix lockdep
2 parents 3957a57 + 772e5b4 commit 6eba757

19 files changed

Lines changed: 487 additions & 70 deletions

File tree

.mailmap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ Domen Puncer <domen@coderock.org>
226226
Douglas Gilbert <dougg@torque.net>
227227
Drew Fustini <fustini@kernel.org> <drew@pdp7.com>
228228
<duje@dujemihanovic.xyz> <duje.mihanovic@skole.hr>
229+
Easwar Hariharan <easwar.hariharan@linux.microsoft.com> <easwar.hariharan@intel.com>
230+
Easwar Hariharan <easwar.hariharan@linux.microsoft.com> <eahariha@linux.microsoft.com>
229231
Ed L. Cashin <ecashin@coraid.com>
230232
Elliot Berman <quic_eberman@quicinc.com> <eberman@codeaurora.org>
231233
Enric Balletbo i Serra <eballetbo@kernel.org> <enric.balletbo@collabora.com>

MAINTAINERS

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16058,6 +16058,23 @@ F: mm/mempolicy.c
1605816058
F: mm/migrate.c
1605916059
F: mm/migrate_device.c
1606016060

16061+
MEMORY MANAGEMENT - MGLRU (MULTI-GEN LRU)
16062+
M: Andrew Morton <akpm@linux-foundation.org>
16063+
M: Axel Rasmussen <axelrasmussen@google.com>
16064+
M: Yuanchu Xie <yuanchu@google.com>
16065+
R: Wei Xu <weixugc@google.com>
16066+
L: linux-mm@kvack.org
16067+
S: Maintained
16068+
W: http://www.linux-mm.org
16069+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
16070+
F: Documentation/admin-guide/mm/multigen_lru.rst
16071+
F: Documentation/mm/multigen_lru.rst
16072+
F: include/linux/mm_inline.h
16073+
F: include/linux/mmzone.h
16074+
F: mm/swap.c
16075+
F: mm/vmscan.c
16076+
F: mm/workingset.c
16077+
1606116078
MEMORY MANAGEMENT - MISC
1606216079
M: Andrew Morton <akpm@linux-foundation.org>
1606316080
M: David Hildenbrand <david@redhat.com>
@@ -16248,8 +16265,10 @@ S: Maintained
1624816265
W: http://www.linux-mm.org
1624916266
T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
1625016267
F: rust/helpers/mm.c
16268+
F: rust/helpers/page.c
1625116269
F: rust/kernel/mm.rs
1625216270
F: rust/kernel/mm/
16271+
F: rust/kernel/page.rs
1625316272

1625416273
MEMORY MAPPING
1625516274
M: Andrew Morton <akpm@linux-foundation.org>

fs/squashfs/super.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,15 @@ static int squashfs_fill_super(struct super_block *sb, struct fs_context *fc)
187187
unsigned short flags;
188188
unsigned int fragments;
189189
u64 lookup_table_start, xattr_id_table_start, next_table;
190-
int err;
190+
int err, devblksize = sb_min_blocksize(sb, SQUASHFS_DEVBLK_SIZE);
191191

192192
TRACE("Entered squashfs_fill_superblock\n");
193193

194+
if (!devblksize) {
195+
errorf(fc, "squashfs: unable to set blocksize\n");
196+
return -EINVAL;
197+
}
198+
194199
sb->s_fs_info = kzalloc(sizeof(*msblk), GFP_KERNEL);
195200
if (sb->s_fs_info == NULL) {
196201
ERROR("Failed to allocate squashfs_sb_info\n");
@@ -201,12 +206,7 @@ static int squashfs_fill_super(struct super_block *sb, struct fs_context *fc)
201206

202207
msblk->panic_on_errors = (opts->errors == Opt_errors_panic);
203208

204-
msblk->devblksize = sb_min_blocksize(sb, SQUASHFS_DEVBLK_SIZE);
205-
if (!msblk->devblksize) {
206-
errorf(fc, "squashfs: unable to set blocksize\n");
207-
return -EINVAL;
208-
}
209-
209+
msblk->devblksize = devblksize;
210210
msblk->devblksize_log2 = ffz(~msblk->devblksize);
211211

212212
mutex_init(&msblk->meta_index_mutex);

include/linux/iov_iter.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,22 +160,24 @@ size_t iterate_folioq(struct iov_iter *iter, size_t len, void *priv, void *priv2
160160

161161
do {
162162
struct folio *folio = folioq_folio(folioq, slot);
163-
size_t part, remain, consumed;
163+
size_t part, remain = 0, consumed;
164164
size_t fsize;
165165
void *base;
166166

167167
if (!folio)
168168
break;
169169

170170
fsize = folioq_folio_size(folioq, slot);
171-
base = kmap_local_folio(folio, skip);
172-
part = umin(len, PAGE_SIZE - skip % PAGE_SIZE);
173-
remain = step(base, progress, part, priv, priv2);
174-
kunmap_local(base);
175-
consumed = part - remain;
176-
len -= consumed;
177-
progress += consumed;
178-
skip += consumed;
171+
if (skip < fsize) {
172+
base = kmap_local_folio(folio, skip);
173+
part = umin(len, PAGE_SIZE - skip % PAGE_SIZE);
174+
remain = step(base, progress, part, priv, priv2);
175+
kunmap_local(base);
176+
consumed = part - remain;
177+
len -= consumed;
178+
progress += consumed;
179+
skip += consumed;
180+
}
179181
if (skip >= fsize) {
180182
skip = 0;
181183
slot++;

include/linux/migrate.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ void migration_entry_wait_on_locked(swp_entry_t entry, spinlock_t *ptl)
7979
void folio_migrate_flags(struct folio *newfolio, struct folio *folio);
8080
int folio_migrate_mapping(struct address_space *mapping,
8181
struct folio *newfolio, struct folio *folio, int extra_count);
82+
int set_movable_ops(const struct movable_operations *ops, enum pagetype type);
8283

8384
#else
8485

@@ -100,6 +101,10 @@ static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
100101
{
101102
return -ENOSYS;
102103
}
104+
static inline int set_movable_ops(const struct movable_operations *ops, enum pagetype type)
105+
{
106+
return -ENOSYS;
107+
}
103108

104109
#endif /* CONFIG_MIGRATION */
105110

kernel/Kconfig.kexec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ config KEXEC_JUMP
9797
config KEXEC_HANDOVER
9898
bool "kexec handover"
9999
depends on ARCH_SUPPORTS_KEXEC_HANDOVER && ARCH_SUPPORTS_KEXEC_FILE
100+
depends on !DEFERRED_STRUCT_PAGE_INIT
100101
select MEMBLOCK_KHO_SCRATCH
101102
select KEXEC_FILE
102103
select DEBUG_FS

kernel/kexec_handover.c

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,34 @@ static int __kho_preserve_order(struct kho_mem_track *track, unsigned long pfn,
144144
unsigned int order)
145145
{
146146
struct kho_mem_phys_bits *bits;
147-
struct kho_mem_phys *physxa;
147+
struct kho_mem_phys *physxa, *new_physxa;
148148
const unsigned long pfn_high = pfn >> order;
149149

150150
might_sleep();
151151

152-
physxa = xa_load_or_alloc(&track->orders, order, sizeof(*physxa));
153-
if (IS_ERR(physxa))
154-
return PTR_ERR(physxa);
152+
physxa = xa_load(&track->orders, order);
153+
if (!physxa) {
154+
int err;
155+
156+
new_physxa = kzalloc(sizeof(*physxa), GFP_KERNEL);
157+
if (!new_physxa)
158+
return -ENOMEM;
159+
160+
xa_init(&new_physxa->phys_bits);
161+
physxa = xa_cmpxchg(&track->orders, order, NULL, new_physxa,
162+
GFP_KERNEL);
163+
164+
err = xa_err(physxa);
165+
if (err || physxa) {
166+
xa_destroy(&new_physxa->phys_bits);
167+
kfree(new_physxa);
168+
169+
if (err)
170+
return err;
171+
} else {
172+
physxa = new_physxa;
173+
}
174+
}
155175

156176
bits = xa_load_or_alloc(&physxa->phys_bits, pfn_high / PRESERVE_BITS,
157177
sizeof(*bits));
@@ -544,6 +564,7 @@ static void __init kho_reserve_scratch(void)
544564
err_free_scratch_desc:
545565
memblock_free(kho_scratch, kho_scratch_cnt * sizeof(*kho_scratch));
546566
err_disable_kho:
567+
pr_warn("Failed to reserve scratch area, disabling kexec handover\n");
547568
kho_enable = false;
548569
}
549570

mm/balloon_compaction.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,4 +254,10 @@ const struct movable_operations balloon_mops = {
254254
.putback_page = balloon_page_putback,
255255
};
256256

257+
static int __init balloon_init(void)
258+
{
259+
return set_movable_ops(&balloon_mops, PGTY_offline);
260+
}
261+
core_initcall(balloon_init);
262+
257263
#endif /* CONFIG_BALLOON_COMPACTION */

mm/damon/core.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,18 @@ static struct damos_filter *damos_nth_filter(int n, struct damos *s)
845845
return NULL;
846846
}
847847

848+
static struct damos_filter *damos_nth_ops_filter(int n, struct damos *s)
849+
{
850+
struct damos_filter *filter;
851+
int i = 0;
852+
853+
damos_for_each_ops_filter(filter, s) {
854+
if (i++ == n)
855+
return filter;
856+
}
857+
return NULL;
858+
}
859+
848860
static void damos_commit_filter_arg(
849861
struct damos_filter *dst, struct damos_filter *src)
850862
{
@@ -871,6 +883,7 @@ static void damos_commit_filter(
871883
{
872884
dst->type = src->type;
873885
dst->matching = src->matching;
886+
dst->allow = src->allow;
874887
damos_commit_filter_arg(dst, src);
875888
}
876889

@@ -908,7 +921,7 @@ static int damos_commit_ops_filters(struct damos *dst, struct damos *src)
908921
int i = 0, j = 0;
909922

910923
damos_for_each_ops_filter_safe(dst_filter, next, dst) {
911-
src_filter = damos_nth_filter(i++, src);
924+
src_filter = damos_nth_ops_filter(i++, src);
912925
if (src_filter)
913926
damos_commit_filter(dst_filter, src_filter);
914927
else

mm/damon/sysfs-schemes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2158,8 +2158,8 @@ static void damon_sysfs_scheme_rm_dirs(struct damon_sysfs_scheme *scheme)
21582158
{
21592159
damon_sysfs_access_pattern_rm_dirs(scheme->access_pattern);
21602160
kobject_put(&scheme->access_pattern->kobj);
2161-
kobject_put(&scheme->dests->kobj);
21622161
damos_sysfs_dests_rm_dirs(scheme->dests);
2162+
kobject_put(&scheme->dests->kobj);
21632163
damon_sysfs_quotas_rm_dirs(scheme->quotas);
21642164
kobject_put(&scheme->quotas->kobj);
21652165
kobject_put(&scheme->watermarks->kobj);

0 commit comments

Comments
 (0)