From: Li Wang <li.wang@linux.dev>
To: Wei Gao <wegao@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v5] mmapstress06: Convert to new API
Date: Wed, 10 Jun 2026 10:26:57 +0800 [thread overview]
Message-ID: <aijLcXEZ44cVUNKl@linux.dev> (raw)
In-Reply-To: <20260608025234.1117-1-wegao@suse.com>
Wei Gao wrote:
> +
> + mmapaddr = SAFE_MMAP(NULL, map_size, PROT_READ | PROT_WRITE,
> + MAP_ANONYMOUS | MAP_SHARED, -1, 0);
> +
> + /*
> + * Disable Transparent Huge Pages (THP) for this mapping.
> + * Under tight cgroup memory limits (128 MB), allocating huge
> + * pages can easily trigger MemCG OOM-kills. Disabling THP forces
> + * standard 4 KB pages, ensuring stable swapping and avoiding
> + * premature OOM.
> + */
> + if (madvise(mmapaddr, map_size, MADV_NOHUGEPAGE) < 0)
> + tst_res(TWARN | TERRNO, "madvise(MADV_NOHUGEPAGE) failed");
The key point is that this is a MAP_ANONYMOUS | MAP_SHARED mapping.
Shared anonymous memory isn't backed by the normal anonymous-THP machinery,
it's backed internally by shmem/tmpfs.
THP behavior for shmem is governed by a separate knob:
# cat /sys/kernel/mm/transparent_hugepage/shmem_enabled
always within_size advise [never] deny force
basically all distro kernels this defaults to never.
So in the default configuration, no huge pages would ever be allocated for
this mapping, and the madvise(MADV_NOHUGEPAGE) is effectively a no-op.
--
Regards,
Li Wang
--
Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2026-06-10 2:27 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-27 11:59 [LTP] [PATCH v1] mmapstress06: TCONF on systems without swap space Wei Gao via ltp
2026-04-27 12:26 ` Li Wang
2026-04-27 13:57 ` Wei Gao via ltp
2026-04-28 1:39 ` Li Wang
2026-04-27 13:57 ` [LTP] " linuxtestproject.agent
2026-04-28 11:52 ` [LTP] [PATCH v1] " Andrea Cervesato via ltp
2026-04-28 12:58 ` Petr Vorel
2026-04-28 16:34 ` Petr Vorel
2026-04-29 2:22 ` Wei Gao via ltp
2026-04-29 6:10 ` Petr Vorel
2026-04-30 8:01 ` Li Wang
2026-06-05 4:29 ` [LTP] [PATCH v2] mmapstress06: Convert to new API Wei Gao via ltp
2026-06-05 5:28 ` [LTP] " linuxtestproject.agent
2026-06-05 7:11 ` Li Wang
2026-06-05 7:17 ` [LTP] [PATCH v2] " Andrea Cervesato via ltp
2026-06-05 9:35 ` Wei Gao via ltp
2026-06-05 9:42 ` Andrea Cervesato via ltp
2026-06-05 10:02 ` Wei Gao via ltp
2026-06-06 10:08 ` [LTP] [PATCH v3] " Wei Gao via ltp
2026-06-06 11:32 ` [LTP] " linuxtestproject.agent
2026-06-07 4:52 ` [LTP] [PATCH v4] " Wei Gao via ltp
2026-06-07 8:02 ` [LTP] " linuxtestproject.agent
2026-06-08 2:52 ` [LTP] [PATCH v5] " Wei Gao via ltp
2026-06-08 4:51 ` [LTP] " linuxtestproject.agent
2026-06-10 2:26 ` Li Wang [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=aijLcXEZ44cVUNKl@linux.dev \
--to=li.wang@linux.dev \
--cc=ltp@lists.linux.it \
--cc=wegao@suse.com \
/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