Re: [RFC PATCH 1/6] perf: Move mlock accounting to ring buffer allocation

2016-09-26 Thread Alexander Shishkin
Peter Zijlstra writes: > On Mon, Sep 26, 2016 at 11:27:08AM +0300, Alexander Shishkin wrote: >> Peter Zijlstra writes: >> >> > Well, we could 'force' inject a VMA into the process's address space, we >> > do that for a few other things as well. It also makes for less >> > exceptions with the ac

Re: [RFC PATCH 1/6] perf: Move mlock accounting to ring buffer allocation

2016-09-26 Thread Alexander Shishkin
Peter Zijlstra writes: > On Mon, Sep 26, 2016 at 11:27:08AM +0300, Alexander Shishkin wrote: >> Peter Zijlstra writes: >> > At which point we _should_ start failing fork(), which is a somewhat >> > unexpected, and undesirable side-effect. >> >> I'm not sure I see why we should fail fork() when

Re: [RFC PATCH 1/6] perf: Move mlock accounting to ring buffer allocation

2016-09-26 Thread Peter Zijlstra
On Mon, Sep 26, 2016 at 11:27:08AM +0300, Alexander Shishkin wrote: > Peter Zijlstra writes: > > > Well, we could 'force' inject a VMA into the process's address space, we > > do that for a few other things as well. It also makes for less > > exceptions with the actual core dumping. > > Threads

Re: [RFC PATCH 1/6] perf: Move mlock accounting to ring buffer allocation

2016-09-26 Thread Alexander Shishkin
Peter Zijlstra writes: > Well, we could 'force' inject a VMA into the process's address space, we > do that for a few other things as well. It also makes for less > exceptions with the actual core dumping. Threads then will end up with the same buffer (through sharing the mm), but they can't rea

Re: [RFC PATCH 1/6] perf: Move mlock accounting to ring buffer allocation

2016-09-23 Thread Peter Zijlstra
On Fri, Sep 23, 2016 at 10:26:15AM -0700, Andi Kleen wrote: > > Afaict there's no actual need to hide the AUX buffer for this sampling > > stuff; the user knows about all this and can simply mmap() the AUX part. > > The sample could either point to locations in the AUX buffer, or (as I > > think th

Re: [RFC PATCH 1/6] perf: Move mlock accounting to ring buffer allocation

2016-09-23 Thread Andi Kleen
> Afaict there's no actual need to hide the AUX buffer for this sampling > stuff; the user knows about all this and can simply mmap() the AUX part. > The sample could either point to locations in the AUX buffer, or (as I > think this code does) memcpy bits out. This would work for perf, but not fo

Re: [RFC PATCH 1/6] perf: Move mlock accounting to ring buffer allocation

2016-09-23 Thread Alexander Shishkin
Peter Zijlstra writes: > On Fri, Sep 23, 2016 at 05:27:22PM +0300, Alexander Shishkin wrote: >> > Afaict there's no actual need to hide the AUX buffer for this sampling >> > stuff; the user knows about all this and can simply mmap() the AUX part. >> >> Yes, you're right here. We could also re-us

Re: [RFC PATCH 1/6] perf: Move mlock accounting to ring buffer allocation

2016-09-23 Thread Peter Zijlstra
On Fri, Sep 23, 2016 at 05:27:22PM +0300, Alexander Shishkin wrote: > > Afaict there's no actual need to hide the AUX buffer for this sampling > > stuff; the user knows about all this and can simply mmap() the AUX part. > > Yes, you're right here. We could also re-use the AUX record, adding a > ne

Re: [RFC PATCH 1/6] perf: Move mlock accounting to ring buffer allocation

2016-09-23 Thread Alexander Shishkin
Peter Zijlstra writes: > On Fri, Sep 23, 2016 at 02:27:21PM +0300, Alexander Shishkin wrote: >> In order to be able to allocate perf ring buffers in non-mmap path, we >> need to make sure we can still account the memory to the user and that >> they don't exceed their mlock limit. >> >> This patc

Re: [RFC PATCH 1/6] perf: Move mlock accounting to ring buffer allocation

2016-09-23 Thread Peter Zijlstra
On Fri, Sep 23, 2016 at 02:27:21PM +0300, Alexander Shishkin wrote: > In order to be able to allocate perf ring buffers in non-mmap path, we > need to make sure we can still account the memory to the user and that > they don't exceed their mlock limit. > > This patch moves ring buffer memory accou

[RFC PATCH 1/6] perf: Move mlock accounting to ring buffer allocation

2016-09-23 Thread Alexander Shishkin
In order to be able to allocate perf ring buffers in non-mmap path, we need to make sure we can still account the memory to the user and that they don't exceed their mlock limit. This patch moves ring buffer memory accounting down the rb_alloc() path so that its callers won't have to worry about i