linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] maple_tree: Mark three functions as __maybe_unused
@ 2024-09-07  2:15 Liam R. Howlett
  2024-09-07 18:31 ` Lorenzo Stoakes
  0 siblings, 1 reply; 3+ messages in thread
From: Liam R. Howlett @ 2024-09-07  2:15 UTC (permalink / raw)
  To: Andrew Morton; +Cc: maple-tree, linux-mm, linux-kernel, Liam R. Howlett

People keep trying to remove three functions that are going to be used
in a feature that is being developed.  Dropping the functions entirely
may end up with people trying to use the bit for other uses, as people
have tried in the past.

Adding __maybe_unused stops compilers complaining about the unused
functions so they can be silently optimised out of the compiled code and
people won't try to claim the bit for another use.

Link: https://lore.kernel.org/all/20230726080916.17454-2-zhangpeng.00@bytedance.com/
Link: https://lore.kernel.org/all/202408310728.S7EE59BN-lkp@intel.com/
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
---
 lib/maple_tree.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 4f34e50c92b5..20990ecba2dd 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -348,17 +348,17 @@ static inline void *mte_safe_root(const struct maple_enode *node)
 	return (void *)((unsigned long)node & ~MAPLE_ROOT_NODE);
 }
 
-static inline void *mte_set_full(const struct maple_enode *node)
+static inline void __maybe_unused *mte_set_full(const struct maple_enode *node)
 {
 	return (void *)((unsigned long)node & ~MAPLE_ENODE_NULL);
 }
 
-static inline void *mte_clear_full(const struct maple_enode *node)
+static inline void __maybe_unused *mte_clear_full(const struct maple_enode *node)
 {
 	return (void *)((unsigned long)node | MAPLE_ENODE_NULL);
 }
 
-static inline bool mte_has_null(const struct maple_enode *node)
+static inline bool __maybe_unused mte_has_null(const struct maple_enode *node)
 {
 	return (unsigned long)node & MAPLE_ENODE_NULL;
 }
-- 
2.43.0



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

* Re: [PATCH] maple_tree: Mark three functions as __maybe_unused
  2024-09-07  2:15 [PATCH] maple_tree: Mark three functions as __maybe_unused Liam R. Howlett
@ 2024-09-07 18:31 ` Lorenzo Stoakes
  2024-09-07 19:16   ` Kuan-Wei Chiu
  0 siblings, 1 reply; 3+ messages in thread
From: Lorenzo Stoakes @ 2024-09-07 18:31 UTC (permalink / raw)
  To: Liam R. Howlett; +Cc: Andrew Morton, maple-tree, linux-mm, linux-kernel

On Fri, Sep 06, 2024 at 10:15:06PM GMT, Liam R. Howlett wrote:
> People keep trying to remove three functions that are going to be used
> in a feature that is being developed.  Dropping the functions entirely
> may end up with people trying to use the bit for other uses, as people
> have tried in the past.
>
> Adding __maybe_unused stops compilers complaining about the unused
> functions so they can be silently optimised out of the compiled code and
> people won't try to claim the bit for another use.
>
> Link: https://lore.kernel.org/all/20230726080916.17454-2-zhangpeng.00@bytedance.com/
> Link: https://lore.kernel.org/all/202408310728.S7EE59BN-lkp@intel.com/
> Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>

Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>

> ---
>  lib/maple_tree.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index 4f34e50c92b5..20990ecba2dd 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -348,17 +348,17 @@ static inline void *mte_safe_root(const struct maple_enode *node)
>  	return (void *)((unsigned long)node & ~MAPLE_ROOT_NODE);
>  }
>
> -static inline void *mte_set_full(const struct maple_enode *node)
> +static inline void __maybe_unused *mte_set_full(const struct maple_enode *node)
>  {
>  	return (void *)((unsigned long)node & ~MAPLE_ENODE_NULL);
>  }
>
> -static inline void *mte_clear_full(const struct maple_enode *node)
> +static inline void __maybe_unused *mte_clear_full(const struct maple_enode *node)
>  {
>  	return (void *)((unsigned long)node | MAPLE_ENODE_NULL);
>  }
>
> -static inline bool mte_has_null(const struct maple_enode *node)
> +static inline bool __maybe_unused mte_has_null(const struct maple_enode *node)
>  {
>  	return (unsigned long)node & MAPLE_ENODE_NULL;
>  }
> --
> 2.43.0
>


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

* Re: [PATCH] maple_tree: Mark three functions as __maybe_unused
  2024-09-07 18:31 ` Lorenzo Stoakes
@ 2024-09-07 19:16   ` Kuan-Wei Chiu
  0 siblings, 0 replies; 3+ messages in thread
From: Kuan-Wei Chiu @ 2024-09-07 19:16 UTC (permalink / raw)
  To: Lorenzo Stoakes
  Cc: Liam R. Howlett, Andrew Morton, maple-tree, linux-mm, linux-kernel

On Sat, Sep 07, 2024 at 07:31:14PM +0100, Lorenzo Stoakes wrote:
> On Fri, Sep 06, 2024 at 10:15:06PM GMT, Liam R. Howlett wrote:
> > People keep trying to remove three functions that are going to be used
> > in a feature that is being developed.  Dropping the functions entirely
> > may end up with people trying to use the bit for other uses, as people
> > have tried in the past.
> >
> > Adding __maybe_unused stops compilers complaining about the unused
> > functions so they can be silently optimised out of the compiled code and
> > people won't try to claim the bit for another use.
> >
> > Link: https://lore.kernel.org/all/20230726080916.17454-2-zhangpeng.00@bytedance.com/
> > Link: https://lore.kernel.org/all/202408310728.S7EE59BN-lkp@intel.com/
> > Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
> 
> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>

Thank you for solving the compilation warning!

Reviewed-by: Kuan-Wei Chiu <visitorckw@gmail.com>

Regards,
Kuan-Wei
> 
> > ---
> >  lib/maple_tree.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> > index 4f34e50c92b5..20990ecba2dd 100644
> > --- a/lib/maple_tree.c
> > +++ b/lib/maple_tree.c
> > @@ -348,17 +348,17 @@ static inline void *mte_safe_root(const struct maple_enode *node)
> >  	return (void *)((unsigned long)node & ~MAPLE_ROOT_NODE);
> >  }
> >
> > -static inline void *mte_set_full(const struct maple_enode *node)
> > +static inline void __maybe_unused *mte_set_full(const struct maple_enode *node)
> >  {
> >  	return (void *)((unsigned long)node & ~MAPLE_ENODE_NULL);
> >  }
> >
> > -static inline void *mte_clear_full(const struct maple_enode *node)
> > +static inline void __maybe_unused *mte_clear_full(const struct maple_enode *node)
> >  {
> >  	return (void *)((unsigned long)node | MAPLE_ENODE_NULL);
> >  }
> >
> > -static inline bool mte_has_null(const struct maple_enode *node)
> > +static inline bool __maybe_unused mte_has_null(const struct maple_enode *node)
> >  {
> >  	return (unsigned long)node & MAPLE_ENODE_NULL;
> >  }
> > --
> > 2.43.0
> >
> 


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

end of thread, other threads:[~2024-09-07 19:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-07  2:15 [PATCH] maple_tree: Mark three functions as __maybe_unused Liam R. Howlett
2024-09-07 18:31 ` Lorenzo Stoakes
2024-09-07 19:16   ` Kuan-Wei Chiu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox