The patch titled Subject: memcg: add CONFIG_MEMCG_V1 for 'local' functions has been added to the -mm mm-unstable branch. Its filename is memcg-add-config_memcg_v1-for-local-functions.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/memcg-add-config_memcg_v1-for-local-functions.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Chen Ridong <chenridong@xxxxxxxxxx> Subject: memcg: add CONFIG_MEMCG_V1 for 'local' functions Date: Fri, 24 Jan 2025 07:35:14 +0000 Add CONFIG_MEMCG_V1 for the 'local' functions, which are only used in memcg v1, so that they won't be built for v2. Link: https://lkml.kernel.org/r/20250124073514.2375622-5-chenridong@xxxxxxxxxxxxxxx Signed-off-by: Chen Ridong <chenridong@xxxxxxxxxx> Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx> Acked-by: Shakeel Butt <shakeel.butt@xxxxxxxxx> Acked-by: Roman Gushchin <roman.gushchin@xxxxxxxxx> Cc: David Finkel <davidf@xxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: Muchun Song <muchun.song@xxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Cc: Wang Weiyang <wangweiyang2@xxxxxxxxxx> Cc: Yosry Ahmed <yosryahmed@xxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxx> Cc: Michal Koutný <mkoutny@xxxxxxxx> Cc: Muchun Song <songmuchun@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memcontrol-v1.h | 6 +++--- mm/memcontrol.c | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) --- a/mm/memcontrol.c~memcg-add-config_memcg_v1-for-local-functions +++ a/mm/memcontrol.c @@ -706,6 +706,7 @@ void __mod_memcg_state(struct mem_cgroup trace_mod_memcg_state(memcg, idx, val); } +#ifdef CONFIG_MEMCG_V1 /* idx can be of type enum memcg_stat_item or node_stat_item. */ unsigned long memcg_page_state_local(struct mem_cgroup *memcg, int idx) { @@ -722,6 +723,7 @@ unsigned long memcg_page_state_local(str #endif return x; } +#endif static void __mod_memcg_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx, @@ -869,6 +871,7 @@ unsigned long memcg_events(struct mem_cg return READ_ONCE(memcg->vmstats->events[i]); } +#ifdef CONFIG_MEMCG_V1 unsigned long memcg_events_local(struct mem_cgroup *memcg, int event) { int i = memcg_events_index(event); @@ -878,6 +881,7 @@ unsigned long memcg_events_local(struct return READ_ONCE(memcg->vmstats->events_local[i]); } +#endif struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p) { @@ -1447,11 +1451,13 @@ unsigned long memcg_page_state_output(st memcg_page_state_output_unit(item); } +#ifdef CONFIG_MEMCG_V1 unsigned long memcg_page_state_local_output(struct mem_cgroup *memcg, int item) { return memcg_page_state_local(memcg, item) * memcg_page_state_output_unit(item); } +#endif #ifdef CONFIG_HUGETLB_PAGE static bool memcg_accounts_hugetlb(void) --- a/mm/memcontrol-v1.h~memcg-add-config_memcg_v1-for-local-functions +++ a/mm/memcontrol-v1.h @@ -60,15 +60,15 @@ unsigned long mem_cgroup_usage(struct me void drain_all_stock(struct mem_cgroup *root_memcg); unsigned long memcg_events(struct mem_cgroup *memcg, int event); -unsigned long memcg_events_local(struct mem_cgroup *memcg, int event); -unsigned long memcg_page_state_local(struct mem_cgroup *memcg, int idx); unsigned long memcg_page_state_output(struct mem_cgroup *memcg, int item); -unsigned long memcg_page_state_local_output(struct mem_cgroup *memcg, int item); int memory_stat_show(struct seq_file *m, void *v); /* Cgroup v1-specific declarations */ #ifdef CONFIG_MEMCG_V1 +unsigned long memcg_events_local(struct mem_cgroup *memcg, int event); +unsigned long memcg_page_state_local(struct mem_cgroup *memcg, int idx); +unsigned long memcg_page_state_local_output(struct mem_cgroup *memcg, int item); bool memcg1_alloc_events(struct mem_cgroup *memcg); void memcg1_free_events(struct mem_cgroup *memcg); _ Patches currently in -mm which might be from chenridong@xxxxxxxxxx are memcg-use-ofp_peak_unset-instead-of-1.patch memcg-call-the-free-function-when-allocation-of-pn-fails.patch memcg-factor-out-the-replace_stock_objcg-function.patch memcg-add-config_memcg_v1-for-local-functions.patch