Skip to content

Commit fd1f847

Browse files
committed
Merge tag 'mm-stable-2025-06-01-14-06' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull more MM updates from Andrew Morton: - "zram: support algorithm-specific parameters" from Sergey Senozhatsky adds infrastructure for passing algorithm-specific parameters into zram. A single parameter `winbits' is implemented at this time. - "memcg: nmi-safe kmem charging" from Shakeel Butt makes memcg charging nmi-safe, which is required by BFP, which can operate in NMI context. - "Some random fixes and cleanup to shmem" from Kemeng Shi implements small fixes and cleanups in the shmem code. - "Skip mm selftests instead when kernel features are not present" from Zi Yan fixes some issues in the MM selftest code. - "mm/damon: build-enable essential DAMON components by default" from SeongJae Park reworks DAMON Kconfig to make it easier to enable CONFIG_DAMON. - "sched/numa: add statistics of numa balance task migration" from Libo Chen adds more info into sysfs and procfs files to improve visibility into the NUMA balancer's task migration activity. - "selftests/mm: cow and gup_longterm cleanups" from Mark Brown provides various updates to some of the MM selftests to make them play better with the overall containing framework. * tag 'mm-stable-2025-06-01-14-06' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (43 commits) mm/khugepaged: clean up refcount check using folio_expected_ref_count() selftests/mm: fix test result reporting in gup_longterm selftests/mm: report unique test names for each cow test selftests/mm: add helper for logging test start and results selftests/mm: use standard ksft_finished() in cow and gup_longterm selftests/damon/_damon_sysfs: skip testcases if CONFIG_DAMON_SYSFS is disabled sched/numa: add statistics of numa balance task sched/numa: fix task swap by skipping kernel threads tools/testing: check correct variable in open_procmap() tools/testing/vma: add missing function stub mm/gup: update comment explaining why gup_fast() disables IRQs selftests/mm: two fixes for the pfnmap test mm/khugepaged: fix race with folio split/free using temporary reference mm: add CONFIG_PAGE_BLOCK_ORDER to select page block order mmu_notifiers: remove leftover stub macros selftests/mm: deduplicate test names in madv_populate kcov: rust: add flags for KCOV with Rust mm: rust: make CONFIG_MMU ifdefs more narrow mmu_gather: move tlb flush for VM_PFNMAP/VM_MIXEDMAP vmas into free_pgtables() mm/damon/Kconfig: enable CONFIG_DAMON by default ...
2 parents fe42816 + 0b43b8b commit fd1f847

Some content is hidden

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

59 files changed

+909
-408
lines changed

Documentation/admin-guide/cgroup-v2.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,6 +1732,12 @@ The following nested keys are defined.
17321732
numa_hint_faults (npn)
17331733
Number of NUMA hinting faults.
17341734

1735+
numa_task_migrated (npn)
1736+
Number of task migration by NUMA balancing.
1737+
1738+
numa_task_swapped (npn)
1739+
Number of task swap by NUMA balancing.
1740+
17351741
pgdemote_kswapd
17361742
Number of pages demoted by kswapd.
17371743

arch/arm/mm/flush.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,9 @@ void __flush_dcache_folio(struct address_space *mapping, struct folio *folio)
227227
}
228228

229229
/*
230-
* If this is a page cache page, and we have an aliasing VIPT cache,
230+
* If this is a page cache folio, and we have an aliasing VIPT cache,
231231
* we only need to do one flush - which would be at the relevant
232-
* userspace colour, which is congruent with page->index.
232+
* userspace colour, which is congruent with folio->index.
233233
*/
234234
if (mapping && cache_is_vipt_aliasing())
235235
flush_pfn_alias(folio_pfn(folio), folio_pos(folio));

arch/m68k/mm/motorola.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ static struct list_head ptable_list[3] = {
105105

106106
#define PD_PTABLE(page) ((ptable_desc *)&(virt_to_page((void *)(page))->lru))
107107
#define PD_PAGE(ptable) (list_entry(ptable, struct page, lru))
108-
#define PD_MARKBITS(dp) (*(unsigned int *)&PD_PAGE(dp)->index)
108+
#define PD_PTDESC(ptable) (list_entry(ptable, struct ptdesc, pt_list))
109+
#define PD_MARKBITS(dp) (*(unsigned int *)&PD_PTDESC(dp)->pt_index)
109110

110111
static const int ptable_shift[3] = {
111112
7+2, /* PGD */

drivers/block/zram/backend_deflate.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "backend_deflate.h"
99

1010
/* Use the same value as crypto API */
11-
#define DEFLATE_DEF_WINBITS 11
11+
#define DEFLATE_DEF_WINBITS (-11)
1212
#define DEFLATE_DEF_MEMLEVEL MAX_MEM_LEVEL
1313

1414
struct deflate_ctx {
@@ -22,8 +22,10 @@ static void deflate_release_params(struct zcomp_params *params)
2222

2323
static int deflate_setup_params(struct zcomp_params *params)
2424
{
25-
if (params->level == ZCOMP_PARAM_NO_LEVEL)
25+
if (params->level == ZCOMP_PARAM_NOT_SET)
2626
params->level = Z_DEFAULT_COMPRESSION;
27+
if (params->deflate.winbits == ZCOMP_PARAM_NOT_SET)
28+
params->deflate.winbits = DEFLATE_DEF_WINBITS;
2729

2830
return 0;
2931
}
@@ -57,13 +59,13 @@ static int deflate_create(struct zcomp_params *params, struct zcomp_ctx *ctx)
5759
return -ENOMEM;
5860

5961
ctx->context = zctx;
60-
sz = zlib_deflate_workspacesize(-DEFLATE_DEF_WINBITS, MAX_MEM_LEVEL);
62+
sz = zlib_deflate_workspacesize(params->deflate.winbits, MAX_MEM_LEVEL);
6163
zctx->cctx.workspace = vzalloc(sz);
6264
if (!zctx->cctx.workspace)
6365
goto error;
6466

6567
ret = zlib_deflateInit2(&zctx->cctx, params->level, Z_DEFLATED,
66-
-DEFLATE_DEF_WINBITS, DEFLATE_DEF_MEMLEVEL,
68+
params->deflate.winbits, DEFLATE_DEF_MEMLEVEL,
6769
Z_DEFAULT_STRATEGY);
6870
if (ret != Z_OK)
6971
goto error;
@@ -73,7 +75,7 @@ static int deflate_create(struct zcomp_params *params, struct zcomp_ctx *ctx)
7375
if (!zctx->dctx.workspace)
7476
goto error;
7577

76-
ret = zlib_inflateInit2(&zctx->dctx, -DEFLATE_DEF_WINBITS);
78+
ret = zlib_inflateInit2(&zctx->dctx, params->deflate.winbits);
7779
if (ret != Z_OK)
7880
goto error;
7981

drivers/block/zram/backend_lz4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static void lz4_release_params(struct zcomp_params *params)
1818

1919
static int lz4_setup_params(struct zcomp_params *params)
2020
{
21-
if (params->level == ZCOMP_PARAM_NO_LEVEL)
21+
if (params->level == ZCOMP_PARAM_NOT_SET)
2222
params->level = LZ4_ACCELERATION_DEFAULT;
2323

2424
return 0;

drivers/block/zram/backend_lz4hc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static void lz4hc_release_params(struct zcomp_params *params)
1818

1919
static int lz4hc_setup_params(struct zcomp_params *params)
2020
{
21-
if (params->level == ZCOMP_PARAM_NO_LEVEL)
21+
if (params->level == ZCOMP_PARAM_NOT_SET)
2222
params->level = LZ4HC_DEFAULT_CLEVEL;
2323

2424
return 0;

drivers/block/zram/backend_zstd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static int zstd_setup_params(struct zcomp_params *params)
5858
return -ENOMEM;
5959

6060
params->drv_data = zp;
61-
if (params->level == ZCOMP_PARAM_NO_LEVEL)
61+
if (params->level == ZCOMP_PARAM_NOT_SET)
6262
params->level = zstd_default_clevel();
6363

6464
zp->cprm = zstd_get_params(params->level, PAGE_SIZE);

drivers/block/zram/zcomp.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55

66
#include <linux/mutex.h>
77

8-
#define ZCOMP_PARAM_NO_LEVEL INT_MIN
8+
#define ZCOMP_PARAM_NOT_SET INT_MIN
9+
10+
struct deflate_params {
11+
s32 winbits;
12+
};
913

1014
/*
1115
* Immutable driver (backend) parameters. The driver may attach private
@@ -17,6 +21,9 @@ struct zcomp_params {
1721
void *dict;
1822
size_t dict_sz;
1923
s32 level;
24+
union {
25+
struct deflate_params deflate;
26+
};
2027

2128
void *drv_data;
2229
};

drivers/block/zram/zram_drv.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,13 +1276,15 @@ static void comp_params_reset(struct zram *zram, u32 prio)
12761276
struct zcomp_params *params = &zram->params[prio];
12771277

12781278
vfree(params->dict);
1279-
params->level = ZCOMP_PARAM_NO_LEVEL;
1279+
params->level = ZCOMP_PARAM_NOT_SET;
1280+
params->deflate.winbits = ZCOMP_PARAM_NOT_SET;
12801281
params->dict_sz = 0;
12811282
params->dict = NULL;
12821283
}
12831284

12841285
static int comp_params_store(struct zram *zram, u32 prio, s32 level,
1285-
const char *dict_path)
1286+
const char *dict_path,
1287+
struct deflate_params *deflate_params)
12861288
{
12871289
ssize_t sz = 0;
12881290

@@ -1300,6 +1302,7 @@ static int comp_params_store(struct zram *zram, u32 prio, s32 level,
13001302

13011303
zram->params[prio].dict_sz = sz;
13021304
zram->params[prio].level = level;
1305+
zram->params[prio].deflate.winbits = deflate_params->winbits;
13031306
return 0;
13041307
}
13051308

@@ -1308,11 +1311,14 @@ static ssize_t algorithm_params_store(struct device *dev,
13081311
const char *buf,
13091312
size_t len)
13101313
{
1311-
s32 prio = ZRAM_PRIMARY_COMP, level = ZCOMP_PARAM_NO_LEVEL;
1314+
s32 prio = ZRAM_PRIMARY_COMP, level = ZCOMP_PARAM_NOT_SET;
13121315
char *args, *param, *val, *algo = NULL, *dict_path = NULL;
1316+
struct deflate_params deflate_params;
13131317
struct zram *zram = dev_to_zram(dev);
13141318
int ret;
13151319

1320+
deflate_params.winbits = ZCOMP_PARAM_NOT_SET;
1321+
13161322
args = skip_spaces(buf);
13171323
while (*args) {
13181324
args = next_arg(args, &param, &val);
@@ -1343,6 +1349,13 @@ static ssize_t algorithm_params_store(struct device *dev,
13431349
dict_path = val;
13441350
continue;
13451351
}
1352+
1353+
if (!strcmp(param, "deflate.winbits")) {
1354+
ret = kstrtoint(val, 10, &deflate_params.winbits);
1355+
if (ret)
1356+
return ret;
1357+
continue;
1358+
}
13461359
}
13471360

13481361
/* Lookup priority by algorithm name */
@@ -1364,7 +1377,7 @@ static ssize_t algorithm_params_store(struct device *dev,
13641377
if (prio < ZRAM_PRIMARY_COMP || prio >= ZRAM_MAX_COMPS)
13651378
return -EINVAL;
13661379

1367-
ret = comp_params_store(zram, prio, level, dict_path);
1380+
ret = comp_params_store(zram, prio, level, dict_path, &deflate_params);
13681381
return ret ? ret : len;
13691382
}
13701383

fs/ntfs3/file.c

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,8 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from)
913913
struct ntfs_inode *ni = ntfs_i(inode);
914914
u64 valid = ni->i_valid;
915915
struct ntfs_sb_info *sbi = ni->mi.sbi;
916-
struct page *page, **pages = NULL;
916+
struct page **pages = NULL;
917+
struct folio *folio;
917918
size_t written = 0;
918919
u8 frame_bits = NTFS_LZNT_CUNIT + sbi->cluster_bits;
919920
u32 frame_size = 1u << frame_bits;
@@ -923,7 +924,6 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from)
923924
u64 frame_vbo;
924925
pgoff_t index;
925926
bool frame_uptodate;
926-
struct folio *folio;
927927

928928
if (frame_size < PAGE_SIZE) {
929929
/*
@@ -977,8 +977,7 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from)
977977
pages_per_frame);
978978
if (err) {
979979
for (ip = 0; ip < pages_per_frame; ip++) {
980-
page = pages[ip];
981-
folio = page_folio(page);
980+
folio = page_folio(pages[ip]);
982981
folio_unlock(folio);
983982
folio_put(folio);
984983
}
@@ -989,10 +988,9 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from)
989988
ip = off >> PAGE_SHIFT;
990989
off = offset_in_page(valid);
991990
for (; ip < pages_per_frame; ip++, off = 0) {
992-
page = pages[ip];
993-
folio = page_folio(page);
994-
zero_user_segment(page, off, PAGE_SIZE);
995-
flush_dcache_page(page);
991+
folio = page_folio(pages[ip]);
992+
folio_zero_segment(folio, off, PAGE_SIZE);
993+
flush_dcache_folio(folio);
996994
folio_mark_uptodate(folio);
997995
}
998996

@@ -1001,8 +999,7 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from)
1001999
ni_unlock(ni);
10021000

10031001
for (ip = 0; ip < pages_per_frame; ip++) {
1004-
page = pages[ip];
1005-
folio = page_folio(page);
1002+
folio = page_folio(pages[ip]);
10061003
folio_mark_uptodate(folio);
10071004
folio_unlock(folio);
10081005
folio_put(folio);
@@ -1046,8 +1043,7 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from)
10461043
if (err) {
10471044
for (ip = 0; ip < pages_per_frame;
10481045
ip++) {
1049-
page = pages[ip];
1050-
folio = page_folio(page);
1046+
folio = page_folio(pages[ip]);
10511047
folio_unlock(folio);
10521048
folio_put(folio);
10531049
}
@@ -1065,10 +1061,10 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from)
10651061
for (;;) {
10661062
size_t cp, tail = PAGE_SIZE - off;
10671063

1068-
page = pages[ip];
1069-
cp = copy_page_from_iter_atomic(page, off,
1064+
folio = page_folio(pages[ip]);
1065+
cp = copy_folio_from_iter_atomic(folio, off,
10701066
min(tail, bytes), from);
1071-
flush_dcache_page(page);
1067+
flush_dcache_folio(folio);
10721068

10731069
copied += cp;
10741070
bytes -= cp;
@@ -1088,9 +1084,8 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from)
10881084
ni_unlock(ni);
10891085

10901086
for (ip = 0; ip < pages_per_frame; ip++) {
1091-
page = pages[ip];
1092-
ClearPageDirty(page);
1093-
folio = page_folio(page);
1087+
folio = page_folio(pages[ip]);
1088+
folio_clear_dirty(folio);
10941089
folio_mark_uptodate(folio);
10951090
folio_unlock(folio);
10961091
folio_put(folio);

0 commit comments

Comments
 (0)