Re: [PATCH] perf_events: improve DS/BTS/PEBS buffer allocation

Peter Zijlstra
2010-09-13T18:58:08Z

On Mon, 2010-09-13 at 20:49 +0200, Stephane Eranian wrote:
> On Mon, Sep 13, 2010 at 8:42 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> > On Mon, 2010-09-13 at 20:40 +0200, Stephane Eranian wrote:
> >> Ok, so can we play the same trick you're playing with the sampling
> >> buffer, i.e., you use alloc_pages_node() for one page at a time, and
> >> then you stitch them on demand via SW?
> >
> > Not for BTS, it wants a linear range, getting the vmalloc vs NMI thing
> > sorted would be best I think.
> >
> What is annoying in this is that you run into the problem even though
> you may not be using BTS nor PEBS.

Yes, one thing we could do is simply disable BTS when we fail that
alloc, instead of fail everything.

> What mitigates the problem, I think, is the NMI watchdog. It is the first
> user of perf_events. As such, the BTS and PEBS buffers get allocated
> during kernel initialization thereby increasing the chances of finding
> contiguous chunks of memory. What would partly help would be to use of
> kmalloc_node() to at least balance allocations amongst the various NUMA
> nodes. That would be until the vmalloc() vs. NMI is sorted out.

Right, that would be a simple change to make.