Re: [PATCH mm-unstable v2 1/3] mm/contig_alloc: support __GFP_COMP
From: Andrew Morton
Date: Thu Aug 22 2024 - 14:36:40 EST
On Thu, 22 Aug 2024 16:21:27 +0800 Yu Liao <liaoyu15@xxxxxxxxxx> wrote:
> > +#ifdef CONFIG_CONTIG_ALLOC
> > +static inline struct folio *folio_alloc_gigantic_noprof(int order, gfp_t gfp,
> > + int nid, nodemask_t *node)
> > +{
> > + struct page *page;
> > +
> > + if (WARN_ON(!order || !(gfp | __GFP_COMP)))
>
> It doesn't seem right, it should be !(gfp & __GFP_COMP).
Yup. Although I'm wondering why we're checking __GFP_COMP at all?
It's a gigantic page - we know it's compound, so why require that the
caller tell us something we already know?
--- a/include/linux/gfp.h~mm-contig_alloc-support-__gfp_comp-fix
+++ a/include/linux/gfp.h
@@ -452,7 +452,7 @@ static inline struct folio *folio_alloc_
{
struct page *page;
- if (WARN_ON(!order || !(gfp | __GFP_COMP)))
+ if (WARN_ON(!order || !(gfp & __GFP_COMP)))
return NULL;
page = alloc_contig_pages_noprof(1 << order, gfp, nid, node);
_