aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slob.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-04-01 15:54:19 -0400
committerIngo Molnar <mingo@elte.hu>2009-04-01 18:49:02 -0400
commit8302294f43250dc337108c51882a6007f2b1e2e0 (patch)
tree85acd4440799c46a372df9cad170fa0c21e59096 /mm/slob.c
parent4fe70410d9a219dabb47328effccae7e7f2a6e26 (diff)
parent2e572895bf3203e881356a4039ab0fa428ed2639 (diff)
Merge branch 'tracing/core-v2' into tracing-for-linus
Conflicts: include/linux/slub_def.h lib/Kconfig.debug mm/slob.c mm/slub.c
Diffstat (limited to 'mm/slob.c')
-rw-r--r--mm/slob.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/mm/slob.c b/mm/slob.c
index 7a3411524dac..4dd6516447f2 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -65,6 +65,7 @@
65#include <linux/module.h> 65#include <linux/module.h>
66#include <linux/rcupdate.h> 66#include <linux/rcupdate.h>
67#include <linux/list.h> 67#include <linux/list.h>
68#include <trace/kmemtrace.h>
68#include <asm/atomic.h> 69#include <asm/atomic.h>
69 70
70/* 71/*
@@ -474,6 +475,7 @@ void *__kmalloc_node(size_t size, gfp_t gfp, int node)
474{ 475{
475 unsigned int *m; 476 unsigned int *m;
476 int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN); 477 int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN);
478 void *ret;
477 479
478 lockdep_trace_alloc(gfp); 480 lockdep_trace_alloc(gfp);
479 481
@@ -482,12 +484,17 @@ void *__kmalloc_node(size_t size, gfp_t gfp, int node)
482 return ZERO_SIZE_PTR; 484 return ZERO_SIZE_PTR;
483 485
484 m = slob_alloc(size + align, gfp, align, node); 486 m = slob_alloc(size + align, gfp, align, node);
487
485 if (!m) 488 if (!m)
486 return NULL; 489 return NULL;
487 *m = size; 490 *m = size;
488 return (void *)m + align; 491 ret = (void *)m + align;
492
493 kmemtrace_mark_alloc_node(KMEMTRACE_TYPE_KMALLOC,
494 _RET_IP_, ret,
495 size, size + align, gfp, node);
489 } else { 496 } else {
490 void *ret; 497 unsigned int order = get_order(size);
491 498
492 ret = slob_new_pages(gfp | __GFP_COMP, get_order(size), node); 499 ret = slob_new_pages(gfp | __GFP_COMP, get_order(size), node);
493 if (ret) { 500 if (ret) {
@@ -495,8 +502,13 @@ void *__kmalloc_node(size_t size, gfp_t gfp, int node)
495 page = virt_to_page(ret); 502 page = virt_to_page(ret);
496 page->private = size; 503 page->private = size;
497 } 504 }
498 return ret; 505
506 kmemtrace_mark_alloc_node(KMEMTRACE_TYPE_KMALLOC,
507 _RET_IP_, ret,
508 size, PAGE_SIZE << order, gfp, node);
499 } 509 }
510
511 return ret;
500} 512}
501EXPORT_SYMBOL(__kmalloc_node); 513EXPORT_SYMBOL(__kmalloc_node);
502 514
@@ -514,6 +526,8 @@ void kfree(const void *block)
514 slob_free(m, *m + align); 526 slob_free(m, *m + align);
515 } else 527 } else
516 put_page(&sp->page); 528 put_page(&sp->page);
529
530 kmemtrace_mark_free(KMEMTRACE_TYPE_KMALLOC, _RET_IP_, block);
517} 531}
518EXPORT_SYMBOL(kfree); 532EXPORT_SYMBOL(kfree);
519 533
@@ -583,10 +597,19 @@ void *kmem_cache_alloc_node(struct kmem_cache *c, gfp_t flags, int node)
583{ 597{
584 void *b; 598 void *b;
585 599
586 if (c->size < PAGE_SIZE) 600 if (c->size < PAGE_SIZE) {
587 b = slob_alloc(c->size, flags, c->align, node); 601 b = slob_alloc(c->size, flags, c->align, node);
588 else 602 kmemtrace_mark_alloc_node(KMEMTRACE_TYPE_CACHE,
603 _RET_IP_, b, c->size,
604 SLOB_UNITS(c->size) * SLOB_UNIT,
605 flags, node);
606 } else {
589 b = slob_new_pages(flags, get_order(c->size), node); 607 b = slob_new_pages(flags, get_order(c->size), node);
608 kmemtrace_mark_alloc_node(KMEMTRACE_TYPE_CACHE,
609 _RET_IP_, b, c->size,
610 PAGE_SIZE << get_order(c->size),
611 flags, node);
612 }
590 613
591 if (c->ctor) 614 if (c->ctor)
592 c->ctor(b); 615 c->ctor(b);
@@ -622,6 +645,8 @@ void kmem_cache_free(struct kmem_cache *c, void *b)
622 } else { 645 } else {
623 __kmem_cache_free(b, c->size); 646 __kmem_cache_free(b, c->size);
624 } 647 }
648
649 kmemtrace_mark_free(KMEMTRACE_TYPE_CACHE, _RET_IP_, b);
625} 650}
626EXPORT_SYMBOL(kmem_cache_free); 651EXPORT_SYMBOL(kmem_cache_free);
627 652