aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kmemcheck.h
diff options
context:
space:
mode:
authorVegard Nossum <vegard.nossum@gmail.com>2008-11-25 10:55:53 -0500
committerVegard Nossum <vegard.nossum@gmail.com>2009-06-15 09:48:33 -0400
commitb1eeab67682a5e397aecf172046b3a8bd4808ae4 (patch)
treec357b6ac1945dc8beecc2f8c4d84660ad8d35aae /include/linux/kmemcheck.h
parent9b5cab31897e9e89e36c0c2a89b16b93ff1a971a (diff)
kmemcheck: add hooks for the page allocator
This adds support for tracking the initializedness of memory that was allocated with the page allocator. Highmem requests are not tracked. Cc: Dave Hansen <dave@linux.vnet.ibm.com> Acked-by: Pekka Enberg <penberg@cs.helsinki.fi> [build fix for !CONFIG_KMEMCHECK] Signed-off-by: Ingo Molnar <mingo@elte.hu> [rebased for mainline inclusion] Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
Diffstat (limited to 'include/linux/kmemcheck.h')
-rw-r--r--include/linux/kmemcheck.h35
1 files changed, 29 insertions, 6 deletions
diff --git a/include/linux/kmemcheck.h b/include/linux/kmemcheck.h
index 71f21ae33d1d..093d23969b1b 100644
--- a/include/linux/kmemcheck.h
+++ b/include/linux/kmemcheck.h
@@ -8,13 +8,15 @@
8extern int kmemcheck_enabled; 8extern int kmemcheck_enabled;
9 9
10/* The slab-related functions. */ 10/* The slab-related functions. */
11void kmemcheck_alloc_shadow(struct kmem_cache *s, gfp_t flags, int node, 11void kmemcheck_alloc_shadow(struct page *page, int order, gfp_t flags, int node);
12 struct page *page, int order); 12void kmemcheck_free_shadow(struct page *page, int order);
13void kmemcheck_free_shadow(struct kmem_cache *s, struct page *page, int order);
14void kmemcheck_slab_alloc(struct kmem_cache *s, gfp_t gfpflags, void *object, 13void kmemcheck_slab_alloc(struct kmem_cache *s, gfp_t gfpflags, void *object,
15 size_t size); 14 size_t size);
16void kmemcheck_slab_free(struct kmem_cache *s, void *object, size_t size); 15void kmemcheck_slab_free(struct kmem_cache *s, void *object, size_t size);
17 16
17void kmemcheck_pagealloc_alloc(struct page *p, unsigned int order,
18 gfp_t gfpflags);
19
18void kmemcheck_show_pages(struct page *p, unsigned int n); 20void kmemcheck_show_pages(struct page *p, unsigned int n);
19void kmemcheck_hide_pages(struct page *p, unsigned int n); 21void kmemcheck_hide_pages(struct page *p, unsigned int n);
20 22
@@ -27,6 +29,7 @@ void kmemcheck_mark_freed(void *address, unsigned int n);
27 29
28void kmemcheck_mark_unallocated_pages(struct page *p, unsigned int n); 30void kmemcheck_mark_unallocated_pages(struct page *p, unsigned int n);
29void kmemcheck_mark_uninitialized_pages(struct page *p, unsigned int n); 31void kmemcheck_mark_uninitialized_pages(struct page *p, unsigned int n);
32void kmemcheck_mark_initialized_pages(struct page *p, unsigned int n);
30 33
31int kmemcheck_show_addr(unsigned long address); 34int kmemcheck_show_addr(unsigned long address);
32int kmemcheck_hide_addr(unsigned long address); 35int kmemcheck_hide_addr(unsigned long address);
@@ -34,13 +37,12 @@ int kmemcheck_hide_addr(unsigned long address);
34#define kmemcheck_enabled 0 37#define kmemcheck_enabled 0
35 38
36static inline void 39static inline void
37kmemcheck_alloc_shadow(struct kmem_cache *s, gfp_t flags, int node, 40kmemcheck_alloc_shadow(struct page *page, int order, gfp_t flags, int node)
38 struct page *page, int order)
39{ 41{
40} 42}
41 43
42static inline void 44static inline void
43kmemcheck_free_shadow(struct kmem_cache *s, struct page *page, int order) 45kmemcheck_free_shadow(struct page *page, int order)
44{ 46{
45} 47}
46 48
@@ -55,6 +57,11 @@ static inline void kmemcheck_slab_free(struct kmem_cache *s, void *object,
55{ 57{
56} 58}
57 59
60static inline void kmemcheck_pagealloc_alloc(struct page *p,
61 unsigned int order, gfp_t gfpflags)
62{
63}
64
58static inline bool kmemcheck_page_is_tracked(struct page *p) 65static inline bool kmemcheck_page_is_tracked(struct page *p)
59{ 66{
60 return false; 67 return false;
@@ -75,6 +82,22 @@ static inline void kmemcheck_mark_initialized(void *address, unsigned int n)
75static inline void kmemcheck_mark_freed(void *address, unsigned int n) 82static inline void kmemcheck_mark_freed(void *address, unsigned int n)
76{ 83{
77} 84}
85
86static inline void kmemcheck_mark_unallocated_pages(struct page *p,
87 unsigned int n)
88{
89}
90
91static inline void kmemcheck_mark_uninitialized_pages(struct page *p,
92 unsigned int n)
93{
94}
95
96static inline void kmemcheck_mark_initialized_pages(struct page *p,
97 unsigned int n)
98{
99}
100
78#endif /* CONFIG_KMEMCHECK */ 101#endif /* CONFIG_KMEMCHECK */
79 102
80#endif /* LINUX_KMEMCHECK_H */ 103#endif /* LINUX_KMEMCHECK_H */