[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKPOu+9j5+w6ydvygdWnryZM24AFPSVJB_21VH8Odi_xdrNksg@mail.gmail.com>
Date: Wed, 27 Aug 2025 15:06:43 +0200
From: Max Kellermann <max.kellermann@...os.com>
To: David Hildenbrand <david@...hat.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>, lorenzo.stoakes@...cle.com, ziy@...dia.com,
baolin.wang@...ux.alibaba.com, Liam.Howlett@...cle.com, npache@...hat.com,
ryan.roberts@....com, dev.jain@....com, baohua@...nel.org,
shikemeng@...weicloud.com, kasong@...cent.com, nphamcs@...il.com,
bhe@...hat.com, chrisl@...nel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] huge_mm.h: is_huge_zero_folio(NULL) should return false
On Wed, Aug 27, 2025 at 1:56 PM David Hildenbrand <david@...hat.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
Powered by blists - more mailing lists