From: Max Kellermann <max.kellermann@ionos.com>
To: David Hildenbrand <david@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
lorenzo.stoakes@oracle.com, 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 1/2] huge_mm.h: is_huge_zero_folio(NULL) should return false
Date: Wed, 27 Aug 2025 15:06:43 +0200 [thread overview]
Message-ID: <CAKPOu+9j5+w6ydvygdWnryZM24AFPSVJB_21VH8Odi_xdrNksg@mail.gmail.com> (raw)
In-Reply-To: <11a5d391-3a13-4376-98f1-34b529d3c583@redhat.com>
On Wed, Aug 27, 2025 at 1:56 PM David Hildenbrand <david@redhat.com> wrote:
> > This patch isn't about the function parameter but about the global
> > variable being NULL.
> > (Don't mix up with my other patch.)
>
> Huh?
Oh, I see the misunderstanding. You are right here, yes my patch is
indeed about passing NULL to is_huge_zero_folio(). My previous reply
was confusing.
But you were replying to a sub-thread by Andrew who questioned whether
a call is_huge_zero_folio() is legal at all before the huge zero folio
has been created.
The question I asked Andrew, which you replied to, was not about
passing NULL to is_huge_zero_folio(), but about whether the call to
is_huge_zero_folio() is legal at all, no matter which parameter value.
I agree with you that is_huge_zero_folio(NULL) should not be legal and
makes no sense. It's a bug somewhere in the caller.
But I saw that the current implementation effectively (randomly) hides
a bug in another part of the kernel (= Ceph), one that I'd rather like
to be visible (and get fixed). And that is the point of my patch, and
is the reason why I chose to have the additional debug-only code
inside an #ifdef - I don't want normal users to pay the price for a
debugging feature, no matter how small the price.
David, what is your opinion here?
- leave it as it is; is_huge_zero_folio(NULL) may randomly return true
or false (= reject this patch)
- add the huge_zero_folio==NULL check, but guarded with #ifdef DEBUG
(= this patch)
- add the huge_zero_folio==NULL check unconditionally (suggested by Zi Yan)
And do you agree with Andrew that calling is_huge_zero_folio() should
only be legal if huge_zero_folio!=NULL?
Max
next prev parent reply other threads:[~2025-08-27 13:16 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 [this message]
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
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=CAKPOu+9j5+w6ydvygdWnryZM24AFPSVJB_21VH8Odi_xdrNksg@mail.gmail.com \
--to=max.kellermann@ionos.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=lorenzo.stoakes@oracle.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).