diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2009-12-01 15:05:01 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-12-02 03:30:18 -0500 |
commit | ec70ccd806111ba3caf596def91a8580138b12db (patch) | |
tree | e497d38d9f75a684475f32678efe8ffb22457c34 /kernel | |
parent | bdad0db7dbdb37d0bb3c7d0f65cd3ff599ea6ecb (diff) |
perf: Don't free perf_mmap_data until work has been done
In the CONFIG_PERF_USE_VMALLOC case, perf_mmap_data_free() only
schedules the cleanup of the perf_mmap_data struct. In that
case we have to wait until the work has been done before we free
data.
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Cc: David S. Miller <davem@davemloft.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: <stable@kernel.org>
LKML-Reference: <1259697901-1747-1-git-send-email-krh@bitplanet.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/perf_event.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 040ee517c808..6b7ddba1dd64 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -2210,6 +2210,7 @@ static void perf_mmap_data_free(struct perf_mmap_data *data) | |||
2210 | perf_mmap_free_page((unsigned long)data->user_page); | 2210 | perf_mmap_free_page((unsigned long)data->user_page); |
2211 | for (i = 0; i < data->nr_pages; i++) | 2211 | for (i = 0; i < data->nr_pages; i++) |
2212 | perf_mmap_free_page((unsigned long)data->data_pages[i]); | 2212 | perf_mmap_free_page((unsigned long)data->data_pages[i]); |
2213 | kfree(data); | ||
2213 | } | 2214 | } |
2214 | 2215 | ||
2215 | #else | 2216 | #else |
@@ -2250,6 +2251,7 @@ static void perf_mmap_data_free_work(struct work_struct *work) | |||
2250 | perf_mmap_unmark_page(base + (i * PAGE_SIZE)); | 2251 | perf_mmap_unmark_page(base + (i * PAGE_SIZE)); |
2251 | 2252 | ||
2252 | vfree(base); | 2253 | vfree(base); |
2254 | kfree(data); | ||
2253 | } | 2255 | } |
2254 | 2256 | ||
2255 | static void perf_mmap_data_free(struct perf_mmap_data *data) | 2257 | static void perf_mmap_data_free(struct perf_mmap_data *data) |
@@ -2355,7 +2357,6 @@ static void perf_mmap_data_free_rcu(struct rcu_head *rcu_head) | |||
2355 | 2357 | ||
2356 | data = container_of(rcu_head, struct perf_mmap_data, rcu_head); | 2358 | data = container_of(rcu_head, struct perf_mmap_data, rcu_head); |
2357 | perf_mmap_data_free(data); | 2359 | perf_mmap_data_free(data); |
2358 | kfree(data); | ||
2359 | } | 2360 | } |
2360 | 2361 | ||
2361 | static void perf_mmap_data_release(struct perf_event *event) | 2362 | static void perf_mmap_data_release(struct perf_event *event) |