linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: slub: Place count_partial() outside CONFIG_SLUB_DEBUG if block
@ 2014-05-12 12:36 Fabio Estevam
  2014-05-12 20:35 ` David Rientjes
  0 siblings, 1 reply; 2+ messages in thread
From: Fabio Estevam @ 2014-05-12 12:36 UTC (permalink / raw)
  To: akpm
  Cc: linux-mm, festevam, Fabio Estevam, Christoph Lameter,
	David Rientjes, Pekka Enberg

Commit f7f15520731 (mm-slab-suppress-out-of-memory-warning-unless-debug-is-enabled-fix)
caused the following build error when CONFIG_SLUB_DEBUG=n:

mm/slub.c:4361:5: error: implicit declaration of function 'count_partial' [-Werror=implicit-function-declaration

Place count_partial() outside CONFIG_SLUB_DEBUG if block, as it is also used
when CONFIG_SLUB_DEBUG=n.

Cc: Christoph Lameter <cl@linux.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 mm/slub.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index 4d5002f..0a642a4 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2127,12 +2127,6 @@ 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 unsigned long count_partial(struct kmem_cache_node *n,
 					int (*get_count)(struct page *))
 {
@@ -2147,6 +2141,12 @@ static unsigned long count_partial(struct kmem_cache_node *n,
 	return x;
 }
 
+#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);
-- 
1.8.3.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] mm: slub: Place count_partial() outside CONFIG_SLUB_DEBUG if block
  2014-05-12 12:36 [PATCH] mm: slub: Place count_partial() outside CONFIG_SLUB_DEBUG if block Fabio Estevam
@ 2014-05-12 20:35 ` David Rientjes
  0 siblings, 0 replies; 2+ messages in thread
From: David Rientjes @ 2014-05-12 20:35 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Andrew Morton, linux-mm, festevam, Christoph Lameter,
	Pekka Enberg

On Mon, 12 May 2014, Fabio Estevam wrote:

> diff --git a/mm/slub.c b/mm/slub.c
> index 4d5002f..0a642a4 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -2127,12 +2127,6 @@ 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 unsigned long count_partial(struct kmem_cache_node *n,
>  					int (*get_count)(struct page *))

This is wrong, gcc will now complain that count_partial() is unused if 
CONFIG_SYSFS is disabled.

>  {
> @@ -2147,6 +2141,12 @@ static unsigned long count_partial(struct kmem_cache_node *n,
>  	return x;
>  }
>  
> +#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);

node_nr_objs() need only be defined when CONFIG_SLUB_DEBUG, there's no 
need for an #else variant that simply returns 0.  (CONFIG_SLABINFO 
requires CONFIG_SLUB_DEBUG.)

Please see http://marc.info/?l=linux-mm-commits&m=139992385527040 that has 
been merged into -mm which is the correct fix.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2014-05-12 20:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-12 12:36 [PATCH] mm: slub: Place count_partial() outside CONFIG_SLUB_DEBUG if block Fabio Estevam
2014-05-12 20:35 ` David Rientjes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).