2 * Copyright (C) 2008 Eduard - Gabriel Munteanu
4 * This file is released under GPL version 2.
7 #ifndef _LINUX_KMEMTRACE_H
8 #define _LINUX_KMEMTRACE_H
12 #include <linux/types.h>
13 #include <linux/marker.h>
15 enum kmemtrace_type_id {
16 KMEMTRACE_TYPE_KMALLOC = 0, /* kmalloc() or kfree(). */
17 KMEMTRACE_TYPE_CACHE, /* kmem_cache_*(). */
18 KMEMTRACE_TYPE_PAGES, /* __get_free_pages() and friends. */
21 #ifdef CONFIG_KMEMTRACE
23 extern void kmemtrace_init(void);
25 static inline void kmemtrace_mark_alloc_node(enum kmemtrace_type_id type_id,
26 unsigned long call_site,
33 trace_mark(kmemtrace_alloc, "type_id %d call_site %lu ptr %lu "
34 "bytes_req %lu bytes_alloc %lu gfp_flags %lu node %d",
35 type_id, call_site, (unsigned long) ptr,
36 (unsigned long) bytes_req, (unsigned long) bytes_alloc,
37 (unsigned long) gfp_flags, node);
40 static inline void kmemtrace_mark_free(enum kmemtrace_type_id type_id,
41 unsigned long call_site,
44 trace_mark(kmemtrace_free, "type_id %d call_site %lu ptr %lu",
45 type_id, call_site, (unsigned long) ptr);
48 #else /* CONFIG_KMEMTRACE */
50 static inline void kmemtrace_init(void)
54 static inline void kmemtrace_mark_alloc_node(enum kmemtrace_type_id type_id,
55 unsigned long call_site,
64 static inline void kmemtrace_mark_free(enum kmemtrace_type_id type_id,
65 unsigned long call_site,
70 #endif /* CONFIG_KMEMTRACE */
72 static inline void kmemtrace_mark_alloc(enum kmemtrace_type_id type_id,
73 unsigned long call_site,
79 kmemtrace_mark_alloc_node(type_id, call_site, ptr,
80 bytes_req, bytes_alloc, gfp_flags, -1);
83 #endif /* __KERNEL__ */
85 #endif /* _LINUX_KMEMTRACE_H */