Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1288640
| From | Alexander Shishkin <alexander.shishkin@linux.intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v1 1/5] perf: Refuse to begin aux transaction after aux_mmap_count drops |
| Date | 2015-12-10 17:20 +0100 |
| Message-ID | <qEc6L-5i-37@gated-at.bofh.it> (permalink) |
| References | <qEc6K-5i-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
When ring buffer's aux area is unmapped and aux_mmap_count drops to zero, new aux transactions into this buffer can still be started, even though the buffer in en route to deallocation. This patch adds a check to perf_aux_output_begin() for aux_mmap_count being zero, in which case there is no point starting new transactions, in other words, the ring buffers that pass a certain point in perf_mmap_close will not have their events sending new data, which clears path for freeing those buffers' pages right there and then, provided that no active transactions are holding the aux reference. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> --- kernel/events/ring_buffer.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index adfdc05361..5709cc222f 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c @@ -288,6 +288,13 @@ void *perf_aux_output_begin(struct perf_output_handle *handle, goto err; /* + * If rb::aux_mmap_count is zero (and rb_has_aux() above went through), + * the aux buffer is in perf_mmap_close(), about to get free'd. + */ + if (!atomic_read(&rb->aux_mmap_count)) + goto err; + + /* * Nesting is not supported for AUX area, make sure nested * writers are caught early */ -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v1 0/5] perf: Untangle aux refcounting Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2015-12-10 17:20 +0100 [PATCH v1 4/5] perf/x86/intel/pt: Move transaction start/stop to pmu start/stop callbacks Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2015-12-10 17:20 +0100 [PATCH v1 3/5] perf: Document aux api usage Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2015-12-10 17:20 +0100 [PATCH v1 1/5] perf: Refuse to begin aux transaction after aux_mmap_count drops Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2015-12-10 17:20 +0100 [PATCH v1 2/5] perf: Free aux pages in unmap path Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2015-12-10 17:30 +0100 [PATCH v1 5/5] perf/x86/intel/bts: Move transaction start/stop to start/stop callbacks Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2015-12-10 17:30 +0100
csiph-web