Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 142233
b: refs/heads/master
c: ca2b84c
h: refs/heads/master
i:
  142231: a6a5e44
v: v3
  • Loading branch information
Eduard - Gabriel Munteanu authored and Ingo Molnar committed Apr 3, 2009
1 parent c121fd0 commit a83a435
Show file tree
Hide file tree
Showing 10 changed files with 252 additions and 174 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ac44021fccd8f1f2b267b004f23a2e8d7ef05f7b
refs/heads/master: ca2b84cb3c4a0d4d2143b46ec072cdff5d1b3b87
10 changes: 5 additions & 5 deletions trunk/include/linux/slab_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags)

ret = kmem_cache_alloc_notrace(cachep, flags);

kmemtrace_mark_alloc(KMEMTRACE_TYPE_KMALLOC, _THIS_IP_, ret,
size, slab_buffer_size(cachep), flags);
trace_kmalloc(_THIS_IP_, ret,
size, slab_buffer_size(cachep), flags);

return ret;
}
Expand Down Expand Up @@ -128,9 +128,9 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)

ret = kmem_cache_alloc_node_notrace(cachep, flags, node);

kmemtrace_mark_alloc_node(KMEMTRACE_TYPE_KMALLOC, _THIS_IP_,
ret, size, slab_buffer_size(cachep),
flags, node);
trace_kmalloc_node(_THIS_IP_, ret,
size, slab_buffer_size(cachep),
flags, node);

return ret;
}
Expand Down
12 changes: 4 additions & 8 deletions trunk/include/linux/slub_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,7 @@ static __always_inline void *kmalloc_large(size_t size, gfp_t flags)
unsigned int order = get_order(size);
void *ret = (void *) __get_free_pages(flags | __GFP_COMP, order);

kmemtrace_mark_alloc(KMEMTRACE_TYPE_KMALLOC, _THIS_IP_, ret,
size, PAGE_SIZE << order, flags);
trace_kmalloc(_THIS_IP_, ret, size, PAGE_SIZE << order, flags);

return ret;
}
Expand All @@ -255,9 +254,7 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags)

ret = kmem_cache_alloc_notrace(s, flags);

kmemtrace_mark_alloc(KMEMTRACE_TYPE_KMALLOC,
_THIS_IP_, ret,
size, s->size, flags);
trace_kmalloc(_THIS_IP_, ret, size, s->size, flags);

return ret;
}
Expand Down Expand Up @@ -296,9 +293,8 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)

ret = kmem_cache_alloc_node_notrace(s, flags, node);

kmemtrace_mark_alloc_node(KMEMTRACE_TYPE_KMALLOC,
_THIS_IP_, ret,
size, s->size, flags, node);
trace_kmalloc_node(_THIS_IP_, ret,
size, s->size, flags, node);

return ret;
}
Expand Down
92 changes: 40 additions & 52 deletions trunk/include/trace/kmemtrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,65 +9,53 @@

#ifdef __KERNEL__

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

enum kmemtrace_type_id {
KMEMTRACE_TYPE_KMALLOC = 0, /* kmalloc() or kfree(). */
KMEMTRACE_TYPE_CACHE, /* kmem_cache_*(). */
KMEMTRACE_TYPE_PAGES, /* __get_free_pages() and friends. */
};

#ifdef CONFIG_KMEMTRACE

extern void kmemtrace_init(void);

extern void kmemtrace_mark_alloc_node(enum kmemtrace_type_id type_id,
unsigned long call_site,
const void *ptr,
size_t bytes_req,
size_t bytes_alloc,
gfp_t gfp_flags,
int node);

extern void kmemtrace_mark_free(enum kmemtrace_type_id type_id,
unsigned long call_site,
const void *ptr);

#else /* CONFIG_KMEMTRACE */

#else
static inline void kmemtrace_init(void)
{
}

static inline void kmemtrace_mark_alloc_node(enum kmemtrace_type_id type_id,
unsigned long call_site,
const void *ptr,
size_t bytes_req,
size_t bytes_alloc,
gfp_t gfp_flags,
int node)
{
}

static inline void kmemtrace_mark_free(enum kmemtrace_type_id type_id,
unsigned long call_site,
const void *ptr)
{
}

#endif /* CONFIG_KMEMTRACE */

static inline void kmemtrace_mark_alloc(enum kmemtrace_type_id type_id,
unsigned long call_site,
const void *ptr,
size_t bytes_req,
size_t bytes_alloc,
gfp_t gfp_flags)
{
kmemtrace_mark_alloc_node(type_id, call_site, ptr,
bytes_req, bytes_alloc, gfp_flags, -1);
}
#endif

DECLARE_TRACE(kmalloc,
TP_PROTO(unsigned long call_site,
const void *ptr,
size_t bytes_req,
size_t bytes_alloc,
gfp_t gfp_flags),
TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags));
DECLARE_TRACE(kmem_cache_alloc,
TP_PROTO(unsigned long call_site,
const void *ptr,
size_t bytes_req,
size_t bytes_alloc,
gfp_t gfp_flags),
TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags));
DECLARE_TRACE(kmalloc_node,
TP_PROTO(unsigned long call_site,
const void *ptr,
size_t bytes_req,
size_t bytes_alloc,
gfp_t gfp_flags,
int node),
TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node));
DECLARE_TRACE(kmem_cache_alloc_node,
TP_PROTO(unsigned long call_site,
const void *ptr,
size_t bytes_req,
size_t bytes_alloc,
gfp_t gfp_flags,
int node),
TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node));
DECLARE_TRACE(kfree,
TP_PROTO(unsigned long call_site, const void *ptr),
TP_ARGS(call_site, ptr));
DECLARE_TRACE(kmem_cache_free,
TP_PROTO(unsigned long call_site, const void *ptr),
TP_ARGS(call_site, ptr));

#endif /* __KERNEL__ */

Expand Down
Loading

0 comments on commit a83a435

Please sign in to comment.