summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2009-03-08 22:28:03 -0400
committerFrank Ch. Eigler <fche@elastic.org>2009-03-08 22:28:03 -0400
commitb1f85b93f4cdc5eaad45891399c30341d4d6ce93 (patch)
tree173eda2e74a4f2fc921e1a55bb4ea935af98254d
parent4be9af07213db548443da4ae7ed365e98ed2b29c (diff)
downloadsystemtap-steved-b1f85b93f4cdc5eaad45891399c30341d4d6ce93.tar.gz
systemtap-steved-b1f85b93f4cdc5eaad45891399c30341d4d6ce93.tar.xz
systemtap-steved-b1f85b93f4cdc5eaad45891399c30341d4d6ce93.zip
Adapt to linux-next commit changing __alloc_percpu API.
After linux-next commit f2a8205c, it takes two parameters again, so we autoconf for it rather than use KERNEL_VERSION ifdefs.
-rw-r--r--buildrun.cxx1
-rw-r--r--runtime/alloc.c25
-rw-r--r--runtime/autoconf-alloc-percpu-align.c6
3 files changed, 10 insertions, 22 deletions
diff --git a/buildrun.cxx b/buildrun.cxx
index 2685949d..b9d648ef 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -147,6 +147,7 @@ compile_pass (systemtap_session& s)
output_autoconf(s, o, "autoconf-task-uid.c", "STAPCONF_TASK_UID", NULL);
output_autoconf(s, o, "autoconf-vm-area.c", "STAPCONF_VM_AREA", NULL);
output_autoconf(s, o, "autoconf-procfs-owner.c", "STAPCONF_PROCFS_OWNER", NULL);
+ output_autoconf(s, o, "autoconf-alloc-percpu-align.c", "STAPCONF_ALLOC_PERCPU_ALIGN", NULL);
#if 0
/* NB: For now, the performance hit of probe_kernel_read/write (vs. our
diff --git a/runtime/alloc.c b/runtime/alloc.c
index 89d16612..439e8a7e 100644
--- a/runtime/alloc.c
+++ b/runtime/alloc.c
@@ -233,30 +233,14 @@ static void *_stp_vmalloc(unsigned long size)
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
static void *_stp_alloc_percpu(size_t size)
{
-#ifdef DEBUG_MEM
+#ifdef STAPCONF_ALLOC_PERCPU_ALIGN
void *ret = __alloc_percpu(size, 8);
- if (likely(ret)) {
- struct _stp_mem_entry *m = kmalloc(sizeof(struct _stp_mem_entry), STP_ALLOC_FLAGS);
- if (unlikely(m == NULL)) {
- free_percpu(ret);
- return NULL;
- }
- _stp_mem_debug_percpu(m, ret, size);
- _stp_allocated_memory += size * num_online_cpus();
- }
- return ret;
#else
- return __alloc_percpu(size, 8);
+ void *ret = __alloc_percpu(size);
#endif
-}
-#else
-static void *_stp_alloc_percpu(size_t size)
-{
#ifdef DEBUG_MEM
- void *ret = __alloc_percpu(size);
if (likely(ret)) {
struct _stp_mem_entry *m = kmalloc(sizeof(struct _stp_mem_entry), STP_ALLOC_FLAGS);
if (unlikely(m == NULL)) {
@@ -266,12 +250,9 @@ static void *_stp_alloc_percpu(size_t size)
_stp_mem_debug_percpu(m, ret, size);
_stp_allocated_memory += size * num_online_cpus();
}
- return ret;
-#else
- return __alloc_percpu(size);
#endif
+ return ret;
}
-#endif /* LINUX_VERSION_CODE */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
#define _stp_kmalloc_node(size,node) _stp_kmalloc(size)
diff --git a/runtime/autoconf-alloc-percpu-align.c b/runtime/autoconf-alloc-percpu-align.c
new file mode 100644
index 00000000..158d579c
--- /dev/null
+++ b/runtime/autoconf-alloc-percpu-align.c
@@ -0,0 +1,6 @@
+#include <linux/percpu.h>
+
+/* kernel commit f2a8205c */
+void foo (void) {
+ (void) __alloc_percpu(sizeof(int), 8);
+}