aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/slab.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/slab.h b/include/linux/slab.h
index c4947b8a2c03..66c4640d3656 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -236,7 +236,25 @@ found:
236 } 236 }
237 return __kmalloc_node(size, flags, node); 237 return __kmalloc_node(size, flags, node);
238} 238}
239
240/*
241 * kmalloc_node_track_caller is a special version of kmalloc_node that
242 * records the calling function of the routine calling it for slab leak
243 * tracking instead of just the calling function (confusing, eh?).
244 * It's useful when the call to kmalloc_node comes from a widely-used
245 * standard allocator where we care about the real place the memory
246 * allocation request comes from.
247 */
248#ifndef CONFIG_DEBUG_SLAB
249#define kmalloc_node_track_caller(size, flags, node) \
250 __kmalloc_node(size, flags, node)
239#else 251#else
252extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, void *);
253#define kmalloc_node_track_caller(size, flags, node) \
254 __kmalloc_node_track_caller(size, flags, node, \
255 __builtin_return_address(0))
256#endif
257#else /* CONFIG_NUMA */
240static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int node) 258static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int node)
241{ 259{
242 return kmem_cache_alloc(cachep, flags); 260 return kmem_cache_alloc(cachep, flags);
@@ -245,6 +263,9 @@ static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
245{ 263{
246 return kmalloc(size, flags); 264 return kmalloc(size, flags);
247} 265}
266
267#define kmalloc_node_track_caller(size, flags, node) \
268 kmalloc_track_caller(size, flags)
248#endif 269#endif
249 270
250extern int FASTCALL(kmem_cache_reap(int)); 271extern int FASTCALL(kmem_cache_reap(int));
@@ -283,6 +304,8 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
283#define kzalloc(s, f) __kzalloc(s, f) 304#define kzalloc(s, f) __kzalloc(s, f)
284#define kmalloc_track_caller kmalloc 305#define kmalloc_track_caller kmalloc
285 306
307#define kmalloc_node_track_caller kmalloc_node
308
286#endif /* CONFIG_SLOB */ 309#endif /* CONFIG_SLOB */
287 310
288/* System wide caches */ 311/* System wide caches */