Re: [PATCH 8/9] memcg: remove mem_cgroup->soft_limit

From: Michal Hocko

Date: Thu Aug 13 2026 - 04:29:40 EST


On Tue 11-08-26 13:32:02, Shakeel Butt wrote:
> Nothing reads it anymore, so the field and the helper that reset it on
> css alloc and css reset can go.
>
> Signed-off-by: Shakeel Butt <shakeel.butt@xxxxxxxxx>

Acked-by: Michal Hocko <mhocko@xxxxxxxx>
Thanks!

> ---
> include/linux/memcontrol.h | 2 --
> mm/memcontrol-v1.h | 6 ------
> mm/memcontrol.c | 2 --
> 3 files changed, 10 deletions(-)
>
> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> index ce24e04967d8..526da1d869ed 100644
> --- a/include/linux/memcontrol.h
> +++ b/include/linux/memcontrol.h
> @@ -275,8 +275,6 @@ struct mem_cgroup {
>
> struct memcg1_events_percpu __percpu *events_percpu;
>
> - unsigned long soft_limit;
> -
> /* protected by memcg_oom_lock */
> bool oom_lock;
> int under_oom;
> diff --git a/mm/memcontrol-v1.h b/mm/memcontrol-v1.h
> index fd611e66859a..f48d0e22e615 100644
> --- a/mm/memcontrol-v1.h
> +++ b/mm/memcontrol-v1.h
> @@ -42,11 +42,6 @@ void memcg1_free_events(struct mem_cgroup *memcg);
>
> void memcg1_memcg_init(struct mem_cgroup *memcg);
>
> -static inline void memcg1_soft_limit_reset(struct mem_cgroup *memcg)
> -{
> - WRITE_ONCE(memcg->soft_limit, PAGE_COUNTER_MAX);
> -}
> -
> struct cgroup_taskset;
> void memcg1_css_offline(struct mem_cgroup *memcg);
>
> @@ -97,7 +92,6 @@ static inline bool memcg1_alloc_events(struct mem_cgroup *memcg) { return true;
> static inline void memcg1_free_events(struct mem_cgroup *memcg) {}
>
> static inline void memcg1_memcg_init(struct mem_cgroup *memcg) {}
> -static inline void memcg1_soft_limit_reset(struct mem_cgroup *memcg) {}
> static inline void memcg1_css_offline(struct mem_cgroup *memcg) {}
>
> static inline bool memcg1_oom_prepare(struct mem_cgroup *memcg, bool *locked)
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index b68f1f16ae54..ba3ef821553d 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -4222,7 +4222,6 @@ mem_cgroup_css_alloc(struct cgroup_subsys_state *parent_css)
> return ERR_CAST(memcg);
>
> page_counter_set_high(&memcg->memory, PAGE_COUNTER_MAX);
> - memcg1_soft_limit_reset(memcg);
> #ifdef CONFIG_ZSWAP
> memcg->zswap_max = PAGE_COUNTER_MAX;
> WRITE_ONCE(memcg->zswap_writeback, true);
> @@ -4429,7 +4428,6 @@ static void mem_cgroup_css_reset(struct cgroup_subsys_state *css)
> page_counter_set_min(&memcg->memory, 0);
> page_counter_set_low(&memcg->memory, 0);
> page_counter_set_high(&memcg->memory, PAGE_COUNTER_MAX);
> - memcg1_soft_limit_reset(memcg);
> page_counter_set_high(&memcg->swap, PAGE_COUNTER_MAX);
> memcg_wb_domain_size_changed(memcg);
> }
> --
> 2.53.0-Meta

--
Michal Hocko
SUSE Labs