Message ID | 20240724202103.1210065-3-roman.gushchin@linux.dev (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | This patchset reorganizes page_counter structures which helps to make | expand |
On Wed, Jul 24, 2024 at 08:21:00PM GMT, Roman Gushchin wrote: > 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. > > Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev> Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
diff --git a/include/linux/page_counter.h b/include/linux/page_counter.h index b31fd5b208aa..d85fc7df3280 100644 --- a/include/linux/page_counter.h +++ b/include/linux/page_counter.h @@ -91,8 +91,14 @@ static inline void page_counter_reset_watermark(struct page_counter *counter) counter->local_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 */ diff --git a/mm/page_counter.c b/mm/page_counter.c index a54382a58ace..b249d15af9dd 100644 --- a/mm/page_counter.c +++ b/mm/page_counter.c @@ -288,6 +288,7 @@ int page_counter_memparse(const char *buf, const char *max, } +#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(struct page_counter *root, atomic_long_read(&parent->children_low_usage), recursive_protection)); } +#endif /* CONFIG_MEMCG */
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. Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev> --- include/linux/page_counter.h | 6 ++++++ mm/page_counter.c | 2 ++ 2 files changed, 8 insertions(+)