diff options
author | Roman Gushchin <roman.gushchin@linux.dev> | 2024-06-28 21:03:09 +0000 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2024-07-04 18:05:55 -0700 |
commit | 04fbe921d3b1f521df7830888054a79fae9ac45a (patch) | |
tree | aabc8f66f438ad795bc35d91b69e21d09ed4084f /mm/memcontrol-v1.h | |
parent | 68cd9050d871e4db5433420b5ceb32f5512d18bc (diff) |
mm: memcg: move memcg_account_kmem() to memcontrol-v1.c
Patch series "mm: memcg: put cgroup v1-specific memcg data under
CONFIG_MEMCG_V1".
This patchset puts all cgroup v1's members of struct mem_cgroup, struct
mem_cgroup_per_node and struct task_struct under the CONFIG_MEMCG_V1
config option. If cgroup v1 support is not required (and it's true for
many cgroup users these days), it allows to save a bit of memory and
compile out some code, some of which is on relatively hot paths. It also
structures the code a bit better by grouping cgroup v1-specific stuff in
one place.
This patch (of 9):
memcg_account_kmem() consists of a trivial statistics change via
mod_memcg_state() call and a relatively large memcg1-specific part.
Let's factor out the mod_memcg_state() call and move the rest into the
mm/memcontrol-v1.c file. Also rename memcg_account_kmem() into
memcg1_account_kmem() for consistency.
Link: https://lkml.kernel.org/r/20240628210317.272856-1-roman.gushchin@linux.dev
Link: https://lkml.kernel.org/r/20240628210317.272856-2-roman.gushchin@linux.dev
Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol-v1.h')
-rw-r--r-- | mm/memcontrol-v1.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/mm/memcontrol-v1.h b/mm/memcontrol-v1.h index 72f0e15a939d..ff972ec00eb3 100644 --- a/mm/memcontrol-v1.h +++ b/mm/memcontrol-v1.h @@ -102,6 +102,7 @@ void memcg1_check_events(struct mem_cgroup *memcg, int nid); void memcg1_stat_format(struct mem_cgroup *memcg, struct seq_buf *s); +void memcg1_account_kmem(struct mem_cgroup *memcg, int nr_pages); extern struct cftype memsw_files[]; extern struct cftype mem_cgroup_legacy_files[]; @@ -120,6 +121,7 @@ static inline void memcg1_check_events(struct mem_cgroup *memcg, int nid) {} static inline void memcg1_stat_format(struct mem_cgroup *memcg, struct seq_buf *s) {} +static inline void memcg1_account_kmem(struct mem_cgroup *memcg, int nr_pages) {} extern struct cftype memsw_files[]; extern struct cftype mem_cgroup_legacy_files[]; #endif /* CONFIG_MEMCG_V1 */ |