[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140910075722.GL6758@twins.programming.kicks-ass.net>
Date: Wed, 10 Sep 2014 09:57:22 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Andi Kleen <andi@...stfloor.org>
Cc: linux-kernel@...r.kernel.org, mingo@...nel.org, eranian@...gle.com,
tglx@...utronix.de, Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH] perf, x86: Fall back to vmalloc for BTS buffer allocation
On Tue, Sep 09, 2014 at 05:03:21PM -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@...ux.intel.com>
>
> On my workstation the order 4 BTS buffer allocation fails regularly
> after the system has been up for some time due to memory
> fragmentation.
>
> BTS is virtual memory, so we can just fall back to vmalloc
> instead of failing.
>
> Do this here.
>
> Signed-off-by: Andi Kleen <ak@...ux.intel.com>
> ---
> arch/x86/kernel/cpu/perf_event_intel_ds.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
> index 9dc4199..3cf5b74 100644
> --- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
> +++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
> @@ -312,8 +312,11 @@ static int alloc_bts_buffer(int cpu)
>
> buffer = kzalloc_node(BTS_BUFFER_SIZE, GFP_KERNEL | __GFP_NOWARN, node);
> if (unlikely(!buffer)) {
> - WARN_ONCE(1, "%s: BTS buffer allocation failure\n", __func__);
> - return -ENOMEM;
> + buffer = vmalloc_node(BTS_BUFFER_SIZE, node);
> + if (!buffer) {
> + WARN_ONCE(1, "%s: BTS buffer allocation failure\n", __func__);
> + return -ENOMEM;
> + }
> }
>
> max = BTS_BUFFER_SIZE / BTS_RECORD_SIZE;
We did this once, and that blew up big time.
Even now, vmalloc_fault() has a very explicit:
WARN_ON_ONCE(in_nmi());
So this isn't going to happen until you fix that.
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists