linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	kbuild test robot <fengguang.wu@intel.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
	Linux Memory Management List <linux-mm@kvack.org>,
	kbuild-all@01.org
Subject: Re: [mmotm:master 58/459] mm/slub.c:4356:5: error: implicit declaration of function 'count_partial'
Date: Sat, 10 May 2014 16:48:44 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.02.1405101623220.5545@chino.kir.corp.google.com> (raw)
In-Reply-To: <536d7abc.eM6MEPh4YAKjplYf%fengguang.wu@intel.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 3775 bytes --]

On Sat, 10 May 2014, kbuild test robot wrote:

> tree:   git://git.cmpxchg.org/linux-mmotm.git master
> head:   9567896580328249f6519fda78cf9fe185a8486d
> commit: 6301f243bb76ad3d8e7b742ca8cfc74e5c63b0be [58/459] mm-slab-suppress-out-of-memory-warning-unless-debug-is-enabled-fix
> config: x86_64-randconfig-c2-0510 (attached as .config)
> 
> All error/warnings:
> 
>    mm/slub.c: In function 'show_slab_objects':
> >> mm/slub.c:4356:5: error: implicit declaration of function 'count_partial' [-Werror=implicit-function-declaration]
>         x = count_partial(n, count_total);
>         ^
>    cc1: some warnings being treated as errors
> 
> vim +/count_partial +4356 mm/slub.c
> 
> ab4d5ed5 Christoph Lameter 2010-10-05  4350  #endif
> ab4d5ed5 Christoph Lameter 2010-10-05  4351  	if (flags & SO_PARTIAL) {
> 205ab99d Christoph Lameter 2008-04-14  4352  		for_each_node_state(node, N_NORMAL_MEMORY) {
> 205ab99d Christoph Lameter 2008-04-14  4353  			struct kmem_cache_node *n = get_node(s, node);
> 81819f0f Christoph Lameter 2007-05-06  4354  
> 205ab99d Christoph Lameter 2008-04-14  4355  			if (flags & SO_TOTAL)
> 205ab99d Christoph Lameter 2008-04-14 @4356  				x = count_partial(n, count_total);
> 205ab99d Christoph Lameter 2008-04-14  4357  			else if (flags & SO_OBJECTS)
> 205ab99d Christoph Lameter 2008-04-14  4358  				x = count_partial(n, count_inuse);
> 81819f0f Christoph Lameter 2007-05-06  4359  			else
> 

Hmm, I'm not sure that 
mm-slab-suppress-out-of-memory-warning-unless-debug-is-enabled-fix.patch 
is the correct fix.  The changelog indicates that CONFIG_SLUB=n, but then 
we're building mm/slub.o?

With my original patch, 
mm-slab-suppress-out-of-memory-warning-unless-debug-is-enabled.patch, I 
get a

	mm/slub.c:2130:12: warning: a??count_freea?? defined but not used [-Wunused-function]

but I can't reproduce the reported

	mm/slub.c:2122: warning: 'count_free' defined but not used

without CONFIG_SLABINFO=n.

I think 
mm-slab-suppress-out-of-memory-warning-unless-debug-is-enabled-fix.patch 
should be withdrawn and we should just do the following.



mm, slab: suppress out of memory warning unless debug is enabled fix

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.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: David Rientjes <rientjes@google.com>
---
 mm/slub.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2127,11 +2127,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 *))
 {
@@ -2145,15 +2153,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)

      reply	other threads:[~2014-05-10 23:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-10  1:02 kbuild test robot
2014-05-10 23:48 ` David Rientjes [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.02.1405101623220.5545@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=fengguang.wu@intel.com \
    --cc=hannes@cmpxchg.org \
    --cc=kbuild-all@01.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox