Skip to content

Commit

Permalink
tracing, kmemtrace: Separate include/trace/kmemtrace.h to kmemtrace p…
Browse files Browse the repository at this point in the history
…art and tracepoint part

Impact: refactor code for future changes

Current kmemtrace.h is used both as header file of kmemtrace and kmem's
tracepoints definition.

Tracepoints' definition file may be used by other code, and should only have
definition of tracepoint.

We can separate include/trace/kmemtrace.h into 2 files:

  include/linux/kmemtrace.h: header file for kmemtrace
  include/trace/kmem.h:      definition of kmem tracepoints

Signed-off-by: Zhao Lei <[email protected]>
Acked-by: Eduard - Gabriel Munteanu <[email protected]>
Acked-by: Pekka Enberg <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Tom Zanussi <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
zhaoleidd authored and Ingo Molnar committed Apr 12, 2009
1 parent abd4144 commit 02af61b
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 30 deletions.
25 changes: 25 additions & 0 deletions include/linux/kmemtrace.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright (C) 2008 Eduard - Gabriel Munteanu
*
* This file is released under GPL version 2.
*/

#ifndef _LINUX_KMEMTRACE_H
#define _LINUX_KMEMTRACE_H

#ifdef __KERNEL__

#include <trace/kmem.h>

#ifdef CONFIG_KMEMTRACE
extern void kmemtrace_init(void);
#else
static inline void kmemtrace_init(void)
{
}
#endif

#endif /* __KERNEL__ */

#endif /* _LINUX_KMEMTRACE_H */

2 changes: 1 addition & 1 deletion include/linux/slab_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <asm/page.h> /* kmalloc_sizes.h needs PAGE_SIZE */
#include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */
#include <linux/compiler.h>
#include <trace/kmemtrace.h>
#include <linux/kmemtrace.h>

/* Size description struct for general caches. */
struct cache_sizes {
Expand Down
2 changes: 1 addition & 1 deletion include/linux/slub_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <linux/gfp.h>
#include <linux/workqueue.h>
#include <linux/kobject.h>
#include <trace/kmemtrace.h>
#include <linux/kmemtrace.h>

enum stat_item {
ALLOC_FASTPATH, /* Allocation from cpu slab */
Expand Down
25 changes: 3 additions & 22 deletions include/trace/kmemtrace.h → include/trace/kmem.h
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
/*
* Copyright (C) 2008 Eduard - Gabriel Munteanu
*
* This file is released under GPL version 2.
*/

#ifndef _LINUX_KMEMTRACE_H
#define _LINUX_KMEMTRACE_H

#ifdef __KERNEL__
#ifndef _TRACE_KMEM_H
#define _TRACE_KMEM_H

#include <linux/tracepoint.h>
#include <linux/types.h>

#ifdef CONFIG_KMEMTRACE
extern void kmemtrace_init(void);
#else
static inline void kmemtrace_init(void)
{
}
#endif

DECLARE_TRACE(kmalloc,
TP_PROTO(unsigned long call_site,
const void *ptr,
Expand Down Expand Up @@ -57,7 +41,4 @@ DECLARE_TRACE(kmem_cache_free,
TP_PROTO(unsigned long call_site, const void *ptr),
TP_ARGS(call_site, ptr));

#endif /* __KERNEL__ */

#endif /* _LINUX_KMEMTRACE_H */

#endif /* _TRACE_KMEM_H */
2 changes: 1 addition & 1 deletion init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@
#include <linux/idr.h>
#include <linux/ftrace.h>
#include <linux/async.h>
#include <linux/kmemtrace.h>
#include <trace/boot.h>

#include <asm/io.h>
#include <asm/bugs.h>
#include <asm/setup.h>
#include <asm/sections.h>
#include <asm/cacheflush.h>
#include <trace/kmemtrace.h>

#ifdef CONFIG_X86_LOCAL_APIC
#include <asm/smp.h>
Expand Down
2 changes: 1 addition & 1 deletion kernel/trace/kmemtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <linux/dcache.h>
#include <linux/fs.h>

#include <trace/kmemtrace.h>
#include <linux/kmemtrace.h>

#include "trace_output.h"
#include "trace.h"
Expand Down
2 changes: 1 addition & 1 deletion kernel/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <linux/mmiotrace.h>
#include <linux/ftrace.h>
#include <trace/boot.h>
#include <trace/kmemtrace.h>
#include <linux/kmemtrace.h>
#include <trace/power.h>

enum trace_type {
Expand Down
2 changes: 1 addition & 1 deletion mm/slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
#include <linux/cpu.h>
#include <linux/sysctl.h>
#include <linux/module.h>
#include <trace/kmemtrace.h>
#include <linux/kmemtrace.h>
#include <linux/rcupdate.h>
#include <linux/string.h>
#include <linux/uaccess.h>
Expand Down
2 changes: 1 addition & 1 deletion mm/slob.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
#include <linux/module.h>
#include <linux/rcupdate.h>
#include <linux/list.h>
#include <trace/kmemtrace.h>
#include <linux/kmemtrace.h>
#include <asm/atomic.h>

/*
Expand Down
2 changes: 1 addition & 1 deletion mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <trace/kmemtrace.h>
#include <linux/kmemtrace.h>
#include <linux/cpu.h>
#include <linux/cpuset.h>
#include <linux/mempolicy.h>
Expand Down

0 comments on commit 02af61b

Please sign in to comment.