diff mbox series

mm/slub: fix -Wunused-function compiler warnings

Message ID 1568752232-5094-1-git-send-email-cai@lca.pw (mailing list archive)
State New, archived
Headers show
Series mm/slub: fix -Wunused-function compiler warnings | expand

Commit Message

Qian Cai Sept. 17, 2019, 8:30 p.m. UTC
tid_to_cpu() and tid_to_event() are only used in note_cmpxchg_failure()
when SLUB_DEBUG_CMPXCHG=y, so when SLUB_DEBUG_CMPXCHG=n by default,
Clang will complain that those unused functions.

Signed-off-by: Qian Cai <cai@lca.pw>
---
 mm/slub.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

David Rientjes Sept. 17, 2019, 9:23 p.m. UTC | #1
On Tue, 17 Sep 2019, Qian Cai wrote:

> tid_to_cpu() and tid_to_event() are only used in note_cmpxchg_failure()
> when SLUB_DEBUG_CMPXCHG=y, so when SLUB_DEBUG_CMPXCHG=n by default,
> Clang will complain that those unused functions.
> 
> Signed-off-by: Qian Cai <cai@lca.pw>

Acked-by: David Rientjes <rientjes@google.com>
Christoph Lameter (Ampere) Sept. 17, 2019, 10:35 p.m. UTC | #2
On Tue, 17 Sep 2019, David Rientjes wrote:

> On Tue, 17 Sep 2019, Qian Cai wrote:
>
> > tid_to_cpu() and tid_to_event() are only used in note_cmpxchg_failure()
> > when SLUB_DEBUG_CMPXCHG=y, so when SLUB_DEBUG_CMPXCHG=n by default,
> > Clang will complain that those unused functions.
> >
> > Signed-off-by: Qian Cai <cai@lca.pw>
>
> Acked-by: David Rientjes <rientjes@google.com>

Ditto
Christoph Lameter (Ampere) Sept. 17, 2019, 11:37 p.m. UTC | #3
On Tue, 17 Sep 2019, David Rientjes wrote:

> Acked-by: David Rientjes <rientjes@google.com>

Ditto
diff mbox series

Patch

diff --git a/mm/slub.c b/mm/slub.c
index 8834563cdb4b..49739f005b4f 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2004,6 +2004,7 @@  static inline unsigned long next_tid(unsigned long tid)
 	return tid + TID_STEP;
 }
 
+#ifdef SLUB_DEBUG_CMPXCHG
 static inline unsigned int tid_to_cpu(unsigned long tid)
 {
 	return tid % TID_STEP;
@@ -2013,6 +2014,7 @@  static inline unsigned long tid_to_event(unsigned long tid)
 {
 	return tid / TID_STEP;
 }
+#endif
 
 static inline unsigned int init_tid(int cpu)
 {