Skip to content

Commit 75fe8ec

Browse files
hnazakpm00
authored andcommitted
mm: memcontrol: unshare v2-only charge API bits again
6b61138 ("memcg-v1: remove charge move code") removed the remaining v1 callers. Link: https://lkml.kernel.org/r/20250124043859.18808-1-hannes@cmpxchg.org Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: Roman Gushchin <roman.gushchin@linux.dev> Acked-by: Shakeel Butt <shakeel.butt@linux.dev> Acked-by: Michal Hocko <mhocko@suse.com> Cc: Muchun Song <songmuchun@bytedance.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 610dc18 commit 75fe8ec

File tree

2 files changed

+13
-19
lines changed

2 files changed

+13
-19
lines changed

mm/memcontrol-v1.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,6 @@
77

88
/* Cgroup v1 and v2 common declarations */
99

10-
int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask,
11-
unsigned int nr_pages);
12-
13-
static inline int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
14-
unsigned int nr_pages)
15-
{
16-
if (mem_cgroup_is_root(memcg))
17-
return 0;
18-
19-
return try_charge_memcg(memcg, gfp_mask, nr_pages);
20-
}
21-
22-
void mem_cgroup_id_get_many(struct mem_cgroup *memcg, unsigned int n);
23-
void mem_cgroup_id_put_many(struct mem_cgroup *memcg, unsigned int n);
24-
2510
/*
2611
* Iteration constructs for visiting all cgroups (under a tree). If
2712
* loops are exited prematurely (break), mem_cgroup_iter_break() must

mm/memcontrol.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2213,8 +2213,8 @@ void mem_cgroup_handle_over_high(gfp_t gfp_mask)
22132213
css_put(&memcg->css);
22142214
}
22152215

2216-
int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask,
2217-
unsigned int nr_pages)
2216+
static int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask,
2217+
unsigned int nr_pages)
22182218
{
22192219
unsigned int batch = max(MEMCG_CHARGE_BATCH, nr_pages);
22202220
int nr_retries = MAX_RECLAIM_RETRIES;
@@ -2403,6 +2403,15 @@ int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask,
24032403
return 0;
24042404
}
24052405

2406+
static inline int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
2407+
unsigned int nr_pages)
2408+
{
2409+
if (mem_cgroup_is_root(memcg))
2410+
return 0;
2411+
2412+
return try_charge_memcg(memcg, gfp_mask, nr_pages);
2413+
}
2414+
24062415
static void commit_charge(struct folio *folio, struct mem_cgroup *memcg)
24072416
{
24082417
VM_BUG_ON_FOLIO(folio_memcg_charged(folio), folio);
@@ -3389,13 +3398,13 @@ static void mem_cgroup_id_remove(struct mem_cgroup *memcg)
33893398
}
33903399
}
33913400

3392-
void __maybe_unused mem_cgroup_id_get_many(struct mem_cgroup *memcg,
3401+
static void __maybe_unused mem_cgroup_id_get_many(struct mem_cgroup *memcg,
33933402
unsigned int n)
33943403
{
33953404
refcount_add(n, &memcg->id.ref);
33963405
}
33973406

3398-
void mem_cgroup_id_put_many(struct mem_cgroup *memcg, unsigned int n)
3407+
static void mem_cgroup_id_put_many(struct mem_cgroup *memcg, unsigned int n)
33993408
{
34003409
if (refcount_sub_and_test(n, &memcg->id.ref)) {
34013410
mem_cgroup_id_remove(memcg);

0 commit comments

Comments
 (0)