1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * include/linux/kmemleak.h
5 * Copyright (C) 2008 ARM Limited
12 #include <linux/slab.h>
13 #include <linux/vmalloc.h>
15 #ifdef CONFIG_DEBUG_KMEMLEAK
17 extern void kmemleak_init(void) __init;
18 extern void kmemleak_alloc(const void *ptr, size_t size, int min_count,
20 extern void kmemleak_alloc_percpu(const void __percpu *ptr, size_t size,
22 extern void kmemleak_vmalloc(const struct vm_struct *area, size_t size,
24 extern void kmemleak_free(const void *ptr) __ref;
25 extern void kmemleak_free_part(const void *ptr, size_t size) __ref;
26 extern void kmemleak_free_percpu(const void __percpu *ptr) __ref;
27 extern void kmemleak_update_trace(const void *ptr) __ref;
28 extern void kmemleak_not_leak(const void *ptr) __ref;
29 extern void kmemleak_ignore(const void *ptr) __ref;
30 extern void kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp) __ref;
31 extern void kmemleak_no_scan(const void *ptr) __ref;
32 extern void kmemleak_alloc_phys(phys_addr_t phys, size_t size,
34 extern void kmemleak_free_part_phys(phys_addr_t phys, size_t size) __ref;
35 extern void kmemleak_ignore_phys(phys_addr_t phys) __ref;
37 static inline void kmemleak_alloc_recursive(const void *ptr, size_t size,
38 int min_count, slab_flags_t flags,
41 if (!(flags & SLAB_NOLEAKTRACE))
42 kmemleak_alloc(ptr, size, min_count, gfp);
45 static inline void kmemleak_free_recursive(const void *ptr, slab_flags_t flags)
47 if (!(flags & SLAB_NOLEAKTRACE))
51 static inline void kmemleak_erase(void **ptr)
58 static inline void kmemleak_init(void)
61 static inline void kmemleak_alloc(const void *ptr, size_t size, int min_count,
65 static inline void kmemleak_alloc_recursive(const void *ptr, size_t size,
66 int min_count, slab_flags_t flags,
70 static inline void kmemleak_alloc_percpu(const void __percpu *ptr, size_t size,
74 static inline void kmemleak_vmalloc(const struct vm_struct *area, size_t size,
78 static inline void kmemleak_free(const void *ptr)
81 static inline void kmemleak_free_part(const void *ptr, size_t size)
84 static inline void kmemleak_free_recursive(const void *ptr, slab_flags_t flags)
87 static inline void kmemleak_free_percpu(const void __percpu *ptr)
90 static inline void kmemleak_update_trace(const void *ptr)
93 static inline void kmemleak_not_leak(const void *ptr)
96 static inline void kmemleak_ignore(const void *ptr)
99 static inline void kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp)
102 static inline void kmemleak_erase(void **ptr)
105 static inline void kmemleak_no_scan(const void *ptr)
108 static inline void kmemleak_alloc_phys(phys_addr_t phys, size_t size,
112 static inline void kmemleak_free_part_phys(phys_addr_t phys, size_t size)
115 static inline void kmemleak_ignore_phys(phys_addr_t phys)
119 #endif /* CONFIG_DEBUG_KMEMLEAK */
121 #endif /* __KMEMLEAK_H */