aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/slub.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/mm/slub.c b/mm/slub.c
index 4c48a0146afd..4ce61c86f581 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3256,6 +3256,7 @@ static struct notifier_block __cpuinitdata slab_notifier = {
3256void *__kmalloc_track_caller(size_t size, gfp_t gfpflags, unsigned long caller) 3256void *__kmalloc_track_caller(size_t size, gfp_t gfpflags, unsigned long caller)
3257{ 3257{
3258 struct kmem_cache *s; 3258 struct kmem_cache *s;
3259 void *ret;
3259 3260
3260 if (unlikely(size > PAGE_SIZE)) 3261 if (unlikely(size > PAGE_SIZE))
3261 return kmalloc_large(size, gfpflags); 3262 return kmalloc_large(size, gfpflags);
@@ -3265,13 +3266,20 @@ void *__kmalloc_track_caller(size_t size, gfp_t gfpflags, unsigned long caller)
3265 if (unlikely(ZERO_OR_NULL_PTR(s))) 3266 if (unlikely(ZERO_OR_NULL_PTR(s)))
3266 return s; 3267 return s;
3267 3268
3268 return slab_alloc(s, gfpflags, -1, caller); 3269 ret = slab_alloc(s, gfpflags, -1, caller);
3270
3271 /* Honor the call site pointer we recieved. */
3272 kmemtrace_mark_alloc(KMEMTRACE_TYPE_KMALLOC, (unsigned long) caller,
3273 ret, size, s->size, gfpflags);
3274
3275 return ret;
3269} 3276}
3270 3277
3271void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags, 3278void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags,
3272 int node, unsigned long caller) 3279 int node, unsigned long caller)
3273{ 3280{
3274 struct kmem_cache *s; 3281 struct kmem_cache *s;
3282 void *ret;
3275 3283
3276 if (unlikely(size > PAGE_SIZE)) 3284 if (unlikely(size > PAGE_SIZE))
3277 return kmalloc_large_node(size, gfpflags, node); 3285 return kmalloc_large_node(size, gfpflags, node);
@@ -3281,7 +3289,14 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags,
3281 if (unlikely(ZERO_OR_NULL_PTR(s))) 3289 if (unlikely(ZERO_OR_NULL_PTR(s)))
3282 return s; 3290 return s;
3283 3291
3284 return slab_alloc(s, gfpflags, node, caller); 3292 ret = slab_alloc(s, gfpflags, node, caller);
3293
3294 /* Honor the call site pointer we recieved. */
3295 kmemtrace_mark_alloc_node(KMEMTRACE_TYPE_KMALLOC,
3296 (unsigned long) caller, ret,
3297 size, s->size, gfpflags, node);
3298
3299 return ret;
3285} 3300}
3286 3301
3287#ifdef CONFIG_SLUB_DEBUG 3302#ifdef CONFIG_SLUB_DEBUG