diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2010-05-27 06:54:41 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-05-31 02:46:08 -0400 |
commit | ac9721f3f54b27a16c7e1afb2481e7ee95a70318 (patch) | |
tree | a9f21d60c7c4c1910696553a6f8273edcca03c64 /include/linux/perf_event.h | |
parent | 67a3e12b05e055c0415c556a315a3d3eb637e29e (diff) |
perf_events: Fix races and clean up perf_event and perf_mmap_data interaction
In order to move toward separate buffer objects, rework the whole
perf_mmap_data construct to be a more self-sufficient entity, one
with its own lifetime rules.
This greatly sanitizes the whole output redirection code, which
was riddled with bugs and races.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: <stable@kernel.org>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/perf_event.h')
-rw-r--r-- | include/linux/perf_event.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index fb6c91eac7e3..490698590d6e 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -585,6 +585,7 @@ enum perf_event_active_state { | |||
585 | struct file; | 585 | struct file; |
586 | 586 | ||
587 | struct perf_mmap_data { | 587 | struct perf_mmap_data { |
588 | atomic_t refcount; | ||
588 | struct rcu_head rcu_head; | 589 | struct rcu_head rcu_head; |
589 | #ifdef CONFIG_PERF_USE_VMALLOC | 590 | #ifdef CONFIG_PERF_USE_VMALLOC |
590 | struct work_struct work; | 591 | struct work_struct work; |
@@ -592,7 +593,6 @@ struct perf_mmap_data { | |||
592 | #endif | 593 | #endif |
593 | int nr_pages; /* nr of data pages */ | 594 | int nr_pages; /* nr of data pages */ |
594 | int writable; /* are we writable */ | 595 | int writable; /* are we writable */ |
595 | int nr_locked; /* nr pages mlocked */ | ||
596 | 596 | ||
597 | atomic_t poll; /* POLL_ for wakeups */ | 597 | atomic_t poll; /* POLL_ for wakeups */ |
598 | 598 | ||
@@ -643,7 +643,6 @@ struct perf_event { | |||
643 | int nr_siblings; | 643 | int nr_siblings; |
644 | int group_flags; | 644 | int group_flags; |
645 | struct perf_event *group_leader; | 645 | struct perf_event *group_leader; |
646 | struct perf_event *output; | ||
647 | const struct pmu *pmu; | 646 | const struct pmu *pmu; |
648 | 647 | ||
649 | enum perf_event_active_state state; | 648 | enum perf_event_active_state state; |
@@ -704,6 +703,8 @@ struct perf_event { | |||
704 | /* mmap bits */ | 703 | /* mmap bits */ |
705 | struct mutex mmap_mutex; | 704 | struct mutex mmap_mutex; |
706 | atomic_t mmap_count; | 705 | atomic_t mmap_count; |
706 | int mmap_locked; | ||
707 | struct user_struct *mmap_user; | ||
707 | struct perf_mmap_data *data; | 708 | struct perf_mmap_data *data; |
708 | 709 | ||
709 | /* poll related */ | 710 | /* poll related */ |