Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1284300

Re: [PATCH 4/7] perf: Free aux pages in unmap path

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH 4/7] perf: Free aux pages in unmap path
Date 2015-12-04 23:20 +0100
Message-ID <qC6RP-bp-15@gated-at.bofh.it> (permalink)
References <qBzsR-3Jm-3@gated-at.bofh.it> <qBzsS-3Jm-31@gated-at.bofh.it> <qC21T-5zk-75@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Dec 04, 2015 at 06:02:06PM +0100, Peter Zijlstra wrote:
> The only solution I've come up with is:
> 
> 	struct rb_aux *aux = rb->aux;
> 
> 	if (aux && vma->vm_pgoff == aux->pgoff) {
> 		ctx = perf_event_ctx_lock(event);

Can't do this at all, see the comment in put_event(). perf_read_group()
accesses user memory (and hence causes faults, which in turn take
mmap_sem) while holding ctx::mutex.

So neither this, not what you proposed can work.

Will need moar thinking.

> 		if (!atomic_dec_and_mutex_lock(&aux->mmap_count, &event->mmap_mutex) {
> 			/* we now hold both ctx::mutex and event::mmap_mutex */
> 			rb->aux = NULL;
> 			ring_buffer_put(rb); /* aux had a reference */
> 			_perf_event_stop(event);
> 			ring_buffer_put_aux(aux); /* should be last */
> 			mutex_unlock(&event->mmap_mutex);
> 		}
> 		mutex_unlock(&ctx->mutex);
> 	}
> 
> 
--
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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4/7] perf: Free aux pages in unmap path Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2015-12-03 11:40 +0100
  Re: [PATCH 4/7] perf: Free aux pages in unmap path Peter Zijlstra <peterz@infradead.org> - 2015-12-04 18:10 +0100
    Re: [PATCH 4/7] perf: Free aux pages in unmap path Peter Zijlstra <peterz@infradead.org> - 2015-12-04 23:20 +0100
      Re: [PATCH 4/7] perf: Free aux pages in unmap path Peter Zijlstra <peterz@infradead.org> - 2015-12-07 17:20 +0100
    Re: [PATCH 4/7] perf: Free aux pages in unmap path Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2015-12-09 11:00 +0100
      Re: [PATCH 4/7] perf: Free aux pages in unmap path Peter Zijlstra <peterz@infradead.org> - 2015-12-09 12:00 +0100
        Re: [PATCH 4/7] perf: Free aux pages in unmap path Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2015-12-10 12:30 +0100
          Re: [PATCH 4/7] perf: Free aux pages in unmap path Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2015-12-10 14:10 +0100

csiph-web