Skip to content

Commit

Permalink
perfcounters: fix refcounting bug
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mike Galbraith authored and Ingo Molnar committed Jan 29, 2009
1 parent bb3f0b5 commit 65d3708
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kernel/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/*
Expand Down

0 comments on commit 65d3708

Please sign in to comment.