Skip to contentSkip to conversation

mm: slub: Fix compilation without CONFIG_SLUB_DEBUG

PATCH In review Bert Karwatzki 2 participants 2 messages Apr 23, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: slub: Fix compilation without CONFIG_SLUB_DEBUG

Since the introduction of count_partial_free_approx the compilation of linux fails with an implicit declaration of function ‘node_nr_objs’ because count_partial_free_approx is compiled when SLAB_SUPPORTS_SYSFS is defined even without CONFIG_SLUB_DEBUG. As count_partial_free_approx is only used when CONFIG_SLUB_DEBUG is defined it should only be compiled in that case.

Fixes commit 1c5610f451be ("slub: introduce count_partial_free_approx()")
---
 mm/slub.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
mm/slub.c +3 -4
index a3b6f05be2b9..a547ed041bc7 100644
@@ -3226,6 +3226,7 @@ static inline int node_match(struct slab *slab, int node)
 }
 
 #ifdef CONFIG_SLUB_DEBUG
+#define MAX_PARTIAL_TO_SCAN 10000
 static int count_free(struct slab *slab)
 {
 	return slab->objects - slab->inuse;
@@ -3293,10 +3294,6 @@ static inline bool free_debug_processing(struct kmem_cache *s,
 
 	return checks_ok;
 }
-#endif /* CONFIG_SLUB_DEBUG */
-
-#if defined(CONFIG_SLUB_DEBUG) || defined(SLAB_SUPPORTS_SYSFS)
-#define MAX_PARTIAL_TO_SCAN 10000
 
 static unsigned long count_partial_free_approx(struct kmem_cache_node *n)
 {
@@ -3332,7 +3329,9 @@ static unsigned long count_partial_free_approx(struct kmem_cache_node *n)
 	spin_unlock_irqrestore(&n->list_lock, flags);
 	return x;
 }
+#endif /* CONFIG_SLUB_DEBUG */
 
+#if defined(CONFIG_SLUB_DEBUG) || defined(SLAB_SUPPORTS_SYSFS)
 static unsigned long count_partial(struct kmem_cache_node *n,
 					int (*get_count)(struct slab *))
 {

--
2.43.0

#1 lore raw

Re: [External] : [PATCH] mm: slub: Fix compilation without CONFIG_SLUB_DEBUG

Quoted 7 lines · Bert Karwatzki

Since the introduction of count_partial_free_approx the compilation of linux fails with an implicit declaration of function ‘node_nr_objs’ because count_partial_free_approx is compiled when SLAB_SUPPORTS_SYSFS is defined even without CONFIG_SLUB_DEBUG. As count_partial_free_approx is only used when CONFIG_SLUB_DEBUG is defined it should only be compiled in that case.

Hi Bert,

Thanks for noticing this.
The original patch was updated to fix it and was sent to the MM maillist. It has been applied several hours ago.

Quoted 42 lines
Fixes commit 1c5610f451be ("slub: introduce count_partial_free_approx()")
---
 mm/slub.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
mm/slub.c +3 -5
index a3b6f05be2b9..a547ed041bc7 100644
@@ -3226,6 +3226,7 @@ static inline int node_match(struct slab *slab, int node)
 }
 
 #ifdef CONFIG_SLUB_DEBUG
+#define MAX_PARTIAL_TO_SCAN 10000
 static int count_free(struct slab *slab)
 {
 	return slab->objects - slab->inuse;
@@ -3293,10 +3294,6 @@ static inline bool free_debug_processing(struct kmem_cache *s,
 
 	return checks_ok;
 }
-#endif /* CONFIG_SLUB_DEBUG */
-
-#if defined(CONFIG_SLUB_DEBUG) || defined(SLAB_SUPPORTS_SYSFS)
-#define MAX_PARTIAL_TO_SCAN 10000
 
 static unsigned long count_partial_free_approx(struct kmem_cache_node *n)
 {
@@ -3332,7 +3329,9 @@ static unsigned long count_partial_free_approx(struct kmem_cache_node *n)
 	spin_unlock_irqrestore(&n->list_lock, flags);
 	return x;
 }
+#endif /* CONFIG_SLUB_DEBUG */
 
+#if defined(CONFIG_SLUB_DEBUG) || defined(SLAB_SUPPORTS_SYSFS)
 static unsigned long count_partial(struct kmem_cache_node *n,
 					int (*get_count)(struct slab *))
 {
--

2.43.0