* [PATCH 1/2] tracing: Define kmem_cache_alloc_notrace ifdef CONFIG_TRACING
@ 2009-12-11 7:45 Li Zefan
2009-12-11 7:45 ` [PATCH 2/2] tracing: Fix no callsite ifndef CONFIG_KMEMTRACE Li Zefan
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Li Zefan @ 2009-12-11 7:45 UTC (permalink / raw)
To: Ingo Molnar
Cc: Pekka Enberg, Christoph Lameter, Steven Rostedt,
Frederic Weisbecker, linux-mm, LKML, Eduard - Gabriel Munteanu
Define kmem_trace_alloc_{,node}_notrace() if CONFIG_TRACING is
enabled, otherwise perf-kmem will show wrong stats ifndef
CONFIG_KMEM_TRACE, because a kmalloc() memory allocation may
be traced by both trace_kmalloc() and trace_kmem_cache_alloc().
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
include/linux/slab_def.h | 4 ++--
include/linux/slub_def.h | 4 ++--
mm/slab.c | 6 +++---
mm/slub.c | 4 ++--
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index 850d057..ca6b2b3 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -110,7 +110,7 @@ extern struct cache_sizes malloc_sizes[];
void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
void *__kmalloc(size_t size, gfp_t flags);
-#ifdef CONFIG_KMEMTRACE
+#ifdef CONFIG_TRACING
extern void *kmem_cache_alloc_notrace(struct kmem_cache *cachep, gfp_t flags);
extern size_t slab_buffer_size(struct kmem_cache *cachep);
#else
@@ -166,7 +166,7 @@ found:
extern void *__kmalloc_node(size_t size, gfp_t flags, int node);
extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
-#ifdef CONFIG_KMEMTRACE
+#ifdef CONFIG_TRACING
extern void *kmem_cache_alloc_node_notrace(struct kmem_cache *cachep,
gfp_t flags,
int nodeid);
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 5ad70a6..1e14beb 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -217,7 +217,7 @@ static __always_inline struct kmem_cache *kmalloc_slab(size_t size)
void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
void *__kmalloc(size_t size, gfp_t flags);
-#ifdef CONFIG_KMEMTRACE
+#ifdef CONFIG_TRACING
extern void *kmem_cache_alloc_notrace(struct kmem_cache *s, gfp_t gfpflags);
#else
static __always_inline void *
@@ -266,7 +266,7 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags)
void *__kmalloc_node(size_t size, gfp_t flags, int node);
void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
-#ifdef CONFIG_KMEMTRACE
+#ifdef CONFIG_TRACING
extern void *kmem_cache_alloc_node_notrace(struct kmem_cache *s,
gfp_t gfpflags,
int node);
diff --git a/mm/slab.c b/mm/slab.c
index 7dfa481..9733bb4 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -490,7 +490,7 @@ static void **dbg_userword(struct kmem_cache *cachep, void *objp)
#endif
-#ifdef CONFIG_KMEMTRACE
+#ifdef CONFIG_TRACING
size_t slab_buffer_size(struct kmem_cache *cachep)
{
return cachep->buffer_size;
@@ -3558,7 +3558,7 @@ void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags)
}
EXPORT_SYMBOL(kmem_cache_alloc);
-#ifdef CONFIG_KMEMTRACE
+#ifdef CONFIG_TRACING
void *kmem_cache_alloc_notrace(struct kmem_cache *cachep, gfp_t flags)
{
return __cache_alloc(cachep, flags, __builtin_return_address(0));
@@ -3621,7 +3621,7 @@ void *kmem_cache_alloc_node(struct kmem_cache *cachep, gfp_t flags, int nodeid)
}
EXPORT_SYMBOL(kmem_cache_alloc_node);
-#ifdef CONFIG_KMEMTRACE
+#ifdef CONFIG_TRACING
void *kmem_cache_alloc_node_notrace(struct kmem_cache *cachep,
gfp_t flags,
int nodeid)
diff --git a/mm/slub.c b/mm/slub.c
index 4996fc7..4a89c3d 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1754,7 +1754,7 @@ void *kmem_cache_alloc(struct kmem_cache *s, gfp_t gfpflags)
}
EXPORT_SYMBOL(kmem_cache_alloc);
-#ifdef CONFIG_KMEMTRACE
+#ifdef CONFIG_TRACING
void *kmem_cache_alloc_notrace(struct kmem_cache *s, gfp_t gfpflags)
{
return slab_alloc(s, gfpflags, -1, _RET_IP_);
@@ -1775,7 +1775,7 @@ void *kmem_cache_alloc_node(struct kmem_cache *s, gfp_t gfpflags, int node)
EXPORT_SYMBOL(kmem_cache_alloc_node);
#endif
-#ifdef CONFIG_KMEMTRACE
+#ifdef CONFIG_TRACING
void *kmem_cache_alloc_node_notrace(struct kmem_cache *s,
gfp_t gfpflags,
int node)
--
1.6.3
--
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] 8+ messages in thread* [PATCH 2/2] tracing: Fix no callsite ifndef CONFIG_KMEMTRACE
2009-12-11 7:45 [PATCH 1/2] tracing: Define kmem_cache_alloc_notrace ifdef CONFIG_TRACING Li Zefan
@ 2009-12-11 7:45 ` Li Zefan
2009-12-11 8:55 ` [tip:perf/urgent] tracing, slab: " tip-bot for Li Zefan
2009-12-11 7:56 ` [PATCH 1/2] tracing: Define kmem_cache_alloc_notrace ifdef CONFIG_TRACING Ingo Molnar
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Li Zefan @ 2009-12-11 7:45 UTC (permalink / raw)
To: Ingo Molnar
Cc: Pekka Enberg, Christoph Lameter, Steven Rostedt,
Frederic Weisbecker, linux-mm, LKML, Eduard - Gabriel Munteanu
For slab, if CONFIG_KMEMTRACE and CONFIG_DEBUG_SLAB are not set,
__do_kmalloc() will not track callers:
# ./perf record -f -a -R -e kmem:kmalloc
^C
# ./perf trace
...
perf-2204 [000] 147.376774: kmalloc: call_site=c0529d2d ...
perf-2204 [000] 147.400997: kmalloc: call_site=c0529d2d ...
Xorg-1461 [001] 147.405413: kmalloc: call_site=0 ...
Xorg-1461 [001] 147.405609: kmalloc: call_site=0 ...
konsole-1776 [001] 147.405786: kmalloc: call_site=0 ...
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
mm/slab.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/slab.c b/mm/slab.c
index 9733bb4..c3d092d 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3649,7 +3649,7 @@ __do_kmalloc_node(size_t size, gfp_t flags, int node, void *caller)
return ret;
}
-#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_KMEMTRACE)
+#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_TRACING)
void *__kmalloc_node(size_t size, gfp_t flags, int node)
{
return __do_kmalloc_node(size, flags, node,
@@ -3669,7 +3669,7 @@ void *__kmalloc_node(size_t size, gfp_t flags, int node)
return __do_kmalloc_node(size, flags, node, NULL);
}
EXPORT_SYMBOL(__kmalloc_node);
-#endif /* CONFIG_DEBUG_SLAB */
+#endif /* CONFIG_DEBUG_SLAB || CONFIG_TRACING */
#endif /* CONFIG_NUMA */
/**
@@ -3701,7 +3701,7 @@ static __always_inline void *__do_kmalloc(size_t size, gfp_t flags,
}
-#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_KMEMTRACE)
+#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_TRACING)
void *__kmalloc(size_t size, gfp_t flags)
{
return __do_kmalloc(size, flags, __builtin_return_address(0));
--
1.6.3
--
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] 8+ messages in thread* [tip:perf/urgent] tracing, slab: Fix no callsite ifndef CONFIG_KMEMTRACE
2009-12-11 7:45 ` [PATCH 2/2] tracing: Fix no callsite ifndef CONFIG_KMEMTRACE Li Zefan
@ 2009-12-11 8:55 ` tip-bot for Li Zefan
0 siblings, 0 replies; 8+ messages in thread
From: tip-bot for Li Zefan @ 2009-12-11 8:55 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, penberg, lizf, eduard.munteanu,
fweisbec, rostedt, tglx, linux-mm, mingo, cl
Commit-ID: 0bb38a5cdeb39f543657ec6fb9950343d2de6918
Gitweb: http://git.kernel.org/tip/0bb38a5cdeb39f543657ec6fb9950343d2de6918
Author: Li Zefan <lizf@cn.fujitsu.com>
AuthorDate: Fri, 11 Dec 2009 15:45:50 +0800
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 11 Dec 2009 09:17:03 +0100
tracing, slab: Fix no callsite ifndef CONFIG_KMEMTRACE
For slab, if CONFIG_KMEMTRACE and CONFIG_DEBUG_SLAB are not set,
__do_kmalloc() will not track callers:
# ./perf record -f -a -R -e kmem:kmalloc
^C
# ./perf trace
...
perf-2204 [000] 147.376774: kmalloc: call_site=c0529d2d ...
perf-2204 [000] 147.400997: kmalloc: call_site=c0529d2d ...
Xorg-1461 [001] 147.405413: kmalloc: call_site=0 ...
Xorg-1461 [001] 147.405609: kmalloc: call_site=0 ...
konsole-1776 [001] 147.405786: kmalloc: call_site=0 ...
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: linux-mm@kvack.org <linux-mm@kvack.org>
Cc: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
LKML-Reference: <4B21F8AE.6020804@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
mm/slab.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/slab.c b/mm/slab.c
index 9733bb4..c3d092d 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3649,7 +3649,7 @@ __do_kmalloc_node(size_t size, gfp_t flags, int node, void *caller)
return ret;
}
-#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_KMEMTRACE)
+#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_TRACING)
void *__kmalloc_node(size_t size, gfp_t flags, int node)
{
return __do_kmalloc_node(size, flags, node,
@@ -3669,7 +3669,7 @@ void *__kmalloc_node(size_t size, gfp_t flags, int node)
return __do_kmalloc_node(size, flags, node, NULL);
}
EXPORT_SYMBOL(__kmalloc_node);
-#endif /* CONFIG_DEBUG_SLAB */
+#endif /* CONFIG_DEBUG_SLAB || CONFIG_TRACING */
#endif /* CONFIG_NUMA */
/**
@@ -3701,7 +3701,7 @@ static __always_inline void *__do_kmalloc(size_t size, gfp_t flags,
}
-#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_KMEMTRACE)
+#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_TRACING)
void *__kmalloc(size_t size, gfp_t flags)
{
return __do_kmalloc(size, flags, __builtin_return_address(0));
--
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] 8+ messages in thread
* Re: [PATCH 1/2] tracing: Define kmem_cache_alloc_notrace ifdef CONFIG_TRACING
2009-12-11 7:45 [PATCH 1/2] tracing: Define kmem_cache_alloc_notrace ifdef CONFIG_TRACING Li Zefan
2009-12-11 7:45 ` [PATCH 2/2] tracing: Fix no callsite ifndef CONFIG_KMEMTRACE Li Zefan
@ 2009-12-11 7:56 ` Ingo Molnar
2009-12-11 8:06 ` Pekka Enberg
2009-12-11 8:55 ` [tip:perf/urgent] tracing, slab: " tip-bot for Li Zefan
3 siblings, 0 replies; 8+ messages in thread
From: Ingo Molnar @ 2009-12-11 7:56 UTC (permalink / raw)
To: Li Zefan
Cc: Pekka Enberg, Christoph Lameter, Steven Rostedt,
Frederic Weisbecker, linux-mm, LKML, Eduard - Gabriel Munteanu
* Li Zefan <lizf@cn.fujitsu.com> wrote:
> Define kmem_trace_alloc_{,node}_notrace() if CONFIG_TRACING is
> enabled, otherwise perf-kmem will show wrong stats ifndef
> CONFIG_KMEM_TRACE, because a kmalloc() memory allocation may
> be traced by both trace_kmalloc() and trace_kmem_cache_alloc().
>
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
> ---
> include/linux/slab_def.h | 4 ++--
> include/linux/slub_def.h | 4 ++--
> mm/slab.c | 6 +++---
> mm/slub.c | 4 ++--
> 4 files changed, 9 insertions(+), 9 deletions(-)
Pekka, can i add your Reviewed-by or Acked-by to this v2 version of the
patch?
Thanks,
Ingo
--
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] 8+ messages in thread* Re: [PATCH 1/2] tracing: Define kmem_cache_alloc_notrace ifdef CONFIG_TRACING
2009-12-11 7:45 [PATCH 1/2] tracing: Define kmem_cache_alloc_notrace ifdef CONFIG_TRACING Li Zefan
2009-12-11 7:45 ` [PATCH 2/2] tracing: Fix no callsite ifndef CONFIG_KMEMTRACE Li Zefan
2009-12-11 7:56 ` [PATCH 1/2] tracing: Define kmem_cache_alloc_notrace ifdef CONFIG_TRACING Ingo Molnar
@ 2009-12-11 8:06 ` Pekka Enberg
2009-12-11 8:55 ` [tip:perf/urgent] tracing, slab: " tip-bot for Li Zefan
3 siblings, 0 replies; 8+ messages in thread
From: Pekka Enberg @ 2009-12-11 8:06 UTC (permalink / raw)
To: Li Zefan
Cc: Ingo Molnar, Christoph Lameter, Steven Rostedt,
Frederic Weisbecker, linux-mm, LKML, Eduard - Gabriel Munteanu
Li Zefan kirjoitti:
> Define kmem_trace_alloc_{,node}_notrace() if CONFIG_TRACING is
> enabled, otherwise perf-kmem will show wrong stats ifndef
> CONFIG_KMEM_TRACE, because a kmalloc() memory allocation may
> be traced by both trace_kmalloc() and trace_kmem_cache_alloc().
>
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi>
--
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] 8+ messages in thread* [tip:perf/urgent] tracing, slab: Define kmem_cache_alloc_notrace ifdef CONFIG_TRACING
2009-12-11 7:45 [PATCH 1/2] tracing: Define kmem_cache_alloc_notrace ifdef CONFIG_TRACING Li Zefan
` (2 preceding siblings ...)
2009-12-11 8:06 ` Pekka Enberg
@ 2009-12-11 8:55 ` tip-bot for Li Zefan
3 siblings, 0 replies; 8+ messages in thread
From: tip-bot for Li Zefan @ 2009-12-11 8:55 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, penberg, lizf, eduard.munteanu,
fweisbec, rostedt, tglx, linux-mm, mingo, cl
Commit-ID: 0f24f1287a86b198c1e4bd4ce45e8565e40ff804
Gitweb: http://git.kernel.org/tip/0f24f1287a86b198c1e4bd4ce45e8565e40ff804
Author: Li Zefan <lizf@cn.fujitsu.com>
AuthorDate: Fri, 11 Dec 2009 15:45:30 +0800
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 11 Dec 2009 09:17:02 +0100
tracing, slab: Define kmem_cache_alloc_notrace ifdef CONFIG_TRACING
Define kmem_trace_alloc_{,node}_notrace() if CONFIG_TRACING is
enabled, otherwise perf-kmem will show wrong stats ifndef
CONFIG_KMEM_TRACE, because a kmalloc() memory allocation may
be traced by both trace_kmalloc() and trace_kmem_cache_alloc().
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: linux-mm@kvack.org <linux-mm@kvack.org>
Cc: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
LKML-Reference: <4B21F89A.7000801@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
include/linux/slab_def.h | 4 ++--
include/linux/slub_def.h | 4 ++--
mm/slab.c | 6 +++---
mm/slub.c | 4 ++--
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index 850d057..ca6b2b3 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -110,7 +110,7 @@ extern struct cache_sizes malloc_sizes[];
void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
void *__kmalloc(size_t size, gfp_t flags);
-#ifdef CONFIG_KMEMTRACE
+#ifdef CONFIG_TRACING
extern void *kmem_cache_alloc_notrace(struct kmem_cache *cachep, gfp_t flags);
extern size_t slab_buffer_size(struct kmem_cache *cachep);
#else
@@ -166,7 +166,7 @@ found:
extern void *__kmalloc_node(size_t size, gfp_t flags, int node);
extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
-#ifdef CONFIG_KMEMTRACE
+#ifdef CONFIG_TRACING
extern void *kmem_cache_alloc_node_notrace(struct kmem_cache *cachep,
gfp_t flags,
int nodeid);
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 5ad70a6..1e14beb 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -217,7 +217,7 @@ static __always_inline struct kmem_cache *kmalloc_slab(size_t size)
void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
void *__kmalloc(size_t size, gfp_t flags);
-#ifdef CONFIG_KMEMTRACE
+#ifdef CONFIG_TRACING
extern void *kmem_cache_alloc_notrace(struct kmem_cache *s, gfp_t gfpflags);
#else
static __always_inline void *
@@ -266,7 +266,7 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags)
void *__kmalloc_node(size_t size, gfp_t flags, int node);
void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
-#ifdef CONFIG_KMEMTRACE
+#ifdef CONFIG_TRACING
extern void *kmem_cache_alloc_node_notrace(struct kmem_cache *s,
gfp_t gfpflags,
int node);
diff --git a/mm/slab.c b/mm/slab.c
index 7dfa481..9733bb4 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -490,7 +490,7 @@ static void **dbg_userword(struct kmem_cache *cachep, void *objp)
#endif
-#ifdef CONFIG_KMEMTRACE
+#ifdef CONFIG_TRACING
size_t slab_buffer_size(struct kmem_cache *cachep)
{
return cachep->buffer_size;
@@ -3558,7 +3558,7 @@ void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags)
}
EXPORT_SYMBOL(kmem_cache_alloc);
-#ifdef CONFIG_KMEMTRACE
+#ifdef CONFIG_TRACING
void *kmem_cache_alloc_notrace(struct kmem_cache *cachep, gfp_t flags)
{
return __cache_alloc(cachep, flags, __builtin_return_address(0));
@@ -3621,7 +3621,7 @@ void *kmem_cache_alloc_node(struct kmem_cache *cachep, gfp_t flags, int nodeid)
}
EXPORT_SYMBOL(kmem_cache_alloc_node);
-#ifdef CONFIG_KMEMTRACE
+#ifdef CONFIG_TRACING
void *kmem_cache_alloc_node_notrace(struct kmem_cache *cachep,
gfp_t flags,
int nodeid)
diff --git a/mm/slub.c b/mm/slub.c
index 4996fc7..4a89c3d 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1754,7 +1754,7 @@ void *kmem_cache_alloc(struct kmem_cache *s, gfp_t gfpflags)
}
EXPORT_SYMBOL(kmem_cache_alloc);
-#ifdef CONFIG_KMEMTRACE
+#ifdef CONFIG_TRACING
void *kmem_cache_alloc_notrace(struct kmem_cache *s, gfp_t gfpflags)
{
return slab_alloc(s, gfpflags, -1, _RET_IP_);
@@ -1775,7 +1775,7 @@ void *kmem_cache_alloc_node(struct kmem_cache *s, gfp_t gfpflags, int node)
EXPORT_SYMBOL(kmem_cache_alloc_node);
#endif
-#ifdef CONFIG_KMEMTRACE
+#ifdef CONFIG_TRACING
void *kmem_cache_alloc_node_notrace(struct kmem_cache *s,
gfp_t gfpflags,
int node)
--
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] 8+ messages in thread
* [PATCH 1/2] tracing: Define kmem_trace_alloc_notrace unconditionally
@ 2009-12-11 5:50 Li Zefan
2009-12-11 5:50 ` [PATCH 2/2] tracing: Fix no callsite ifndef CONFIG_KMEMTRACE Li Zefan
0 siblings, 1 reply; 8+ messages in thread
From: Li Zefan @ 2009-12-11 5:50 UTC (permalink / raw)
To: Ingo Molnar
Cc: Pekka Enberg, Christoph Lameter, Steven Rostedt,
Frederic Weisbecker, linux-mm, LKML, Eduard - Gabriel Munteanu
Always define kmem_trace_alloc_{,node}_notrace(), otherwise
perf-kmem will show wrong stats ifndef CONFIG_KMEMTRACE,
because a kmalloc() memory allocation may be traced by
both trace_kmalloc() and trace_kmem_cache_alloc().
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
include/linux/slab_def.h | 24 ++----------------------
include/linux/slub_def.h | 27 +++------------------------
mm/slab.c | 12 ------------
mm/slub.c | 4 ----
4 files changed, 5 insertions(+), 62 deletions(-)
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index 850d057..1c9ce4b 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -109,21 +109,12 @@ extern struct cache_sizes malloc_sizes[];
void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
void *__kmalloc(size_t size, gfp_t flags);
+void *kmem_cache_alloc_notrace(struct kmem_cache *cachep, gfp_t flags);
-#ifdef CONFIG_KMEMTRACE
-extern void *kmem_cache_alloc_notrace(struct kmem_cache *cachep, gfp_t flags);
-extern size_t slab_buffer_size(struct kmem_cache *cachep);
-#else
-static __always_inline void *
-kmem_cache_alloc_notrace(struct kmem_cache *cachep, gfp_t flags)
-{
- return kmem_cache_alloc(cachep, flags);
-}
static inline size_t slab_buffer_size(struct kmem_cache *cachep)
{
- return 0;
+ return cachep->buffer_size;
}
-#endif
static __always_inline void *kmalloc(size_t size, gfp_t flags)
{
@@ -165,20 +156,9 @@ found:
#ifdef CONFIG_NUMA
extern void *__kmalloc_node(size_t size, gfp_t flags, int node);
extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
-
-#ifdef CONFIG_KMEMTRACE
extern void *kmem_cache_alloc_node_notrace(struct kmem_cache *cachep,
gfp_t flags,
int nodeid);
-#else
-static __always_inline void *
-kmem_cache_alloc_node_notrace(struct kmem_cache *cachep,
- gfp_t flags,
- int nodeid)
-{
- return kmem_cache_alloc_node(cachep, flags, nodeid);
-}
-#endif
static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
{
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 5ad70a6..5c5ca0c 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -215,18 +215,9 @@ static __always_inline struct kmem_cache *kmalloc_slab(size_t size)
#endif
void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
+void *kmem_cache_alloc_notrace(struct kmem_cache *s, gfp_t gfpflags);
void *__kmalloc(size_t size, gfp_t flags);
-#ifdef CONFIG_KMEMTRACE
-extern void *kmem_cache_alloc_notrace(struct kmem_cache *s, gfp_t gfpflags);
-#else
-static __always_inline void *
-kmem_cache_alloc_notrace(struct kmem_cache *s, gfp_t gfpflags)
-{
- return kmem_cache_alloc(s, gfpflags);
-}
-#endif
-
static __always_inline void *kmalloc_large(size_t size, gfp_t flags)
{
unsigned int order = get_order(size);
@@ -265,20 +256,8 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags)
#ifdef CONFIG_NUMA
void *__kmalloc_node(size_t size, gfp_t flags, int node);
void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
-
-#ifdef CONFIG_KMEMTRACE
-extern void *kmem_cache_alloc_node_notrace(struct kmem_cache *s,
- gfp_t gfpflags,
- int node);
-#else
-static __always_inline void *
-kmem_cache_alloc_node_notrace(struct kmem_cache *s,
- gfp_t gfpflags,
- int node)
-{
- return kmem_cache_alloc_node(s, gfpflags, node);
-}
-#endif
+void *kmem_cache_alloc_node_notrace(struct kmem_cache *s, gfp_t gfpflags,
+ int node);
static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
{
diff --git a/mm/slab.c b/mm/slab.c
index 7dfa481..e556380 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -490,14 +490,6 @@ static void **dbg_userword(struct kmem_cache *cachep, void *objp)
#endif
-#ifdef CONFIG_KMEMTRACE
-size_t slab_buffer_size(struct kmem_cache *cachep)
-{
- return cachep->buffer_size;
-}
-EXPORT_SYMBOL(slab_buffer_size);
-#endif
-
/*
* Do not go above this order unless 0 objects fit into the slab.
*/
@@ -3558,13 +3550,11 @@ void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags)
}
EXPORT_SYMBOL(kmem_cache_alloc);
-#ifdef CONFIG_KMEMTRACE
void *kmem_cache_alloc_notrace(struct kmem_cache *cachep, gfp_t flags)
{
return __cache_alloc(cachep, flags, __builtin_return_address(0));
}
EXPORT_SYMBOL(kmem_cache_alloc_notrace);
-#endif
/**
* kmem_ptr_validate - check if an untrusted pointer might be a slab entry.
@@ -3621,7 +3611,6 @@ void *kmem_cache_alloc_node(struct kmem_cache *cachep, gfp_t flags, int nodeid)
}
EXPORT_SYMBOL(kmem_cache_alloc_node);
-#ifdef CONFIG_KMEMTRACE
void *kmem_cache_alloc_node_notrace(struct kmem_cache *cachep,
gfp_t flags,
int nodeid)
@@ -3630,7 +3619,6 @@ void *kmem_cache_alloc_node_notrace(struct kmem_cache *cachep,
__builtin_return_address(0));
}
EXPORT_SYMBOL(kmem_cache_alloc_node_notrace);
-#endif
static __always_inline void *
__do_kmalloc_node(size_t size, gfp_t flags, int node, void *caller)
diff --git a/mm/slub.c b/mm/slub.c
index 4996fc7..a1c8fe5 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1754,13 +1754,11 @@ void *kmem_cache_alloc(struct kmem_cache *s, gfp_t gfpflags)
}
EXPORT_SYMBOL(kmem_cache_alloc);
-#ifdef CONFIG_KMEMTRACE
void *kmem_cache_alloc_notrace(struct kmem_cache *s, gfp_t gfpflags)
{
return slab_alloc(s, gfpflags, -1, _RET_IP_);
}
EXPORT_SYMBOL(kmem_cache_alloc_notrace);
-#endif
#ifdef CONFIG_NUMA
void *kmem_cache_alloc_node(struct kmem_cache *s, gfp_t gfpflags, int node)
@@ -1775,7 +1773,6 @@ void *kmem_cache_alloc_node(struct kmem_cache *s, gfp_t gfpflags, int node)
EXPORT_SYMBOL(kmem_cache_alloc_node);
#endif
-#ifdef CONFIG_KMEMTRACE
void *kmem_cache_alloc_node_notrace(struct kmem_cache *s,
gfp_t gfpflags,
int node)
@@ -1783,7 +1780,6 @@ void *kmem_cache_alloc_node_notrace(struct kmem_cache *s,
return slab_alloc(s, gfpflags, node, _RET_IP_);
}
EXPORT_SYMBOL(kmem_cache_alloc_node_notrace);
-#endif
/*
* Slow patch handling. This may still be called frequently since objects
--
1.6.3
--
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] 8+ messages in thread* [PATCH 2/2] tracing: Fix no callsite ifndef CONFIG_KMEMTRACE
2009-12-11 5:50 [PATCH 1/2] tracing: Define kmem_trace_alloc_notrace unconditionally Li Zefan
@ 2009-12-11 5:50 ` Li Zefan
2009-12-11 6:00 ` Pekka Enberg
0 siblings, 1 reply; 8+ messages in thread
From: Li Zefan @ 2009-12-11 5:50 UTC (permalink / raw)
To: Ingo Molnar
Cc: Pekka Enberg, Christoph Lameter, Steven Rostedt,
Frederic Weisbecker, linux-mm, LKML, Eduard - Gabriel Munteanu
For slab, if CONFIG_KMEMTRACE and CONFIG_DEBUG_SLAB are not set,
__do_kmalloc() will not track callers:
# ./perf record -f -a -R -e kmem:kmalloc
^C
# ./perf trace
...
perf-2204 [000] 147.376774: kmalloc: call_site=c0529d2d ...
perf-2204 [000] 147.400997: kmalloc: call_site=c0529d2d ...
Xorg-1461 [001] 147.405413: kmalloc: call_site=0 ...
Xorg-1461 [001] 147.405609: kmalloc: call_site=0 ...
konsole-1776 [001] 147.405786: kmalloc: call_site=0 ...
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
mm/slab.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/slab.c b/mm/slab.c
index e556380..eacf7f0 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3637,7 +3637,7 @@ __do_kmalloc_node(size_t size, gfp_t flags, int node, void *caller)
return ret;
}
-#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_KMEMTRACE)
+#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_TRACING)
void *__kmalloc_node(size_t size, gfp_t flags, int node)
{
return __do_kmalloc_node(size, flags, node,
@@ -3657,7 +3657,7 @@ void *__kmalloc_node(size_t size, gfp_t flags, int node)
return __do_kmalloc_node(size, flags, node, NULL);
}
EXPORT_SYMBOL(__kmalloc_node);
-#endif /* CONFIG_DEBUG_SLAB */
+#endif /* CONFIG_DEBUG_SLAB || CONFIG_TRACING */
#endif /* CONFIG_NUMA */
/**
@@ -3689,7 +3689,7 @@ static __always_inline void *__do_kmalloc(size_t size, gfp_t flags,
}
-#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_KMEMTRACE)
+#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_TRACING)
void *__kmalloc(size_t size, gfp_t flags)
{
return __do_kmalloc(size, flags, __builtin_return_address(0));
--
1.6.3
--
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] 8+ messages in thread* Re: [PATCH 2/2] tracing: Fix no callsite ifndef CONFIG_KMEMTRACE
2009-12-11 5:50 ` [PATCH 2/2] tracing: Fix no callsite ifndef CONFIG_KMEMTRACE Li Zefan
@ 2009-12-11 6:00 ` Pekka Enberg
0 siblings, 0 replies; 8+ messages in thread
From: Pekka Enberg @ 2009-12-11 6:00 UTC (permalink / raw)
To: Li Zefan
Cc: Ingo Molnar, Christoph Lameter, Steven Rostedt,
Frederic Weisbecker, linux-mm, LKML, Eduard - Gabriel Munteanu
Li Zefan wrote:
> For slab, if CONFIG_KMEMTRACE and CONFIG_DEBUG_SLAB are not set,
> __do_kmalloc() will not track callers:
>
> # ./perf record -f -a -R -e kmem:kmalloc
> ^C
> # ./perf trace
> ...
> perf-2204 [000] 147.376774: kmalloc: call_site=c0529d2d ...
> perf-2204 [000] 147.400997: kmalloc: call_site=c0529d2d ...
> Xorg-1461 [001] 147.405413: kmalloc: call_site=0 ...
> Xorg-1461 [001] 147.405609: kmalloc: call_site=0 ...
> konsole-1776 [001] 147.405786: kmalloc: call_site=0 ...
>
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi>
> ---
> mm/slab.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/mm/slab.c b/mm/slab.c
> index e556380..eacf7f0 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -3637,7 +3637,7 @@ __do_kmalloc_node(size_t size, gfp_t flags, int node, void *caller)
> return ret;
> }
>
> -#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_KMEMTRACE)
> +#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_TRACING)
> void *__kmalloc_node(size_t size, gfp_t flags, int node)
> {
> return __do_kmalloc_node(size, flags, node,
> @@ -3657,7 +3657,7 @@ void *__kmalloc_node(size_t size, gfp_t flags, int node)
> return __do_kmalloc_node(size, flags, node, NULL);
> }
> EXPORT_SYMBOL(__kmalloc_node);
> -#endif /* CONFIG_DEBUG_SLAB */
> +#endif /* CONFIG_DEBUG_SLAB || CONFIG_TRACING */
> #endif /* CONFIG_NUMA */
>
> /**
> @@ -3689,7 +3689,7 @@ static __always_inline void *__do_kmalloc(size_t size, gfp_t flags,
> }
>
>
> -#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_KMEMTRACE)
> +#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_TRACING)
> void *__kmalloc(size_t size, gfp_t flags)
> {
> return __do_kmalloc(size, flags, __builtin_return_address(0));
--
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] 8+ messages in thread
end of thread, other threads:[~2009-12-11 8:57 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-11 7:45 [PATCH 1/2] tracing: Define kmem_cache_alloc_notrace ifdef CONFIG_TRACING Li Zefan
2009-12-11 7:45 ` [PATCH 2/2] tracing: Fix no callsite ifndef CONFIG_KMEMTRACE Li Zefan
2009-12-11 8:55 ` [tip:perf/urgent] tracing, slab: " tip-bot for Li Zefan
2009-12-11 7:56 ` [PATCH 1/2] tracing: Define kmem_cache_alloc_notrace ifdef CONFIG_TRACING Ingo Molnar
2009-12-11 8:06 ` Pekka Enberg
2009-12-11 8:55 ` [tip:perf/urgent] tracing, slab: " tip-bot for Li Zefan
-- strict thread matches above, loose matches on Subject: below --
2009-12-11 5:50 [PATCH 1/2] tracing: Define kmem_trace_alloc_notrace unconditionally Li Zefan
2009-12-11 5:50 ` [PATCH 2/2] tracing: Fix no callsite ifndef CONFIG_KMEMTRACE Li Zefan
2009-12-11 6:00 ` Pekka Enberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox