[LTP] memcontrol: Add helpers to set and restore parent memory knobs

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Sun Oct 4 17:47:39 CEST 2026


Hi Wei,

On 4 October 2026, Wei Gao wrote:
> memcontrol: Add helpers to set and restore parent memory knobs

--- [PATCH 2/2] ---

> +	set_parent_memory_knob("memory.min", "50M");
> +	set_parent_memory_knob("memory.low", "50M");

High severity: overlapping instances of the same test race on the shared
ltp knob: X saves 0, Y saves X's 50M, X restores 0 while Y is active, and
Y finally restores 50M instead of the original 0. This both removes an
active test's protection and leaves a pre-existing ltp group modified.
Serialize the complete shared-parent save/use/restore interval, not just
the individual reads and writes.

>  static void cleanup(void)
>  {
> +	restore_parent_memory_knob("memory.min");

High severity: the same problem applies to memory.low cleanup: the
snapshots exist only in the forked test worker, which the framework kills
without running this callback on timeout or interruption. The supervisor
does not restore these knobs, so a pre-existing ltp group retains 50M.
Move shared-parent bookkeeping and restoration into supervising cgroup
cleanup, before cgroup teardown.

> Set memory.min and memory.low on trunk_A and parent cgroups up through the
> hierarchy before allocating child pagecache, ensuring protection propagates
> down the tree to prevent kswapd over-reclaim under NUMA memory pressure,

Medium severity: the helper stops at ltp, so it does not establish this
protection when the cgroup mount is rooted in a delegated subtree or
namespace whose root has memory.min/low set to 0. Global reclaim still
walks that real ancestor, and page_counter_calculate_protection() caps
the descendants' effective protection to 0. Handle or report insufficient
ancestor protection and document the restriction instead of claiming
protection throughout arbitrary hierarchies.

Verdict - Needs revision

---
Note:

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer


More information about the ltp mailing list