Re: [PATCH v8 10/15] mm: Check individual hugetlb pages for poison

Gregory Price <[email protected]>
Newsgroups org.kernel.vger.linux-fsdevel,org.kvack.linux-mm
Message-ID <anJvBEHeq58WBQaj@gourry-fedora-PF4VCD3F>
On Tue, Aug 04, 2026 at 10:21:29PM +0100, Matthew Wilcox wrote:
> On Tue, Aug 04, 2026 at 03:15:37PM -0400, Gregory Price wrote:
> 
> So the pointer we get back from page_folio() must have been a folio _at
> some point_.  It may not be a folio now.  It may be a folio, but not one
> that contains this page.  But it's not a wild pointer, and treating it
> as if it's a folio won't cause any harm (as long as we're really careful).
> 
> Specifically, we call:
> 
> > +	if (!folio_test_huge_poison(folio)) {
> 
> and all that does is access folio->page.page_type aka mapcount.  So if
> the pointer we have is not a current folio, it'll just return false and
> we'll check PageHWPoison.
> 
> So the only case this can return 'true' is if the folio was hugetlb
> at that exact point.  And we've got the hugetlb lock, so it can't stop
> being a hugetlb folio.  At this point it's safe to walk the list.
>

This is basically the reasoning i came to, ergo "not worth addressing"

> That's my reasoning, and I think Sashiko has explained enough of its
> reasoning to be fairly sure Sashiko is wrong about this.  But hey,
> you're not Sashiko.  Maybe you've found a gap in my logic.

I think sashiko is essentially just saying:

"But if someone does a dumb thing with this interface in the future dumb
 things will happen"

To which we say "Don't do the blatantly dumb thing :]"

~Gregory
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.