[LTP] mmapstress06: Convert to new API

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Fri Jun 5 07:28:14 CEST 2026


Hi Wei,

On Fri, 05 Jun 2026, Wei Gao wrote:
> mmapstress06: Convert to new API

> +/*\
> + * Test ``:manpage:`mmap(2)``` with swap behavior.

The RST role is malformed. Other tests in the tree use it without
the surrounding double-backticks, e.g.:

  * Test :manpage:`mmap(2)` with swap behavior.

> +#include "tst_test.h"
> +#include "tst_safe_macros.h"

tst_test.h already includes tst_safe_macros.h; the second include
is redundant.

> +	if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)

WIFEXITED() and WEXITSTATUS() require <sys/wait.h>. That header is
not included, and nothing in the include chain pulls it in. Every
other test in testcases/kernel/mem/ that uses these macros includes
<sys/wait.h> explicitly (ksm05.c, vma01.c, mmapstress09.c).

> +	sysinfo(&s);
> +	total_swap = (unsigned long long)s.totalswap * s.mem_unit;
> +
> +	if (total_swap < map_size) {

This checks total (configured) swap, not available (free) swap. On a
system with 1 GB of total swap where 800 MB is already in use, the
check passes but the test would fail at runtime when only 200 MB of
free swap remains.

The tst_test framework provides .min_swap_avail (in megabytes) in
struct tst_test to guard against this; that field also removes the
need for the hand-rolled sysinfo() block. The swap check should also
test against the amount actually needed (map_size - mem_limit, around
500 MB), not against map_size (1000 MB).

The commit message also says "forcing the kernel to swap out exactly
500MB of memory", but the test only checks that cg_swap_after is
larger than cg_swap_before -- any non-zero increase would pass. The
word "exactly" is inaccurate.

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