* [PATCH] mm: change vma_alloc_folio_noprof() macro to inline function
@ 2026-02-16 12:17 Arnd Bergmann
2026-02-16 15:08 ` Lorenzo Stoakes
2026-02-16 16:58 ` Zi Yan
0 siblings, 2 replies; 4+ messages in thread
From: Arnd Bergmann @ 2026-02-16 12:17 UTC (permalink / raw)
To: Andrew Morton, David Hildenbrand, Vlastimil Babka
Cc: Arnd Bergmann, Lorenzo Stoakes, Liam R. Howlett, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Brendan Jackman,
Johannes Weiner, Zi Yan, Alexei Starovoitov, Shakeel Butt,
Kefeng Wang, Joshua Hahn, linux-mm, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
In a few rare configurations with extra warnings eanbled, the new
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)
| ~~~~~~~~~~~~~~^~~~
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
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] mm: change vma_alloc_folio_noprof() macro to inline function
2026-02-16 12:17 [PATCH] mm: change vma_alloc_folio_noprof() macro to inline function Arnd Bergmann
@ 2026-02-16 15:08 ` Lorenzo Stoakes
2026-02-16 16:58 ` Zi Yan
1 sibling, 0 replies; 4+ messages in thread
From: Lorenzo Stoakes @ 2026-02-16 15:08 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Andrew Morton, David Hildenbrand, Vlastimil Babka, Arnd Bergmann,
Liam R. Howlett, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Brendan Jackman, Johannes Weiner, Zi Yan, Alexei Starovoitov,
Shakeel Butt, Kefeng Wang, Joshua Hahn, linux-mm, linux-kernel
On Mon, Feb 16, 2026 at 01:17:44PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> In a few rare configurations with extra warnings eanbled, the new
> 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)
> | ~~~~~~~~~~~~~~^~~~
>
> 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>
It'd be good if we could find a way to avoid these horrible _noprof things, but
I guess that ship's sailed for now...
Anyway, LGTM, so:
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
> 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
>
Cheers, Lorenzo
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] mm: change vma_alloc_folio_noprof() macro to inline function
2026-02-16 12:17 [PATCH] mm: change vma_alloc_folio_noprof() macro to inline function Arnd Bergmann
2026-02-16 15:08 ` Lorenzo Stoakes
@ 2026-02-16 16:58 ` Zi Yan
2026-02-16 19:24 ` Suren Baghdasaryan
1 sibling, 1 reply; 4+ messages in thread
From: Zi Yan @ 2026-02-16 16:58 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Andrew Morton, David Hildenbrand, Vlastimil Babka, Arnd Bergmann,
Lorenzo Stoakes, Liam R. Howlett, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Brendan Jackman,
Johannes Weiner, Alexei Starovoitov, Shakeel Butt, Kefeng Wang,
Joshua Hahn, linux-mm, linux-kernel
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>
--
Best Regards,
Yan, Zi
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] mm: change vma_alloc_folio_noprof() macro to inline function
2026-02-16 16:58 ` Zi Yan
@ 2026-02-16 19:24 ` Suren Baghdasaryan
0 siblings, 0 replies; 4+ messages in thread
From: Suren Baghdasaryan @ 2026-02-16 19:24 UTC (permalink / raw)
To: Zi Yan
Cc: Arnd Bergmann, Andrew Morton, David Hildenbrand, Vlastimil Babka,
Arnd Bergmann, Lorenzo Stoakes, Liam R. Howlett, Mike Rapoport,
Michal Hocko, Brendan Jackman, Johannes Weiner,
Alexei Starovoitov, Shakeel Butt, Kefeng Wang, Joshua Hahn,
linux-mm, linux-kernel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-02-16 19:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-16 12:17 [PATCH] mm: change vma_alloc_folio_noprof() macro to inline function Arnd Bergmann
2026-02-16 15:08 ` Lorenzo Stoakes
2026-02-16 16:58 ` Zi Yan
2026-02-16 19:24 ` Suren Baghdasaryan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox