linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Li Wang <liwang@redhat.com>
To: David Hildenbrand <david@redhat.com>
Cc: akpm@linux-foundation.org, lorenzo.stoakes@oracle.com,
	 linux-kselftest@vger.kernel.org, linux-mm@kvack.org,
	 linux-kernel@vger.kernel.org,
	 Aruna Ramakrishna <aruna.ramakrishna@oracle.com>,
	Bagas Sanjaya <bagasdotme@gmail.com>,
	 Catalin Marinas <catalin.marinas@arm.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	 Joey Gouly <joey.gouly@arm.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	 Keith Lucas <keith.lucas@oracle.com>,
	Ryan Roberts <ryan.roberts@arm.com>,
	 Shuah Khan <shuah@kernel.org>
Subject: Re: [PATCH v2] ksm_tests: Skip hugepage test when Transparent Hugepages are disabled
Date: Tue, 24 Jun 2025 21:26:28 +0800	[thread overview]
Message-ID: <CAEemH2cMNfsBKSm397gEUV2=u3RyRpr0FUH+bgw+vpc5MEX4Rg@mail.gmail.com> (raw)
In-Reply-To: <4b69c14f-1001-48a0-9c83-6d2284b5a04a@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1454 bytes --]

Hi David,

On Tue, Jun 24, 2025 at 4:25 PM David Hildenbrand <david@redhat.com> wrote:

> On 24.06.25 05:27, Li Wang wrote:
> > Some systems (e.g. minimal or real-time kernels) may not enable
> > Transparent Hugepages (THP), causing MADV_HUGEPAGE to return EINVAL.
> > This patch introduces a runtime check using the existing THP sysfs
> > interface and skips the hugepage merging test (`-H`) when THP is
> > not available.
> >
> > To avoid those failures:
>
> But we deliberately have in tools/testing/selftests/mm/config:
>
> CONFIG_TRANSPARENT_HUGEPAGE=y
>
> So isn't this rather a test setup issue? Meaning, the environment is
> not well prepared.
>

It's true that CONFIG_TRANSPARENT_HUGEPAGE=y is explicitly
enabled in tools/testing/selftests/mm/config, so ideally the runtime
environment should also support THP.

However, in practice, we've found that on some systems:

- THP is disabled at boot time (transparent_hugepage=never)
- Or manually disabled via sysfs
- Or unavailable in RT kernels, containers, or minimal CI environments

In these cases, the test will fail with EINVAL on madvise(MADV_HUGEPAGE),
even though the kernel config is correct.

To make the test suite more robust and avoid false negatives, this patch
adds a runtime check for /sys/kernel/mm/transparent_hugepage/enabled.

If THP is not available, the hugepage test (-H) is skipped with a clear
message.


-- 
Regards,
Li Wang

[-- Attachment #2: Type: text/html, Size: 2841 bytes --]

      reply	other threads:[~2025-06-24 13:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-21  0:48 [PATCH] ksm_tests: Skip hugepage test when Transparent Hugepages are disabled Li Wang
2025-06-23  9:01 ` Lorenzo Stoakes
2025-06-24  3:27 ` [PATCH v2] " Li Wang
2025-06-24  8:25   ` David Hildenbrand
2025-06-24 13: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='CAEemH2cMNfsBKSm397gEUV2=u3RyRpr0FUH+bgw+vpc5MEX4Rg@mail.gmail.com' \
    --to=liwang@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=aruna.ramakrishna@oracle.com \
    --cc=bagasdotme@gmail.com \
    --cc=catalin.marinas@arm.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=joey.gouly@arm.com \
    --cc=keith.lucas@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=ryan.roberts@arm.com \
    --cc=shuah@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).