llvm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/1] mm/hmm: Move pmd_to_hmm_pfn_flags() to the respective #ifdeffery
@ 2025-07-10  8:23 Andy Shevchenko
  2025-07-10 10:11 ` Leon Romanovsky
  2025-07-10 23:35 ` Alistair Popple
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Shevchenko @ 2025-07-10  8:23 UTC (permalink / raw)
  To: Leon Romanovsky, linux-mm, linux-kernel, llvm
  Cc: Jérôme Glisse, Andrew Morton, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Andy Shevchenko

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")

Fixes: 9d3973d60f0a ("mm/hmm: cleanup the hmm_vma_handle_pmd stub")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---

v2: fixed Subject prefix

 mm/hmm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/hmm.c b/mm/hmm.c
index e8b26aa838b9..015ab243f081 100644
--- a/mm/hmm.c
+++ b/mm/hmm.c
@@ -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)
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/1] mm/hmm: Move pmd_to_hmm_pfn_flags() to the respective #ifdeffery
  2025-07-10  8:23 [PATCH v2 1/1] mm/hmm: Move pmd_to_hmm_pfn_flags() to the respective #ifdeffery Andy Shevchenko
@ 2025-07-10 10:11 ` Leon Romanovsky
  2025-07-10 23:35 ` Alistair Popple
  1 sibling, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2025-07-10 10:11 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-mm, linux-kernel, llvm, Jérôme Glisse,
	Andrew Morton, Nathan Chancellor, Nick Desaulniers, Bill Wendling,
	Justin Stitt

On Thu, Jul 10, 2025 at 11:23:53AM +0300, Andy Shevchenko wrote:
> 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")
> 
> Fixes: 9d3973d60f0a ("mm/hmm: cleanup the hmm_vma_handle_pmd stub")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/1] mm/hmm: Move pmd_to_hmm_pfn_flags() to the respective #ifdeffery
  2025-07-10  8:23 [PATCH v2 1/1] mm/hmm: Move pmd_to_hmm_pfn_flags() to the respective #ifdeffery Andy Shevchenko
  2025-07-10 10:11 ` Leon Romanovsky
@ 2025-07-10 23:35 ` Alistair Popple
  2025-07-11  5:34   ` Andy Shevchenko
  1 sibling, 1 reply; 4+ messages in thread
From: Alistair Popple @ 2025-07-10 23:35 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Leon Romanovsky, linux-mm, linux-kernel, llvm,
	Jérôme Glisse, Andrew Morton, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt

Shouldn't the Fixes tag be for the commit that introduced the #ifdeffery in the
first place? Ie: 992de9a8b751 ("mm/hmm: allow to mirror vma of a file on a DAX
backed filesystem")

As far as I can tell that is what would have introduced the warning. Other than
that it looks good though so feel free to add:

Reviewed-by: Alistair Popple <apopple@nvidia.com>

On Thu, Jul 10, 2025 at 11:23:53AM +0300, Andy Shevchenko wrote:
> 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")
> 
> Fixes: 9d3973d60f0a ("mm/hmm: cleanup the hmm_vma_handle_pmd stub")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> 
> v2: fixed Subject prefix
> 
>  mm/hmm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/hmm.c b/mm/hmm.c
> index e8b26aa838b9..015ab243f081 100644
> --- a/mm/hmm.c
> +++ b/mm/hmm.c
> @@ -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)
> -- 
> 2.47.2
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/1] mm/hmm: Move pmd_to_hmm_pfn_flags() to the respective #ifdeffery
  2025-07-10 23:35 ` Alistair Popple
@ 2025-07-11  5:34   ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2025-07-11  5:34 UTC (permalink / raw)
  To: Alistair Popple
  Cc: Leon Romanovsky, linux-mm, linux-kernel, llvm,
	Jérôme Glisse, Andrew Morton, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt

On Fri, Jul 11, 2025 at 09:35:49AM +1000, Alistair Popple wrote:
> Shouldn't the Fixes tag be for the commit that introduced the #ifdeffery in the
> first place? Ie: 992de9a8b751 ("mm/hmm: allow to mirror vma of a file on a DAX
> backed filesystem")

Looks indeed better, I was lost in the maze of the history of mm/hmm.c changes.

Fixes: 992de9a8b751 ("mm/hmm: allow to mirror vma of a file on a DAX backed filesystem")

The problem is that backporting to that, if needed, requires a bit of adaptation.
Nevertheless, I added it above, and we actually can have two Fixes tags to make
backporting easier for those (we don't have LTS kernels older that the second
commit anyway),

Andrew, can you add the above tag as well?

> As far as I can tell that is what would have introduced the warning. Other than
> that it looks good though so feel free to add:
> 
> Reviewed-by: Alistair Popple <apopple@nvidia.com>

Thank you for the review!

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-07-11  5:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-10  8:23 [PATCH v2 1/1] mm/hmm: Move pmd_to_hmm_pfn_flags() to the respective #ifdeffery Andy Shevchenko
2025-07-10 10:11 ` Leon Romanovsky
2025-07-10 23:35 ` Alistair Popple
2025-07-11  5:34   ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).