aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/perf_counter.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 99d5930f0a52..97f891ffeb40 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1150,6 +1150,11 @@ static void free_counter_rcu(struct rcu_head *head)
1150 kfree(counter); 1150 kfree(counter);
1151} 1151}
1152 1152
1153static void free_counter(struct perf_counter *counter)
1154{
1155 call_rcu(&counter->rcu_head, free_counter_rcu);
1156}
1157
1153/* 1158/*
1154 * Called when the last reference to the file is gone. 1159 * Called when the last reference to the file is gone.
1155 */ 1160 */
@@ -1168,7 +1173,7 @@ static int perf_release(struct inode *inode, struct file *file)
1168 mutex_unlock(&counter->mutex); 1173 mutex_unlock(&counter->mutex);
1169 mutex_unlock(&ctx->mutex); 1174 mutex_unlock(&ctx->mutex);
1170 1175
1171 call_rcu(&counter->rcu_head, free_counter_rcu); 1176 free_counter(counter);
1172 put_context(ctx); 1177 put_context(ctx);
1173 1178
1174 return 0; 1179 return 0;
@@ -2128,10 +2133,10 @@ __perf_counter_exit_task(struct task_struct *child,
2128 list_entry) { 2133 list_entry) {
2129 if (sub->parent) { 2134 if (sub->parent) {
2130 sync_child_counter(sub, sub->parent); 2135 sync_child_counter(sub, sub->parent);
2131 kfree(sub); 2136 free_counter(sub);
2132 } 2137 }
2133 } 2138 }
2134 kfree(child_counter); 2139 free_counter(child_counter);
2135 } 2140 }
2136} 2141}
2137 2142