summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Galbraith <efault@gmx.de>2009-01-29 14:06:52 +0100
committerIngo Molnar <mingo@elte.hu>2009-01-29 14:25:23 +0100
commit65d370862f64973611a271ced61864b5f9bb6fc0 (patch)
tree353d54eefd2f014e3b7ae79c572ad0a0493f2403
parentbb3f0b59ad005d2d2ecbbe9bd048eab6d1ecbd31 (diff)
perfcounters: fix refcounting bug
don't kfree in use counters. Running... while true; do perfstat -e 1 -c true; done ...on all cores for a while doesn't seem to be eating ram, and my oops is gone. Signed-off-by: Mike Galbraith <efault@gmx.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--kernel/perf_counter.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 1ac18daa424..f27a7e9f3c4 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1934,7 +1934,8 @@ __perf_counter_exit_task(struct task_struct *child,
}
}
- kfree(child_counter);
+ if (!child_counter->filp || !atomic_long_read(&child_counter->filp->f_count))
+ kfree(child_counter);
}
/*