]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm-slab-suppress-out-of-memory-warning-unless-debug-is-enabled-fix-2
authorDavid Rientjes <rientjes@google.com>
Thu, 22 May 2014 00:42:36 +0000 (10:42 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 22 May 2014 00:42:36 +0000 (10:42 +1000)
Only define count_free() when CONFIG_SLUB_DEBUG since that's the only
context in which it is referenced.  Only define count_partial() when
CONFIG_SLUB_DEBUG or CONFIG_SYSFS since the sysfs interface still uses it
for partial slab counts.

Also only define node_nr_objs() when CONFIG_SLUB_DEBUG since that's the
only context in which it is referenced.

Signed-off-by: David Rientjes <rientjes@google.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/slub.c

index 269d049108e3e7454cacd571428decd6d2a57cd9..65a0a5c57f313dbfc0abc5c56069593f93313ac7 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2119,11 +2119,19 @@ static inline int node_match(struct page *page, int node)
        return 1;
 }
 
+#ifdef CONFIG_SLUB_DEBUG
 static int count_free(struct page *page)
 {
        return page->objects - page->inuse;
 }
 
+static inline unsigned long node_nr_objs(struct kmem_cache_node *n)
+{
+       return atomic_long_read(&n->total_objects);
+}
+#endif /* CONFIG_SLUB_DEBUG */
+
+#if defined(CONFIG_SLUB_DEBUG) || defined(CONFIG_SYSFS)
 static unsigned long count_partial(struct kmem_cache_node *n,
                                        int (*get_count)(struct page *))
 {
@@ -2137,15 +2145,7 @@ static unsigned long count_partial(struct kmem_cache_node *n,
        spin_unlock_irqrestore(&n->list_lock, flags);
        return x;
 }
-
-static inline unsigned long node_nr_objs(struct kmem_cache_node *n)
-{
-#ifdef CONFIG_SLUB_DEBUG
-       return atomic_long_read(&n->total_objects);
-#else
-       return 0;
-#endif
-}
+#endif /* CONFIG_SLUB_DEBUG || CONFIG_SYSFS */
 
 static noinline void
 slab_out_of_memory(struct kmem_cache *s, gfp_t gfpflags, int nid)