Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 255043
b: refs/heads/master
c: d6543e3
h: refs/heads/master
i:
  255041: fcc3363
  255039: 1888454
v: v3
  • Loading branch information
Ben Greear authored and Pekka Enberg committed Jul 7, 2011
1 parent ac5fc1e commit e9aacd1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 90810645f78f894acfb04b3768e8a7d45f2b303a
refs/heads/master: d6543e3935cec9f66b9647c24c2e44c68f8a91fd
32 changes: 32 additions & 0 deletions trunk/mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,12 @@ static LIST_HEAD(slab_caches);
/*
* Tracking user of a slab.
*/
#define TRACK_ADDRS_COUNT 16
struct track {
unsigned long addr; /* Called from address */
#ifdef CONFIG_STACKTRACE
unsigned long addrs[TRACK_ADDRS_COUNT]; /* Called from address */
#endif
int cpu; /* Was running on cpu */
int pid; /* Pid context */
unsigned long when; /* When did the operation occur */
Expand Down Expand Up @@ -420,6 +424,24 @@ static void set_track(struct kmem_cache *s, void *object,
struct track *p = get_track(s, object, alloc);

if (addr) {
#ifdef CONFIG_STACKTRACE
struct stack_trace trace;
int i;

trace.nr_entries = 0;
trace.max_entries = TRACK_ADDRS_COUNT;
trace.entries = p->addrs;
trace.skip = 3;
save_stack_trace(&trace);

/* See rant in lockdep.c */
if (trace.nr_entries != 0 &&
trace.entries[trace.nr_entries - 1] == ULONG_MAX)
trace.nr_entries--;

for (i = trace.nr_entries; i < TRACK_ADDRS_COUNT; i++)
p->addrs[i] = 0;
#endif
p->addr = addr;
p->cpu = smp_processor_id();
p->pid = current->pid;
Expand All @@ -444,6 +466,16 @@ static void print_track(const char *s, struct track *t)

printk(KERN_ERR "INFO: %s in %pS age=%lu cpu=%u pid=%d\n",
s, (void *)t->addr, jiffies - t->when, t->cpu, t->pid);
#ifdef CONFIG_STACKTRACE
{
int i;
for (i = 0; i < TRACK_ADDRS_COUNT; i++)
if (t->addrs[i])
printk(KERN_ERR "\t%pS\n", (void *)t->addrs[i]);
else
break;
}
#endif
}

static void print_tracking(struct kmem_cache *s, void *object)
Expand Down

0 comments on commit e9aacd1

Please sign in to comment.