[PATCH for-7.4 0/9] memcg: remove the v1 soft limit

Shakeel Butt posted 9 patches 1 month, 2 weeks ago
There is a newer version of this series
.../admin-guide/cgroup-v1/memory.rst          |  49 +-
include/linux/memcontrol.h                    |  27 --
include/linux/mmzone.h                        |  30 +-
include/trace/events/vmscan.h                 |  14 -
mm/internal.h                                 |   4 -
mm/memcontrol-v1.c                            | 435 ++----------------
mm/memcontrol-v1.h                            |  12 +-
mm/memcontrol.c                               |   7 +-
mm/vmscan.c                                   |  96 +---
9 files changed, 66 insertions(+), 608 deletions(-)
[PATCH for-7.4 0/9] memcg: remove the v1 soft limit
Posted by Shakeel Butt 1 month, 2 weeks ago
Syzbot reported [1] a set_mm_walk() warning from kswapd. Soft limit
reclaim is the only thing that runs shrink_lruvec() from kswapd with a
target memcg set, and thus the only way kswapd can reach
lru_gen_shrink_lruvec() and in turn set_mm_walk(). The offender,
mem_cgroup_shrink_node(), has long carried a "Only used by soft limit
reclaim. Do not reuse for anything else." comment and a priority hack,
and it simply never got taught about MGLRU.

