From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: David Hildenbrand <david@redhat.com>
Cc: Max Kellermann <max.kellermann@ionos.com>,
akpm@linux-foundation.org, ziy@nvidia.com,
baolin.wang@linux.alibaba.com, Liam.Howlett@oracle.com,
npache@redhat.com, ryan.roberts@arm.com, dev.jain@arm.com,
baohua@kernel.org, shikemeng@huaweicloud.com, kasong@tencent.com,
nphamcs@gmail.com, bhe@redhat.com, chrisl@kernel.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] huge_mm.h: disallow is_huge_zero_folio(NULL)
Date: Wed, 27 Aug 2025 21:44:28 +0100 [thread overview]
Message-ID: <6e6605f7-0249-4c5d-afac-e85e8536b0b6@lucifer.local> (raw)
In-Reply-To: <4927ed52-a250-4ae8-b596-6f81020eb31a@redhat.com>
On Wed, Aug 27, 2025 at 10:26:09PM +0200, David Hildenbrand wrote:
> On 27.08.25 22:01, David Hildenbrand wrote:
> >
> > > This seems not so great.
> > >
> > > I really think the VM_WARN_ON_ONCE() should be in folios_put_refs() based
> > > on what you've said.
> >
> > No.
> >
> > Everything in folio_put_refs() will dereference the folio and properly
> > crash the machine when doing something stupid.
> >
> > This function, however, will silently swallow a "NULL" pointer.
> >
> > >
> > > >
> > > > Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
> > > > ---
> > > > include/linux/huge_mm.h | 3 +++
> > > > 1 file changed, 3 insertions(+)
> > > >
> > > > diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
> > > > index 7748489fde1b..bc9ca7798f2e 100644
> > > > --- a/include/linux/huge_mm.h
> > > > +++ b/include/linux/huge_mm.h
> > > > @@ -2,6 +2,7 @@
> > > > #ifndef _LINUX_HUGE_MM_H
> > > > #define _LINUX_HUGE_MM_H
> > > >
> > > > +#include <linux/mmdebug.h> // for VM_WARN_ON_ONCE()
> > >
> > > Please don't do //.
> > >
> > > This include is suspect though, huge_mm.h is included from mm.h and thus
> > > this very easily might break some arch that is weird about this stuff,
> > > because a ton of stuff includes mm.h including things that might absolutely
> > > baulk at mmdebug.
> >
> > Jup. Very likely this is not required.
>
> Took another look and including mmdebug.h should likely be fine, because all
> it includes is really
>
> (1) include/linux/bug.h
> (2) include/linux/stringify.h
>
> But originally, I wonder if we even need mmdebug.h or if it is already
> implicitly included.
>
> huge_mm.h includes mm_types.h (where we already do use VM_WARN...).
>
> I assume there we get it implicitly through percpu.h, mmap_lock.h or
> percpu.h
>
> So the include should just get dropped.
Ah nice, let's do this then please! :)
Thanks for checking!
Cheers, Lorenzo
next prev parent reply other threads:[~2025-08-27 20:45 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-26 23:16 [PATCH 1/2] huge_mm.h: is_huge_zero_folio(NULL) should return false Max Kellermann
2025-08-26 23:16 ` [PATCH 2/2] mm/swap: add BUG_ON(folio==NULL) to folios_put_refs() Max Kellermann
2025-08-27 1:42 ` Zi Yan
2025-08-27 2:12 ` Chris Li
2025-08-27 9:38 ` David Hildenbrand
2025-08-27 1:19 ` [PATCH 1/2] huge_mm.h: is_huge_zero_folio(NULL) should return false Zi Yan
2025-08-27 1:55 ` Andrew Morton
2025-08-27 4:39 ` Max Kellermann
2025-08-27 9:36 ` David Hildenbrand
2025-08-27 10:13 ` Max Kellermann
2025-08-27 11:56 ` David Hildenbrand
2025-08-27 13:06 ` Max Kellermann
2025-08-27 14:34 ` David Hildenbrand
2025-08-27 15:03 ` [PATCH v2] huge_mm.h: disallow is_huge_zero_folio(NULL) Max Kellermann
2025-08-27 15:16 ` Lorenzo Stoakes
2025-08-27 15:38 ` Max Kellermann
2025-08-27 20:01 ` David Hildenbrand
2025-08-27 20:26 ` David Hildenbrand
2025-08-27 20:44 ` Lorenzo Stoakes [this message]
2025-08-28 8:48 ` [PATCH v3] " Max Kellermann
2025-08-28 9:35 ` Lorenzo Stoakes
2025-08-29 1:25 ` Zi Yan
2025-08-27 23:53 ` [PATCH v2] " Andrew Morton
2025-08-28 5:17 ` Max Kellermann
2025-08-28 7:57 ` David Hildenbrand
2025-08-27 15:05 ` [PATCH 1/2] huge_mm.h: is_huge_zero_folio(NULL) should return false Max Kellermann
2025-08-27 9:35 ` David Hildenbrand
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=6e6605f7-0249-4c5d-afac-e85e8536b0b6@lucifer.local \
--to=lorenzo.stoakes@oracle.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=bhe@redhat.com \
--cc=chrisl@kernel.org \
--cc=david@redhat.com \
--cc=dev.jain@arm.com \
--cc=kasong@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=max.kellermann@ionos.com \
--cc=npache@redhat.com \
--cc=nphamcs@gmail.com \
--cc=ryan.roberts@arm.com \
--cc=shikemeng@huaweicloud.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;
as well as URLs for NNTP newsgroup(s).