[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1410307401-12401-1-git-send-email-andi@firstfloor.org>
Date: Tue, 9 Sep 2014 17:03:21 -0700
From: Andi Kleen <andi@...stfloor.org>
To: peterz@...radead.org
Cc: linux-kernel@...r.kernel.org, mingo@...nel.org, eranian@...gle.com,
tglx@...utronix.de, Andi Kleen <ak@...ux.intel.com>
Subject: [PATCH] perf, x86: Fall back to vmalloc for BTS buffer allocation
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;
@@ -336,7 +339,7 @@ static void release_bts_buffer(int cpu)
if (!ds || !x86_pmu.bts)
return;
- kfree((void *)(unsigned long)ds->bts_buffer_base);
+ kvfree((void *)(unsigned long)ds->bts_buffer_base);
ds->bts_buffer_base = 0;
}
--
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists