[LTP] mmapstress06: Rate limit page-dirtying loop to prevent MemCG OOM-kills

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Tue Aug 25 05:00:23 CEST 2026


Hi Wei,

On Tue, Aug 25, 2026, Wei Gao wrote:
> mmapstress06: Rate limit page-dirtying loop to prevent MemCG OOM-kills

> +		/*
> +		 * Yield periodically to space out allocation spikes and allow
> +		 * asynchronous swap writeback to catch up on slower VM disks.
> +		 */
>  		for (size_t i = 0; i < map_size; i += page_size) {
>  			mmapaddr[i] = 'a';
> -			if ((i % (2 * 1024 * 1024)) == 0)
> -				usleep(1000);
> +			if ((i % (64 * 1024)) == 0)
> +				usleep(200);

Could this avoid using a fixed sleep to synchronize with asynchronous swap
writeback? The 7.2 cgroup documentation says memory.max invokes the cgroup OOM
killer when reclaim cannot reduce usage, while the delay here is unrelated to
actual reclaim progress. A swap device slower than the chosen dirtying rate
can therefore still OOM-kill the child and make the test fail for
environmental timing reasons. Please use reclaim throttling or poll observable
progress with backoff instead of tuning a fixed delay.

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