From: Cyril Hrubis <chrubis@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] memory: rewrite memcg_stress_test into C API
Date: Wed, 5 Nov 2025 17:45:56 +0100 [thread overview]
Message-ID: <aQt_ROM-3vNniS_J@yuki.lan> (raw)
In-Reply-To: <20251105-b4-memcg_stress_rewrite-v1-1-5e354dd5439f@suse.com>
Hi!
> + SAFE_FILE_PRINTF("/proc/sys/vm/drop_caches", "3");
> +
> + mem_free = SAFE_READ_MEMINFO("MemFree:");
> + mem_avail = SAFE_READ_MEMINFO("MemAvailable:");
> + swap_free = SAFE_READ_MEMINFO("SwapFree:");
> +
> + SAFE_FILE_SCANF("/proc/sys/vm/min_free_kbytes", "%zi", &mem_min);
> +
> + mem_min = mem_min + mem_min / 10;
> + reserved_mem = swap_free > mem_min ? 0 : mem_min;
> +
> + mem_per_proc = mem_free < mem_avail ? mem_free : mem_avail;
We just dropped caches, so mem_free should be close to mem_avail. I
guess that we can use only one of these two.
It looks more or less fine as the replacement, however I find some
things in the test a bit worrisome. For instance the sleep() between
forks of the children will be on some systems enough for the previous
child to finish while on bigger systems (with large RAM) would be too
short. So first of all we should decide if we want to run the children
in serial or in parallel mode and change the code accordingly. As for me
serial mode makes more sense to me, since with parallel mode we are
going to hit OOM under certain conditions.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2025-11-05 16:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-05 9:43 [LTP] [PATCH] memory: rewrite memcg_stress_test into C API Andrea Cervesato
2025-11-05 16:45 ` Cyril Hrubis [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aQt_ROM-3vNniS_J@yuki.lan \
--to=chrubis@suse.cz \
--cc=andrea.cervesato@suse.de \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox