[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d2ed9b04-8372-47e2-976a-b6a130edc161@oracle.com>
Date: Thu, 28 Aug 2025 18:04:22 -0700
From: Anthony Yznaga <anthony.yznaga@...cle.com>
To: Yongting Lin <linyongting@...edance.com>, khalid@...nel.org,
shuah@...nel.org
Cc: linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org,
akpm@...ux-foundation.org, linux-mm@...ck.org
Subject: Re: [PATCH 8/8] mshare: selftests: Add test case to demostrate that
mshare doesn't support THP
On 8/25/25 7:57 AM, Yongting Lin wrote:
> This case is quit simple by using madvise(MADV_HUGEPAGE), but for verifying
> the size of THP memory, we need to setup the memcg and attach test
> process to this memcg before perform the test.
>
> Because mshare doesn't support THP feature, the size of THP memory should
> be 0 even though we use madivse.
There can be THPs in an mshare region if THP settings are set to
"always", but otherwise madvise() won't work directly on the msharefs
VMA. It will be necessary to implement an ioctl to apply madvise
operations to memory in an mshare region.
Anthony
>
> Signed-off-by: Yongting Lin <linyongting@...edance.com>
> ---
> tools/testing/selftests/mshare/memory.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/tools/testing/selftests/mshare/memory.c b/tools/testing/selftests/mshare/memory.c
> index 7754c0e33506..2a415ce7bc01 100644
> --- a/tools/testing/selftests/mshare/memory.c
> +++ b/tools/testing/selftests/mshare/memory.c
> @@ -68,4 +68,15 @@ TEST_F(memory, swap)
> ASSERT_GT(swap_size, GB(1) * 9 / 10);
> }
>
> +TEST_F(memory, thp)
> +{
> + ASSERT_NE(madvise(self->addr, self->allocate_size, MADV_HUGEPAGE), -1);
> + /* touch 1G */
> + memset(self->addr, 0x01, GB(1));
> +
> + size_t huge = read_huge_from_cgroup(self->cgroup);
> + /* mshare don't support THP now */
> + ASSERT_EQ(huge, 0);
> +}
> +
> TEST_HARNESS_MAIN
Powered by blists - more mailing lists