Skip to content

Commit 95e73fb

Browse files
committed
Merge tag 'mm-hotfixes-stable-2024-02-22-15-02' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull misc fixes from Andrew Morton: "A batch of MM (and one non-MM) hotfixes. Ten are cc:stable and the remainder address post-6.7 issues or aren't considered appropriate for backporting" * tag 'mm-hotfixes-stable-2024-02-22-15-02' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: kasan: guard release_free_meta() shadow access with kasan_arch_is_ready() mm/damon/lru_sort: fix quota status loss due to online tunings mm/damon/reclaim: fix quota stauts loss due to online tunings MAINTAINERS: mailmap: update Shakeel's email address mm/damon/sysfs-schemes: handle schemes sysfs dir removal before commit_schemes_quota_goals mm: memcontrol: clarify swapaccount=0 deprecation warning mm/memblock: add MEMBLOCK_RSRV_NOINIT into flagname[] array mm/zswap: invalidate duplicate entry when !zswap_enabled lib/Kconfig.debug: TEST_IOV_ITER depends on MMU mm/swap: fix race when skipping swapcache mm/swap_state: update zswap LRU's protection range with the folio locked selftests/mm: uffd-unit-test check if huge page size is 0 mm/damon/core: check apply interval in damon_do_apply_schemes() mm: zswap: fix missing folio cleanup in writeback race path
2 parents e7768e6 + 2597c99 commit 95e73fb

File tree

17 files changed

+147
-25
lines changed

17 files changed

+147
-25
lines changed

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,7 @@ Senthilkumar N L <quic_snlakshm@quicinc.com> <snlakshm@codeaurora.org>
553553
Serge Hallyn <sergeh@kernel.org> <serge.hallyn@canonical.com>
554554
Serge Hallyn <sergeh@kernel.org> <serue@us.ibm.com>
555555
Seth Forshee <sforshee@kernel.org> <seth.forshee@canonical.com>
556+
Shakeel Butt <shakeel.butt@linux.dev> <shakeelb@google.com>
556557
Shannon Nelson <shannon.nelson@amd.com> <snelson@pensando.io>
557558
Shannon Nelson <shannon.nelson@amd.com> <shannon.nelson@intel.com>
558559
Shannon Nelson <shannon.nelson@amd.com> <shannon.nelson@oracle.com>

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5378,7 +5378,7 @@ CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)
53785378
M: Johannes Weiner <hannes@cmpxchg.org>
53795379
M: Michal Hocko <mhocko@kernel.org>
53805380
M: Roman Gushchin <roman.gushchin@linux.dev>
5381-
M: Shakeel Butt <shakeelb@google.com>
5381+
M: Shakeel Butt <shakeel.butt@linux.dev>
53825382
R: Muchun Song <muchun.song@linux.dev>
53835383
L: cgroups@vger.kernel.org
53845384
L: linux-mm@kvack.org

include/linux/swap.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,11 @@ static inline int swap_duplicate(swp_entry_t swp)
549549
return 0;
550550
}
551551

552+
static inline int swapcache_prepare(swp_entry_t swp)
553+
{
554+
return 0;
555+
}
556+
552557
static inline void swap_free(swp_entry_t swp)
553558
{
554559
}

lib/Kconfig.debug

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2235,6 +2235,7 @@ config TEST_DIV64
22352235
config TEST_IOV_ITER
22362236
tristate "Test iov_iter operation" if !KUNIT_ALL_TESTS
22372237
depends on KUNIT
2238+
depends on MMU
22382239
default KUNIT_ALL_TESTS
22392240
help
22402241
Enable this to turn on testing of the operation of the I/O iterator

mm/damon/core.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,9 @@ static void damon_do_apply_schemes(struct damon_ctx *c,
10261026
damon_for_each_scheme(s, c) {
10271027
struct damos_quota *quota = &s->quota;
10281028

1029+
if (c->passed_sample_intervals != s->next_apply_sis)
1030+
continue;
1031+
10291032
if (!s->wmarks.activated)
10301033
continue;
10311034

@@ -1176,10 +1179,6 @@ static void kdamond_apply_schemes(struct damon_ctx *c)
11761179
if (c->passed_sample_intervals != s->next_apply_sis)
11771180
continue;
11781181

1179-
s->next_apply_sis +=
1180-
(s->apply_interval_us ? s->apply_interval_us :
1181-
c->attrs.aggr_interval) / sample_interval;
1182-
11831182
if (!s->wmarks.activated)
11841183
continue;
11851184

@@ -1195,6 +1194,14 @@ static void kdamond_apply_schemes(struct damon_ctx *c)
11951194
damon_for_each_region_safe(r, next_r, t)
11961195
damon_do_apply_schemes(c, t, r);
11971196
}
1197+
1198+
damon_for_each_scheme(s, c) {
1199+
if (c->passed_sample_intervals != s->next_apply_sis)
1200+
continue;
1201+
s->next_apply_sis +=
1202+
(s->apply_interval_us ? s->apply_interval_us :
1203+
c->attrs.aggr_interval) / sample_interval;
1204+
}
11981205
}
11991206

