Re: madvise09: Reset cgroup limits before retrying test

[email protected]
Newsgroups gmane.linux.ltp
Message-ID <[email protected]>
Hi Wake,

On Mon Jul 13 01:25:45 2026, Wake Liu wrote:
> madvise09: Reset cgroup limits before retrying test

> +	if (SAFE_CG_HAS(tst_cg, "memory.max"))
> +		SAFE_CG_PRINT(tst_cg, "memory.max", "max");

The test requires `.needs_cgroup_ctrls = { "memory", NULL }`, so
memory.max is guaranteed to exist when the memory controller is
available. The SAFE_CG_HAS guard is unnecessary here and creates an
inconsistency with the unconditional write to the same file later:

    SAFE_CG_PRINTF(tst_cg, "memory.max", "%d", MEM_LIMIT);

Can the guard be dropped to match the style used for the later write?

> +	if (swap_accounting_enabled && SAFE_CG_HAS(tst_cg, "memory.swap.max"))
> +		SAFE_CG_PRINT(tst_cg, "memory.swap.max", "max");

swap_accounting_enabled is already set in setup() based on
SAFE_CG_HAS(tst_cg, "memory.swap.max"), so the second SAFE_CG_HAS
call is redundant. The later write is correctly guarded with just
swap_accounting_enabled:

    if (swap_accounting_enabled) {
        SAFE_CG_PRINTF(tst_cg, "memory.swap.max", "%d", SWAP_LIMIT);

Can this be simplified to match?

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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.