The patch titled Subject: mm: page_counters: put page_counter_calculate_protection() under CONFIG_MEMCG has been added to the -mm mm-unstable branch. Its filename is mm-page_counters-put-page_counter_calculate_protection-under-config_memcg.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-page_counters-put-page_counter_calculate_protection-under-config_memcg.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: Roman Gushchin <roman.gushchin@xxxxxxxxx> Subject: mm: page_counters: put page_counter_calculate_protection() under CONFIG_MEMCG Date: Fri, 26 Jul 2024 20:31:09 +0000 Put page_counter_calculate_protection() under CONFIG_MEMCG. The protection functionality (min/low limits) is not supported by any other cgroup subsystem, so page_counter_calculate_protection() and related static effective_protection() can be compiled out if CONFIG_MEMCG is not enabled. Link: https://lkml.kernel.org/r/20240726203110.1577216-3-roman.gushchin@xxxxxxxxx Signed-off-by: Roman Gushchin <roman.gushchin@xxxxxxxxx> Acked-by: Shakeel Butt <shakeel.butt@xxxxxxxxx> Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxx> Cc: Muchun Song <songmuchun@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/page_counter.h | 6 ++++++ mm/page_counter.c | 2 ++ 2 files changed, 8 insertions(+) --- a/include/linux/page_counter.h~mm-page_counters-put-page_counter_calculate_protection-under-config_memcg +++ a/include/linux/page_counter.h @@ -95,8 +95,14 @@ static inline void page_counter_reset_wa counter->watermark = usage; } +#ifdef CONFIG_MEMCG void page_counter_calculate_protection(struct page_counter *root, struct page_counter *counter, bool recursive_protection); +#else +static inline void page_counter_calculate_protection(struct page_counter *root, + struct page_counter *counter, + bool recursive_protection) {} +#endif #endif /* _LINUX_PAGE_COUNTER_H */ --- a/mm/page_counter.c~mm-page_counters-put-page_counter_calculate_protection-under-config_memcg +++ a/mm/page_counter.c @@ -288,6 +288,7 @@ int page_counter_memparse(const char *bu } +#ifdef CONFIG_MEMCG /* * This function calculates an individual page counter's effective * protection which is derived from its own memory.min/low, its @@ -459,3 +460,4 @@ void page_counter_calculate_protection(s atomic_long_read(&parent->children_low_usage), recursive_protection)); } +#endif /* CONFIG_MEMCG */ _ Patches currently in -mm which might be from roman.gushchin@xxxxxxxxx are mm-memcg-dont-call-propagate_protected_usage-needlessly.patch mm-page_counters-put-page_counter_calculate_protection-under-config_memcg.patch mm-page_counters-initialize-usage-using-atomic_long_init-macro.patch