From: Suren Baghdasaryan <surenb@google.com>
To: Zi Yan <ziy@nvidia.com>
Cc: Arnd Bergmann <arnd@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>,
Vlastimil Babka <vbabka@suse.cz>, Arnd Bergmann <arnd@arndb.de>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
Mike Rapoport <rppt@kernel.org>, Michal Hocko <mhocko@suse.com>,
Brendan Jackman <jackmanb@google.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Alexei Starovoitov <ast@kernel.org>,
Shakeel Butt <shakeel.butt@linux.dev>,
Kefeng Wang <wangkefeng.wang@huawei.com>,
Joshua Hahn <joshua.hahnjy@gmail.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: change vma_alloc_folio_noprof() macro to inline function
Date: Mon, 16 Feb 2026 19:24:03 +0000 [thread overview]
Message-ID: <CAJuCfpE=79uHrqKn4vmQ09TuR1uZBxpDck9WXXoG6OK6a0pZ=A@mail.gmail.com> (raw)
In-Reply-To: <15272AAE-6C14-4A80-AF70-4A46D1047B61@nvidia.com>
On Mon, Feb 16, 2026 at 4:58 PM Zi Yan <ziy@nvidia.com> wrote:
>
> On 16 Feb 2026, at 7:17, Arnd Bergmann wrote:
>
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > In a few rare configurations with extra warnings eanbled, the new
>
> s/eanbled/enabled
>
> > drm_pagemap_migrate_populate_ram_pfn() calls vma_alloc_folio_noprof()
> > but that does not use all the arguments, leading to a harmless warning:
> >
> > drivers/gpu/drm/drm_pagemap.c: In function 'drm_pagemap_migrate_populate_ram_pfn':
> > drivers/gpu/drm/drm_pagemap.c:701:63: error: parameter 'addr' set but not used [-Werror=unused-but-set-parameter=]
> > 701 | unsigned long addr)
> > | ~~~~~~~~~~~~~~^~~~
> >
>
> But addr is used at line 739 or line 741:
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/gpu/drm/drm_pagemap.c#n739
>
> I wonder why compiler reported the error.
>
> > Replace the macro with an inline function so the compiler can see
> > how the argument would be used, but is still able to optimize out
> > the assignments.
> >
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> > include/linux/gfp.h | 7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/linux/gfp.h b/include/linux/gfp.h
> > index 6ecf6dda93e0..23240208a91f 100644
> > --- a/include/linux/gfp.h
> > +++ b/include/linux/gfp.h
> > @@ -335,8 +335,11 @@ static inline struct folio *folio_alloc_mpol_noprof(gfp_t gfp, unsigned int orde
> > {
> > return folio_alloc_noprof(gfp, order);
> > }
> > -#define vma_alloc_folio_noprof(gfp, order, vma, addr) \
> > - folio_alloc_noprof(gfp, order)
> > +static inline struct folio *vma_alloc_folio_noprof(gfp_t gfp, int order,
> > + struct vm_area_struct *vma, unsigned long addr)
> > +{
> > + return folio_alloc_noprof(gfp, order);
> > +}
> > #endif
> >
> > #define alloc_pages(...) alloc_hooks(alloc_pages_noprof(__VA_ARGS__))
> > --
> > 2.39.5
>
> The changes look good to me.
>
> Acked-by: Zi Yan <ziy@nvidia.com>
LGTM. _noprof() functions don't need to be macros.
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
>
> --
> Best Regards,
> Yan, Zi
prev parent reply other threads:[~2026-02-16 19:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-16 12:17 Arnd Bergmann
2026-02-16 15:08 ` Lorenzo Stoakes
2026-02-16 16:58 ` Zi Yan
2026-02-16 19:24 ` Suren Baghdasaryan [this message]
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='CAJuCfpE=79uHrqKn4vmQ09TuR1uZBxpDck9WXXoG6OK6a0pZ=A@mail.gmail.com' \
--to=surenb@google.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=ast@kernel.org \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=jackmanb@google.com \
--cc=joshua.hahnjy@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=shakeel.butt@linux.dev \
--cc=vbabka@suse.cz \
--cc=wangkefeng.wang@huawei.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