[LTP] [PATCH v1 2/2] memcontrol03, memcontrol04: Set protection on parent cgroups to prevent kswapd over-reclaim
Wei Gao
wegao@suse.com
Thu Oct 8 04:10:17 CEST 2026
On Mon, Oct 05, 2026 at 05:37:46PM +0200, Michal Koutný wrote:
> Hello Wei.
>
> On Sun, Oct 04, 2026 at 02:33:27PM +0000, Wei Gao <wegao@suse.com> wrote:
> > On NUMA systems (observed on PowerPC), allocating memory can trigger
> > node-level memory pressure, waking up kswapd when free pages fall below
> > the low watermark on a node.
> >
> > In cgroup v2, both hard protection (memory.min) and best-effort protection
> > (memory.low) are hierarchical and calculated top-down: effective
> > protection of descendant cgroups is bounded by their ancestors' protection
> > values. When LTP runs inside an existing cgroup hierarchy, ancestor cgroups
> > above the test root have memory.min and memory.low set to 0.
>
> Note that this is expected behavior of protection and the test is meant
> to work "relatively" with its own pressure source and target [1].
>
>
> > As a result, when kswapd performs node-level background reclaim from the
> > root cgroup downwards, ancestor cgroups without protection provide no
> > protection boundary. kswapd reclaims pages from descendant leaf cgroups
> > regardless of their local memory.min / memory.low settings, causing
> > memcontrol03 and memcontrol04 to fail with over-reclaim:
>
> Generally, this is not specific to this test -- it is because it the
> whole host is overcommitted (edit: as I see the NUMA info below it could
> be perhaps that only individual nodes are too small).
>
> So I wonder could this be ensured at higher level -- something that sets
> up the environment of the individual runners (e.g. reduce parallelism,
> partition the system with memory limits or as a variant configure
> generic memory protection)?
>
> WDYT?
Protecting this solely from the external runner is tricky since LTP builds
a 3-level cgroup hierarchy:
- /sys/fs/cgroup/ltp (Level 1)
- tst_cg (/sys/fs/cgroup/ltp/ltp-testxxxx, Level 2 — trunk_A's parent)
- trunk_cg[A] (Level 3 — trunk_B's parent)
Every level in this chain needs memory.low = 50M. Even if an external runner
sets it at /sys/fs/cgroup/ltp, tst_cg or trunk_A will break the protection chain.
Another option is make sure enough memory to the test environment so kswapd
doesn't get triggered at all. I guess we can do this to avoid issue?
> Michal
>
>
> [1] https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#reclaim-protection
More information about the ltp
mailing list