mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-04 04:06:26 +00:00
e548ad4a7c
Unlike the legacy cgroup v1 memory controller, cgroup v2 memory controller doesn't support moving charged pages between cgroups. It's a fairly large and complicated code which created a number of problems in the past. Let's move this code into memcontrol-v1.c. It shaves off 1k lines from memcontrol.c. It's also another step towards making the legacy memory controller code optionally compiled. Link: https://lkml.kernel.org/r/20240625005906.106920-5-roman.gushchin@linux.dev Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev> Acked-by: Michal Hocko <mhocko@suse.com> Acked-by: Shakeel Butt <shakeel.butt@linux.dev> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Muchun Song <muchun.song@linux.dev> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
45 lines
1.4 KiB
C
45 lines
1.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#ifndef __MM_MEMCONTROL_V1_H
|
|
#define __MM_MEMCONTROL_V1_H
|
|
|
|
void memcg1_update_tree(struct mem_cgroup *memcg, int nid);
|
|
void memcg1_remove_from_trees(struct mem_cgroup *memcg);
|
|
|
|
static inline void memcg1_soft_limit_reset(struct mem_cgroup *memcg)
|
|
{
|
|
WRITE_ONCE(memcg->soft_limit, PAGE_COUNTER_MAX);
|
|
}
|
|
|
|
void mem_cgroup_charge_statistics(struct mem_cgroup *memcg, int nr_pages);
|
|
void memcg_check_events(struct mem_cgroup *memcg, int nid);
|
|
void memcg_oom_recover(struct mem_cgroup *memcg);
|
|
int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask,
|
|
unsigned int nr_pages);
|
|
|
|
static inline int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
|
|
unsigned int nr_pages)
|
|
{
|
|
if (mem_cgroup_is_root(memcg))
|
|
return 0;
|
|
|
|
return try_charge_memcg(memcg, gfp_mask, nr_pages);
|
|
}
|
|
|
|
void mem_cgroup_id_get_many(struct mem_cgroup *memcg, unsigned int n);
|
|
void mem_cgroup_id_put_many(struct mem_cgroup *memcg, unsigned int n);
|
|
|
|
bool mem_cgroup_wait_acct_move(struct mem_cgroup *memcg);
|
|
struct cgroup_taskset;
|
|
int mem_cgroup_can_attach(struct cgroup_taskset *tset);
|
|
void mem_cgroup_cancel_attach(struct cgroup_taskset *tset);
|
|
void mem_cgroup_move_task(void);
|
|
|
|
struct cftype;
|
|
u64 mem_cgroup_move_charge_read(struct cgroup_subsys_state *css,
|
|
struct cftype *cft);
|
|
int mem_cgroup_move_charge_write(struct cgroup_subsys_state *css,
|
|
struct cftype *cft, u64 val);
|
|
|
|
#endif /* __MM_MEMCONTROL_V1_H */
|