12001207
/*

mm/damon/lru_sort.c

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,28 +185,57 @@ static struct damos *damon_lru_sort_new_cold_scheme(unsigned int cold_thres)
185185
return damon_lru_sort_new_scheme(&pattern, DAMOS_LRU_DEPRIO);
186186
}
187187

188+
static void damon_lru_sort_copy_quota_status(struct damos_quota *dst,
189+
struct damos_quota *src)
190+
{
191+
dst->total_charged_sz = src->total_charged_sz;
192+
dst->total_charged_ns = src->total_charged_ns;
193+
dst->charged_sz = src->charged_sz;
194+
dst->charged_from = src->charged_from;
195+
dst->charge_target_from = src->charge_target_from;
196+
dst->charge_addr_from = src->charge_addr_from;
197+
}
198+
188199
static int damon_lru_sort_apply_parameters(void)
189200
{
190-
struct damos *scheme;
201+
struct damos *scheme, *hot_scheme, *cold_scheme;
202+
struct damos *old_hot_scheme = NULL, *old_cold_scheme = NULL;
191203
unsigned int hot_thres, cold_thres;
192204
int err = 0;
193205

194206
err = damon_set_attrs(ctx, &damon_lru_sort_mon_attrs);
195207
if (err)
196208
return err;
197209

210+
damon_for_each_scheme(scheme, ctx) {
211+
if (!old_hot_scheme) {
212+
old_hot_scheme = scheme;
213+
continue;
214+
}
215+
old_cold_scheme = scheme;
216+
}
217+
198218
hot_thres = damon_max_nr_accesses(&damon_lru_sort_mon_attrs) *
199219
hot_thres_access_freq / 1000;
200-
scheme = damon_lru_sort_new_hot_scheme(hot_thres);
201-
if (!scheme)
220+
hot_scheme = damon_lru_sort_new_hot_scheme(hot_thres);
221+
if (!hot_scheme)
202222
return -ENOMEM;
203-
damon_set_schemes(ctx, &scheme, 1);
223+
if (old_hot_scheme)
224+
damon_lru_sort_copy_quota_status(&hot_scheme->quota,
225+
&old_hot_scheme->quota);
204226

205227
cold_thres = cold_min_age / damon_lru_sort_mon_attrs.aggr_interval;
206-
scheme = damon_lru_sort_new_cold_scheme(cold_thres);
207-
if (!scheme)
228+
cold_scheme = damon_lru_sort_new_cold_scheme(cold_thres);
229+
if (!cold_scheme) {
230+
damon_destroy_scheme(hot_scheme);
208231
return -ENOMEM;
209-
damon_add_scheme(ctx, scheme);
232+
}
233+
if (old_cold_scheme)
234+
damon_lru_sort_copy_quota_status(&cold_scheme->quota,
235+
&old_cold_scheme->quota);
236+
237+
damon_set_schemes(ctx, &hot_scheme, 1);
238+
damon_add_scheme(ctx, cold_scheme);
210239

211240
return damon_set_region_biggest_system_ram_default(target,
212241
&monitor_region_start,

mm/damon/reclaim.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,20 @@ static struct damos *damon_reclaim_new_scheme(void)
150150
&damon_reclaim_wmarks);
151151
}
152152

153+
static void damon_reclaim_copy_quota_status(struct damos_quota *dst,
154+
struct damos_quota *src)
155+
{
156+
dst->total_charged_sz = src->total_charged_sz;
157+
dst->total_charged_ns = src->total_charged_ns;
158+
dst->charged_sz = src->charged_sz;
159+
dst->charged_from = src->charged_from;
160+
dst->charge_target_from = src->charge_target_from;
161+
dst->charge_addr_from = src->charge_addr_from;
162+
}
163+
153164
static int damon_reclaim_apply_parameters(void)
154165
{
155-
struct damos *scheme;
166+
struct damos *scheme, *old_scheme;
156167
struct damos_filter *filter;
157168
int err = 0;
158169

@@ -164,6 +175,11 @@ static int damon_reclaim_apply_parameters(void)
164175
scheme = damon_reclaim_new_scheme();
165176
if (!scheme)
166177
return -ENOMEM;
178+
if (!list_empty(&ctx->schemes)) {
179+
damon_for_each_scheme(old_scheme, ctx)
180+
damon_reclaim_copy_quota_status(&scheme->quota,
181+
&old_scheme->quota);
182+
}
167183
if (skip_anon) {
168184
filter = damos_new_filter(DAMOS_FILTER_TYPE_ANON, true);
169185
if (!filter) {

mm/damon/sysfs-schemes.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,6 +1905,10 @@ void damos_sysfs_set_quota_scores(struct damon_sysfs_schemes *sysfs_schemes,
19051905
damon_for_each_scheme(scheme, ctx) {
19061906
struct damon_sysfs_scheme *sysfs_scheme;
19071907

1908+
/* user could have removed the scheme sysfs dir */
1909+
if (i >= sysfs_schemes->nr)
1910+
break;
1911+
19081912
sysfs_scheme = sysfs_schemes->schemes_arr[i];
19091913
damos_sysfs_set_quota_score(sysfs_scheme->quotas->goals,
19101914
&scheme->quota);

mm/kasan/generic.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,9 @@ static void release_alloc_meta(struct kasan_alloc_meta *meta)
522522

523523
static void release_free_meta(const void *object, struct kasan_free_meta *meta)
524524
{
525+
if (!kasan_arch_is_ready())
526+
return;
527+
525528
/* Check if free meta is valid. */
526529
if (*(u8 *)kasan_mem_to_shadow(object) != KASAN_SLAB_FREE_META)
527530
return;

mm/memblock.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2249,6 +2249,7 @@ static const char * const flagname[] = {
22492249
[ilog2(MEMBLOCK_MIRROR)] = "MIRROR",
22502250
[ilog2(MEMBLOCK_NOMAP)] = "NOMAP",
22512251
[ilog2(MEMBLOCK_DRIVER_MANAGED)] = "DRV_MNG",
2252+
[ilog2(MEMBLOCK_RSRV_NOINIT)] = "RSV_NIT",
22522253
};
22532254

22542255
static int memblock_debug_show(struct seq_file *m, void *private)

0 commit comments

Comments
 (0)