From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
To: Yeoreum Yun <yeoreum.yun@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>, Zi Yan <ziy@nvidia.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
"Liam R. Howlett" <liam@infradead.org>,
Nico Pache <nico.pache@linux.dev>,
Ryan Roberts <ryan.roberts@arm.com>, Dev Jain <dev.jain@arm.com>,
Barry Song <baohua@kernel.org>,
Lance Yang <lance.yang@linux.dev>,
Usama Arif <usama.arif@linux.dev>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>, Shuah Khan <shuah@kernel.org>,
Kevin Brodsky <kevin.brodsky@arm.com>,
linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] kselftest: mm: replace usage of /proc/self/smaps for check_huge_xxx() helper
Date: Fri, 28 Aug 2026 11:31:47 +0100 [thread overview]
Message-ID: <apFhDA4e1sBfDOeh@gremlin> (raw)
In-Reply-To: <apFgVvNMbdhYnu6p@e129823.arm.com>
On Fri, Aug 28, 2026 at 11:17:58AM +0100, Yeoreum Yun wrote:
> > On Fri, Aug 28, 2026 at 09:11:34AM +0100, Yeoreum Yun wrote:
> > > Since glibc commit 321e1fc73f (“malloc: Enable 2MB THP by default on AArch64”),
> > > glibc may call madvise(MADV_HUGEPAGE) for sufficiently large allocations
> > > made by memalign().
> > >
> > > The underlying VMA may start at a different address from the aligned
> > > address returned by memalign(). Furthermore, a subsequent
> > > madvise(MADV_HUGEPAGE) call does not split the VMA because the flag is
> > > already set.
> > >
> > > This causes split_huge_page_test to fail because the check_huge_xxx()
> > > helpers incorrectly require the address returned by memalign() to
> > > match the VMA start address reported in /proc/self/smaps.
> >
> > Hmm, is the test correctly putting sentinels either side of the VMA? Any test
> > that doesn't risks flaking due to unwanted VMA merges.
>
> I believe that with this change, we don’t need to worry about unwanted
> VMA merges when checking for huge pages, since the test no longer relies
> on VMA sentinels but directly checks whether the mapping is huge or not.
We always need to worry about that though, anything that asserts stuff on a
VMA level must prevent unwanted merges first.
I guess I'm asking you in a roundabout way to go check and if there isn't
isolation like that (i.e. mapping PROT_NONE VMAs around the VMA you want)
then to go do that :)
I think glibc going off and mapping a bigger VMA is possibly a symptom
of this not being done.
>
> Also, this flaky failure was not caused by a VMA merge, but by a change
> in glibc’s behavior that sets HUGEPAGE for sufficiently large areas.
Yep your change is worthwhile reagrdless! :)
>
> Might for the *NO_HUGEPAGE* setup, there would be a chance to merge
> VMA area, But since it seraches the mapping directly, it's fine.
As above, generally we should put this protection in case, even if it's
unlikely for a VMA with VMA_NOHUGEPAGE_BIT set!
>
> >
> > >
> > > Fix this by using /proc/self/pagemap and /proc/kpageflags instead of
> > > /proc/self/smaps to detect huge pages.
> >
> > You should probably call out the fact you're doing some refactoring here
> > also!
>
> Okay. I'll spell out with some detail. Thanks!
Thnks!
>
> >
> > >
> > > Reported-by: David Hildenbrand (Arm) <david@kernel.org>
> >
> > Should always have a Closes: tag if Reported-by: ideally.
>
> Yes. but talked with personally nothing to close. So Reported-by tag
> only. Would it be better to remove?
Yeah or Suggested-by maybe? If he said it to you on-list then a Closes:
<lore link> works also!
--
Cheers, Lorenzo
next prev parent reply other threads:[~2026-08-28 10:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 8:11 [PATCH v3 0/2] kselftest: mm: fix some failure of split_huge_page_test Yeoreum Yun
2026-08-28 8:11 ` [PATCH v3 1/2] kselftest: mm: prevent random failure of huge page split for khugepaged Yeoreum Yun
2026-08-28 9:39 ` Lorenzo Stoakes (ARM)
2026-08-28 10:04 ` Yeoreum Yun
2026-08-28 8:11 ` [PATCH v3 2/2] kselftest: mm: replace usage of /proc/self/smaps for check_huge_xxx() helper Yeoreum Yun
2026-08-28 9:30 ` Lorenzo Stoakes (ARM)
2026-08-28 10:17 ` Yeoreum Yun
2026-08-28 10:31 ` Lorenzo Stoakes (ARM) [this message]
2026-08-28 14:35 ` Yeoreum Yun
2026-08-28 17:21 ` Lorenzo Stoakes (ARM)
2026-08-28 15:13 ` Zi Yan
2026-08-28 15:22 ` Yeoreum Yun
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=apFhDA4e1sBfDOeh@gremlin \
--to=ljs@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@kernel.org \
--cc=dev.jain@arm.com \
--cc=kevin.brodsky@arm.com \
--cc=lance.yang@linux.dev \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=nico.pache@linux.dev \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=shuah@kernel.org \
--cc=surenb@google.com \
--cc=usama.arif@linux.dev \
--cc=vbabka@kernel.org \
--cc=yeoreum.yun@arm.com \
--cc=ziy@nvidia.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
all inboxes | Powered by JetHome®