[PATCH] mm: change vma_alloc_folio_noprof() macro to inline function

From: Arnd Bergmann

Date: Mon Feb 16 2026 - 07:18:05 EST


From: Arnd Bergmann <arnd@xxxxxxxx>

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@xxxxxxxx>
---
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