aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slub.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/slub.c')
-rw-r--r--mm/slub.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/mm/slub.c b/mm/slub.c
index 7be0223531b0..c9050995bc87 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -191,8 +191,12 @@ static LIST_HEAD(slab_caches);
191/* 191/*
192 * Tracking user of a slab. 192 * Tracking user of a slab.
193 */ 193 */
194#define TRACK_ADDRS_COUNT 16
194struct track { 195struct track {
195 unsigned long addr; /* Called from address */ 196 unsigned long addr; /* Called from address */
197#ifdef CONFIG_STACKTRACE
198 unsigned long addrs[TRACK_ADDRS_COUNT]; /* Called from address */
199#endif
196 int cpu; /* Was running on cpu */ 200 int cpu; /* Was running on cpu */
197 int pid; /* Pid context */ 201 int pid; /* Pid context */
198 unsigned long when; /* When did the operation occur */ 202 unsigned long when; /* When did the operation occur */
@@ -420,6 +424,24 @@ static void set_track(struct kmem_cache *s, void *object,
420 struct track *p = get_track(s, object, alloc); 424 struct track *p = get_track(s, object, alloc);
421 425
422 if (addr) { 426 if (addr) {
427#ifdef CONFIG_STACKTRACE
428 struct stack_trace trace;
429 int i;
430
431 trace.nr_entries = 0;
432 trace.max_entries = TRACK_ADDRS_COUNT;
433 trace.entries = p->addrs;
434 trace.skip = 3;
435 save_stack_trace(&trace);
436
437 /* See rant in lockdep.c */
438 if (trace.nr_entries != 0 &&
439 trace.entries[trace.nr_entries - 1] == ULONG_MAX)
440 trace.nr_entries--;
441
442 for (i = trace.nr_entries; i < TRACK_ADDRS_COUNT; i++)
443 p->addrs[i] = 0;
444#endif
423 p->addr = addr; 445 p->addr = addr;
424 p->cpu = smp_processor_id(); 446 p->cpu = smp_processor_id();
425 p->pid = current->pid; 447 p->pid = current->pid;
@@ -444,6 +466,16 @@ static void print_track(const char *s, struct track *t)
444 466
445 printk(KERN_ERR "INFO: %s in %pS age=%lu cpu=%u pid=%d\n", 467 printk(KERN_ERR "INFO: %s in %pS age=%lu cpu=%u pid=%d\n",
446 s, (void *)t->addr, jiffies - t->when, t->cpu, t->pid); 468 s, (void *)t->addr, jiffies - t->when, t->cpu, t->pid);
469#ifdef CONFIG_STACKTRACE
470 {
471 int i;
472 for (i = 0; i < TRACK_ADDRS_COUNT; i++)
473 if (t->addrs[i])
474 printk(KERN_ERR "\t%pS\n", (void *)t->addrs[i]);
475 else
476 break;
477 }
478#endif
447} 479}
448 480
449static void print_tracking(struct kmem_cache *s, void *object) 481static void print_tracking(struct kmem_cache *s, void *object)