public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFA][PATCH] trace/mm: Remove kmem.h from slab_def.h
@ 2011-07-14  3:31 Steven Rostedt
  2011-07-19 11:59 ` Pekka Enberg
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2011-07-14  3:31 UTC (permalink / raw)
  To: LKML
  Cc: Li Zefan, Pekka Enberg, Eduard - Gabriel Munteanu, Ingo Molnar,
	Frederic Weisbecker, Thomas Gleixner, Andrew Morton

[ RFA - Request for Acks ]

Having event headers in other headers can cause the necessary macro
magic to break. For example, if we have in some C file:

#define CREATE_TRACE_POINTS
#include <trace/events/foo.h>

But then in trace/events/foo.h, for some reason it needs to include
linux/slab.h. Which includes linux/slab_def.h which happens to include
the trace/events/kmem.h, and causes the TRACE_EVENT() macros in that
file to be processed, then all hell breaks loose.

To avoid this problem, it is better to just include trace/events/kmem.h
in the C files that need it. It is already included in most of them,
only mm/slab.c also needed to include it.

I tested this with ktest running 10 randconfigs each with SLAB, SLUB,
and SLOB enabled (for a total of 30 randconfig builds). With 30
successful builds, this change should not be an issue. SLUB and SLOB
have it already done.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index 83203ae..d12c70a 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -15,8 +15,6 @@
 #include <asm/cache.h>		/* kmalloc_sizes.h needs L1_CACHE_BYTES */
 #include <linux/compiler.h>
 
-#include <trace/events/kmem.h>
-
 /*
  * Enforce a minimum alignment for the kmalloc caches.
  * Usually, the kmalloc caches are cache_line_size() aligned, except when
diff --git a/mm/slab.c b/mm/slab.c
index d96e223..e4bd1ec 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -121,6 +121,8 @@
 #include	<asm/tlbflush.h>
 #include	<asm/page.h>
 
+#include	<trace/events/kmem.h>
+
 /*
  * DEBUG	- 1 for kmem_cache_create() to honour; SLAB_RED_ZONE & SLAB_POISON.
  *		  0 for faster, smaller code (especially in the critical paths).



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

* Re: [RFA][PATCH] trace/mm: Remove kmem.h from slab_def.h
  2011-07-14  3:31 [RFA][PATCH] trace/mm: Remove kmem.h from slab_def.h Steven Rostedt
@ 2011-07-19 11:59 ` Pekka Enberg
  0 siblings, 0 replies; 2+ messages in thread
From: Pekka Enberg @ 2011-07-19 11:59 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: LKML, Li Zefan, Eduard - Gabriel Munteanu, Ingo Molnar,
	Frederic Weisbecker, Thomas Gleixner, Andrew Morton, cl

On Wed, 2011-07-13 at 23:31 -0400, Steven Rostedt wrote:
> [ RFA - Request for Acks ]
> 
> Having event headers in other headers can cause the necessary macro
> magic to break. For example, if we have in some C file:
> 
> #define CREATE_TRACE_POINTS
> #include <trace/events/foo.h>
> 
> But then in trace/events/foo.h, for some reason it needs to include
> linux/slab.h. Which includes linux/slab_def.h which happens to include
> the trace/events/kmem.h, and causes the TRACE_EVENT() macros in that
> file to be processed, then all hell breaks loose.
> 
> To avoid this problem, it is better to just include trace/events/kmem.h
> in the C files that need it. It is already included in most of them,
> only mm/slab.c also needed to include it.
> 
> I tested this with ktest running 10 randconfigs each with SLAB, SLUB,
> and SLOB enabled (for a total of 30 randconfig builds). With 30
> successful builds, this change should not be an issue. SLUB and SLOB
> have it already done.
> 
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

Acked-by: Pekka Enberg <penberg@kernel.org>

> diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
> index 83203ae..d12c70a 100644
> --- a/include/linux/slab_def.h
> +++ b/include/linux/slab_def.h
> @@ -15,8 +15,6 @@
>  #include <asm/cache.h>		/* kmalloc_sizes.h needs L1_CACHE_BYTES */
>  #include <linux/compiler.h>
>  
> -#include <trace/events/kmem.h>
> -
>  /*
>   * Enforce a minimum alignment for the kmalloc caches.
>   * Usually, the kmalloc caches are cache_line_size() aligned, except when
> diff --git a/mm/slab.c b/mm/slab.c
> index d96e223..e4bd1ec 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -121,6 +121,8 @@
>  #include	<asm/tlbflush.h>
>  #include	<asm/page.h>
>  
> +#include	<trace/events/kmem.h>
> +
>  /*
>   * DEBUG	- 1 for kmem_cache_create() to honour; SLAB_RED_ZONE & SLAB_POISON.
>   *		  0 for faster, smaller code (especially in the critical paths).
> 
> 



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

end of thread, other threads:[~2011-07-19 11:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-14  3:31 [RFA][PATCH] trace/mm: Remove kmem.h from slab_def.h Steven Rostedt
2011-07-19 11:59 ` Pekka Enberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox