[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bcb9940a-18ae-48e6-b000-53fca461fff8@lucifer.local>
Date: Mon, 4 Aug 2025 17:50:46 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
To: "Pankaj Raghav (Samsung)" <kernel@...kajraghav.com>
Cc: Suren Baghdasaryan <surenb@...gle.com>,
Ryan Roberts <ryan.roberts@....com>,
Baolin Wang <baolin.wang@...ux.alibaba.com>,
Borislav Petkov <bp@...en8.de>, Ingo Molnar <mingo@...hat.com>,
"H . Peter Anvin" <hpa@...or.com>, Vlastimil Babka <vbabka@...e.cz>,
Zi Yan <ziy@...dia.com>, Mike Rapoport <rppt@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Michal Hocko <mhocko@...e.com>, David Hildenbrand <david@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>, Nico Pache <npache@...hat.com>,
Dev Jain <dev.jain@....com>,
"Liam R . Howlett" <Liam.Howlett@...cle.com>,
Jens Axboe <axboe@...nel.dk>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, willy@...radead.org, x86@...nel.org,
linux-block@...r.kernel.org, Ritesh Harjani <ritesh.list@...il.com>,
linux-fsdevel@...r.kernel.org, "Darrick J . Wong" <djwong@...nel.org>,
mcgrof@...nel.org, gost.dev@...sung.com, hch@....de,
Pankaj Raghav <p.raghav@...sung.com>
Subject: Re: [PATCH 4/5] mm: add largest_zero_folio() routine
On Mon, Aug 04, 2025 at 02:13:55PM +0200, Pankaj Raghav (Samsung) wrote:
> From: Pankaj Raghav <p.raghav@...sung.com>
>
> Add largest_zero_folio() routine so that huge_zero_folio can be
> used directly when CONFIG_STATIC_HUGE_ZERO_FOLIO is enabled. This will
> return ZERO_PAGE folio if CONFIG_STATIC_HUGE_ZERO_FOLIO is disabled or
> if we failed to allocate a huge_zero_folio.
>
> Co-developed-by: David Hildenbrand <david@...hat.com>
> Signed-off-by: David Hildenbrand <david@...hat.com>
> Signed-off-by: Pankaj Raghav <p.raghav@...sung.com>
This looks good to me minus nit + comment below, so:
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
> ---
> include/linux/huge_mm.h | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
> index 78ebceb61d0e..c44a6736704b 100644
> --- a/include/linux/huge_mm.h
> +++ b/include/linux/huge_mm.h
> @@ -716,4 +716,21 @@ static inline int split_folio_to_order(struct folio *folio, int new_order)
> return split_folio_to_list_to_order(folio, NULL, new_order);
> }
>
> +/*
Maybe let's make this a kernel doc comment?
> + * largest_zero_folio - Get the largest zero size folio available
> + *
> + * This function will return huge_zero_folio if CONFIG_STATIC_HUGE_ZERO_FOLIO
> + * is enabled. Otherwise, a ZERO_PAGE folio is returned.
> + *
> + * Deduce the size of the folio with folio_size instead of assuming the
> + * folio size.
> + */
> +static inline struct folio *largest_zero_folio(void)
> +{
> + struct folio *folio = get_static_huge_zero_folio();
> +
> + if (folio)
> + return folio;
> + return page_folio(ZERO_PAGE(0));
Feels like we should have this in a wrapper function somewhere. Then again it
seems people generally always open-code 'ZERO_PAGE(0)' anyway so maybe this is
sort of the 'way things are done'? :P
> +}
> #endif /* _LINUX_HUGE_MM_H */
> --
> 2.49.0
>
Powered by blists - more mailing lists