Rather than teach it, let's delete it. The v1 soft limit was deprecated
in v6.12 by commit 569c4f62d84a ("memcg: initiate deprecation of v1
soft limit"). Nobody has reported depending on it in the ~21 months
since, and v2 has covered the same ground for a long time with
memory.low and memory.min.

Link: https://lore.kernel.org/all/6a7a6929.b50370da.49fe0.005e.GAE@google.com/ [1]

Shakeel Butt (9):
  memcg: make the v1 soft limit knob inert
  memcg: remove v1 soft limit reclaim
  memcg: remove mem_cgroup_shrink_node()
  memcg: remove the soft limit reclaim tracepoints
  memcg: remove the soft limit rbtree
  memcg: remove lru_gen_soft_reclaim()
  memcg: remove the per-node soft limit tree fields
  memcg: remove mem_cgroup->soft_limit
  memcg: simplify v1 event ratelimiting

 .../admin-guide/cgroup-v1/memory.rst          |  49 +-
 include/linux/memcontrol.h                    |  27 --
 include/linux/mmzone.h                        |  30 +-
 include/trace/events/vmscan.h                 |  14 -
 mm/internal.h                                 |   4 -
 mm/memcontrol-v1.c                            | 435 ++----------------
 mm/memcontrol-v1.h                            |  12 +-
 mm/memcontrol.c                               |   7 +-
 mm/vmscan.c                                   |  96 +---
 9 files changed, 66 insertions(+), 608 deletions(-)

-- 
2.53.0-Meta
Re: [PATCH for-7.4 0/9] memcg: remove the v1 soft limit
Posted by Shakeel Butt 1 month ago
On Tue, Aug 11, 2026 at 01:31:54PM -0700, Shakeel Butt wrote:
> Syzbot reported [1] a set_mm_walk() warning from kswapd. Soft limit
> reclaim is the only thing that runs shrink_lruvec() from kswapd with a
> target memcg set, and thus the only way kswapd can reach
> lru_gen_shrink_lruvec() and in turn set_mm_walk(). The offender,
> mem_cgroup_shrink_node(), has long carried a "Only used by soft limit
> reclaim. Do not reuse for anything else." comment and a priority hack,
> and it simply never got taught about MGLRU.
> 
> Rather than teach it, let's delete it. The v1 soft limit was deprecated
> in v6.12 by commit 569c4f62d84a ("memcg: initiate deprecation of v1
> soft limit"). Nobody has reported depending on it in the ~21 months
> since, and v2 has covered the same ground for a long time with
> memory.low and memory.min.
> 
> Link: https://lore.kernel.org/all/6a7a6929.b50370da.49fe0.005e.GAE@google.com/ [1]

Andrew, should I resend this series (without the first patch) or will you pick
it up?

> 
> Shakeel Butt (9):
>   memcg: make the v1 soft limit knob inert
>   memcg: remove v1 soft limit reclaim
>   memcg: remove mem_cgroup_shrink_node()
>   memcg: remove the soft limit reclaim tracepoints
>   memcg: remove the soft limit rbtree
>   memcg: remove lru_gen_soft_reclaim()
>   memcg: remove the per-node soft limit tree fields
>   memcg: remove mem_cgroup->soft_limit
>   memcg: simplify v1 event ratelimiting
> 
>  .../admin-guide/cgroup-v1/memory.rst          |  49 +-
>  include/linux/memcontrol.h                    |  27 --
>  include/linux/mmzone.h                        |  30 +-
>  include/trace/events/vmscan.h                 |  14 -
>  mm/internal.h                                 |   4 -
>  mm/memcontrol-v1.c                            | 435 ++----------------
>  mm/memcontrol-v1.h                            |  12 +-
>  mm/memcontrol.c                               |   7 +-
>  mm/vmscan.c                                   |  96 +---
>  9 files changed, 66 insertions(+), 608 deletions(-)
> 
> -- 
> 2.53.0-Meta
>
Re: [PATCH for-7.4 0/9] memcg: remove the v1 soft limit
Posted by Andrew Morton 1 month ago
On Fri, 28 Aug 2026 19:23:19 -0700 Shakeel Butt <shakeel.butt@linux.dev> wrote:

> On Tue, Aug 11, 2026 at 01:31:54PM -0700, Shakeel Butt wrote:
> > Syzbot reported [1] a set_mm_walk() warning from kswapd. Soft limit
> > reclaim is the only thing that runs shrink_lruvec() from kswapd with a
> > target memcg set, and thus the only way kswapd can reach
> > lru_gen_shrink_lruvec() and in turn set_mm_walk(). The offender,
> > mem_cgroup_shrink_node(), has long carried a "Only used by soft limit
> > reclaim. Do not reuse for anything else." comment and a priority hack,
> > and it simply never got taught about MGLRU.
> > 
> > Rather than teach it, let's delete it. The v1 soft limit was deprecated
> > in v6.12 by commit 569c4f62d84a ("memcg: initiate deprecation of v1
> > soft limit"). Nobody has reported depending on it in the ~21 months
> > since, and v2 has covered the same ground for a long time with
> > memory.low and memory.min.
> > 
> > Link: https://lore.kernel.org/all/6a7a6929.b50370da.49fe0.005e.GAE@google.com/ [1]
> 
> Andrew, should I resend this series (without the first patch) or will you pick
> it up?

I added the series, thanks.

The [1/9] has already been queued in mm-hotfixes as a backportable
hotfix.  So I added it as an 8-patch series.  Because of this the cover
letter of that series is now irrelevant, so could you please prepare a
brief replacement for me to paste in?

Sashiko suggests that there's more that can be removed:
	https://sashiko.dev/#/patchset/20260811203203.3456029-1-shakeel.butt@linux.dev

So maybe an 8-patch v2 series is appropriate, your call.
Re: [PATCH for-7.4 0/9] memcg: remove the v1 soft limit
Posted by Shakeel Butt 1 month ago
On Fri, Aug 28, 2026 at 07:43:22PM -0700, Andrew Morton wrote:
> On Fri, 28 Aug 2026 19:23:19 -0700 Shakeel Butt <shakeel.butt@linux.dev> wrote:
> 
> > On Tue, Aug 11, 2026 at 01:31:54PM -0700, Shakeel Butt wrote:
> > > Syzbot reported [1] a set_mm_walk() warning from kswapd. Soft limit
> > > reclaim is the only thing that runs shrink_lruvec() from kswapd with a
> > > target memcg set, and thus the only way kswapd can reach
> > > lru_gen_shrink_lruvec() and in turn set_mm_walk(). The offender,
> > > mem_cgroup_shrink_node(), has long carried a "Only used by soft limit
> > > reclaim. Do not reuse for anything else." comment and a priority hack,
> > > and it simply never got taught about MGLRU.
> > > 
> > > Rather than teach it, let's delete it. The v1 soft limit was deprecated
> > > in v6.12 by commit 569c4f62d84a ("memcg: initiate deprecation of v1
> > > soft limit"). Nobody has reported depending on it in the ~21 months
> > > since, and v2 has covered the same ground for a long time with
> > > memory.low and memory.min.
> > > 
> > > Link: https://lore.kernel.org/all/6a7a6929.b50370da.49fe0.005e.GAE@google.com/ [1]
> > 
> > Andrew, should I resend this series (without the first patch) or will you pick
> > it up?
> 
> I added the series, thanks.
> 
> The [1/9] has already been queued in mm-hotfixes as a backportable
> hotfix.  So I added it as an 8-patch series.  Because of this the cover
> letter of that series is now irrelevant, so could you please prepare a
> brief replacement for me to paste in?
> 
> Sashiko suggests that there's more that can be removed:
> 	https://sashiko.dev/#/patchset/20260811203203.3456029-1-shakeel.butt@linux.dev
> 
> So maybe an 8-patch v2 series is appropriate, your call.

I will send 8-patch v2 series with Sashiko's comments resolved by next week.
Re: [PATCH for-7.4 0/9] memcg: remove the v1 soft limit
Posted by Lorenzo Stoakes (ARM) 1 month, 2 weeks ago
On Tue, Aug 11, 2026 at 01:31:54PM -0700, Shakeel Butt wrote:
> Syzbot reported [1] a set_mm_walk() warning from kswapd. Soft limit
> reclaim is the only thing that runs shrink_lruvec() from kswapd with a
> target memcg set, and thus the only way kswapd can reach
> lru_gen_shrink_lruvec() and in turn set_mm_walk(). The offender,
> mem_cgroup_shrink_node(), has long carried a "Only used by soft limit
> reclaim. Do not reuse for anything else." comment and a priority hack,
> and it simply never got taught about MGLRU.
>
> Rather than teach it, let's delete it. The v1 soft limit was deprecated
> in v6.12 by commit 569c4f62d84a ("memcg: initiate deprecation of v1
> soft limit"). Nobody has reported depending on it in the ~21 months
> since, and v2 has covered the same ground for a long time with
> memory.low and memory.min.
>
> Link: https://lore.kernel.org/all/6a7a6929.b50370da.49fe0.005e.GAE@google.com/ [1]
>
> Shakeel Butt (9):
>   memcg: make the v1 soft limit knob inert
>   memcg: remove v1 soft limit reclaim
>   memcg: remove mem_cgroup_shrink_node()
>   memcg: remove the soft limit reclaim tracepoints
>   memcg: remove the soft limit rbtree
>   memcg: remove lru_gen_soft_reclaim()
>   memcg: remove the per-node soft limit tree fields
>   memcg: remove mem_cgroup->soft_limit
>   memcg: simplify v1 event ratelimiting
>
>  .../admin-guide/cgroup-v1/memory.rst          |  49 +-
>  include/linux/memcontrol.h                    |  27 --
>  include/linux/mmzone.h                        |  30 +-
>  include/trace/events/vmscan.h                 |  14 -
>  mm/internal.h                                 |   4 -
>  mm/memcontrol-v1.c                            | 435 ++----------------
>  mm/memcontrol-v1.h                            |  12 +-
>  mm/memcontrol.c                               |   7 +-
>  mm/vmscan.c                                   |  96 +---
>  9 files changed, 66 insertions(+), 608 deletions(-)

This is a gorgeous diffstat :)

Obviously not my area but looking over it, all LGTM so feel free to add:

Acked-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>

To the whole series!

>
> --
> 2.53.0-Meta
>

--
Cheers, Lorenzo
Re: [PATCH for-7.4 0/9] memcg: remove the v1 soft limit
Posted by Shakeel Butt 1 month, 2 weeks ago
On Thu, Aug 13, 2026 at 10:27:09AM +0100, Lorenzo Stoakes (ARM) wrote:
> On Tue, Aug 11, 2026 at 01:31:54PM -0700, Shakeel Butt wrote:
> > Syzbot reported [1] a set_mm_walk() warning from kswapd. Soft limit
> > reclaim is the only thing that runs shrink_lruvec() from kswapd with a
> > target memcg set, and thus the only way kswapd can reach
> > lru_gen_shrink_lruvec() and in turn set_mm_walk(). The offender,
> > mem_cgroup_shrink_node(), has long carried a "Only used by soft limit
> > reclaim. Do not reuse for anything else." comment and a priority hack,
> > and it simply never got taught about MGLRU.
> >
> > Rather than teach it, let's delete it. The v1 soft limit was deprecated
> > in v6.12 by commit 569c4f62d84a ("memcg: initiate deprecation of v1
> > soft limit"). Nobody has reported depending on it in the ~21 months
> > since, and v2 has covered the same ground for a long time with
> > memory.low and memory.min.
> >
> > Link: https://lore.kernel.org/all/6a7a6929.b50370da.49fe0.005e.GAE@google.com/ [1]
> >
> > Shakeel Butt (9):
> >   memcg: make the v1 soft limit knob inert
> >   memcg: remove v1 soft limit reclaim
> >   memcg: remove mem_cgroup_shrink_node()
> >   memcg: remove the soft limit reclaim tracepoints
> >   memcg: remove the soft limit rbtree
> >   memcg: remove lru_gen_soft_reclaim()
> >   memcg: remove the per-node soft limit tree fields
> >   memcg: remove mem_cgroup->soft_limit
> >   memcg: simplify v1 event ratelimiting
> >
> >  .../admin-guide/cgroup-v1/memory.rst          |  49 +-
> >  include/linux/memcontrol.h                    |  27 --
> >  include/linux/mmzone.h                        |  30 +-
> >  include/trace/events/vmscan.h                 |  14 -
> >  mm/internal.h                                 |   4 -
> >  mm/memcontrol-v1.c                            | 435 ++----------------
> >  mm/memcontrol-v1.h                            |  12 +-
> >  mm/memcontrol.c                               |   7 +-
> >  mm/vmscan.c                                   |  96 +---
> >  9 files changed, 66 insertions(+), 608 deletions(-)
> 
> This is a gorgeous diffstat :)
> 
> Obviously not my area but looking over it, all LGTM so feel free to add:
> 
> Acked-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> 
> To the whole series!

Thanks for the review.