locking/lockdep: Move pmd_to_hmm_pfn_flags() to the respective #ifdeffery
Subsystems (2)
PATCH 1/1 locking/lockdep: Move pmd_to_hmm_pfn_flags() to the respective #ifdeffery
When pmd_to_hmm_pfn_flags() is unused, it prevents kernel builds with clang, make W=1 and CONFIG_TRANSPARENT_HUGEPAGE=n:
mm/hmm.c:186:29: warning: unused function 'pmd_to_hmm_pfn_flags' [-Wunused-function]
Fix this by moving the function to the respective existing ifdeffery for its the only user.
See also:
6863f5643dd7 ("kbuild: allow Clang to find unused static inline functions for W=1 build")
--- mm/hmm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/hmm.c +1 -1
@@ -183,6 +183,7 @@ static inline unsigned long hmm_pfn_flags_order(unsigned long order)return order <<HMM_PFN_ORDER_SHIFT ; } +#ifdef CONFIG_TRANSPARENT_HUGEPAGE static inline unsigned long pmd_to_hmm_pfn_flags (struct hmm_range *range,pmd_t pmd) {
@@ -193,7 +194,6 @@ static inline unsigned long pmd_to_hmm_pfn_flags(struct hmm_range *range,hmm_pfn_flags_order (PMD_SHIFT -PAGE_SHIFT ); } -#ifdef CONFIG_TRANSPARENT_HUGEPAGE static int hmm_vma_handle_pmd (struct mm_walk *walk,unsigned long addr,unsigned long end,unsigned long hmm_pfns[],pmd_t pmd)
Signature · 1 line
2.47.2
Quoted 10 lines · Andy Shevchenko
When
pmd_to_hmm_pfn_flags()is unused, it prevents kernel builds with clang,make W=1andCONFIG_TRANSPARENT_HUGEPAGE=n:
mm/hmm.c:186:29: warning: unused function 'pmd_to_hmm_pfn_flags' [-Wunused-function]Fix this by moving the function to the respective existing ifdeffery for its the only user.
See also:
Quoted 7 lines
6863f5643dd7("kbuild: allow Clang to find unused static inline functions for W=1 build")Fixes 9d3973d60f0a ("mm/hmm: cleanup the hmm_vma_handle_pmd stub")Signed-off-by Andy Shevchenko <[email protected]>--- mm/hmm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Jason
Quoted 1 line · Jason Gunthorpe
On Thu, Jul 10, 2025 at 11:22:57AM +0300, Andy Shevchenko wrote:
...
Quoted 1 line
Reviewed-by Jason Gunthorpe <[email protected]>
Thank you! There was already a v2 with fixed Subject prefix.
Signature · 2 lines
With Best Regards, Andy Shevchenko