]> sourceware.org Git - systemtap.git/commitdiff
2007-01-30 Martin Hunt <hunt@redhat.com>
authorhunt <hunt>
Tue, 30 Jan 2007 17:13:46 +0000 (17:13 +0000)
committerhunt <hunt>
Tue, 30 Jan 2007 17:13:46 +0000 (17:13 +0000)
* alloc.c (_stp_alloc_percpu):  Don't implement
our own; just call __alloc_percpu with appropriate args
for the OS version.
(_stp_free_percpu): Delete.
* map.c (_stp_map_init): When calling kmalloc_node, first
call cpu_to_node() to get the proper node number.
* stat.c (_stp_stat_del): Call free_percpu()
instead of _stp_free_percpu().

runtime/ChangeLog
runtime/alloc.c
runtime/map.c
runtime/stat.c

index 4bb6984c166eed3fecd4a3bd39ee789116269ccb..30acf19a29b08a90a5ec4743ebff0c685e9bb91d 100644 (file)
@@ -1,3 +1,14 @@
+2007-01-30  Martin Hunt  <hunt@redhat.com>
+
+       * alloc.c (_stp_alloc_percpu):  Don't implement
+       our own; just call __alloc_percpu with appropriate args
+       for the OS version.
+       (_stp_free_percpu): Delete.
+       * map.c (_stp_map_init): When calling kmalloc_node, first 
+       call cpu_to_node() to get the proper node number.
+       * stat.c (_stp_stat_del): Call free_percpu()
+       instead of _stp_free_percpu().
+       
 2007-01-29  Martin Hunt  <hunt@redhat.com>
 
        * alloc.c (_stp_kmalloc): New function. Call kmalloc
index fe2c84e038983acdc778503f40daf026bc599a53..8f2a7451ebdb4f214805925ec8da97a4a6569e53 100644 (file)
@@ -52,76 +52,14 @@ static void *_stp_vmalloc(unsigned long size)
        return ret;
 }
 
-/* This file exists because all the NUMA-compatible allocators keep
-   changing in 2.6 */
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
-#define kmalloc_node(size,flags,node) kmalloc(size,flags)
-#endif /* LINUX_VERSION_CODE */
-
-#ifdef CONFIG_SMP
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
 #define _stp_alloc_percpu(size) __alloc_percpu(size, 8)
-#define _stp_free_percpu(ptr) free_percpu(ptr)
-#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) */
-
-/* This is like alloc_percpu() except it simply takes a size, instead of a type. */
-void *_stp_alloc_percpu(size_t size)
-{
-       int i;
-       struct percpu_data *pdata = kmalloc(sizeof (*pdata), STP_ALLOC_FLAGS);
-
-       if (!pdata)
-               return NULL;
-
-       for_each_cpu(i) {
-               int node = cpu_to_node(i);
-
-               if (node_online(node))
-                       pdata->ptrs[i] = kmalloc_node(size, STP_ALLOC_FLAGS, node);
-               else
-                       pdata->ptrs[i] = kmalloc(size, STP_ALLOC_FLAGS);
-
-               if (!pdata->ptrs[i])
-                       goto unwind_oom;
-
-               _stp_allocated_memory += size;
-               memset(pdata->ptrs[i], 0, size);
-       }
-
-       /* Catch derefs w/o wrappers */
-       return (void *) (~(unsigned long) pdata);
-
-unwind_oom:
-       while (--i >= 0) {
-               if (!cpu_possible(i))
-                       continue;
-               kfree(pdata->ptrs[i]);
-       }
-       kfree(pdata);
-       return NULL;
-}
-
-void _stp_free_percpu(const void *objp)
-{
-       int i;
-       struct percpu_data *p = (struct percpu_data *) (~(unsigned long) objp);
+#else
+#define _stp_alloc_percpu(size) __alloc_percpu(size)
+#endif
 
-       for_each_cpu(i)
-               kfree(p->ptrs[i]);
-       kfree(p);
-}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
+#define kmalloc_node(size,flags,node) kmalloc(size,flags)
 #endif /* LINUX_VERSION_CODE */
 
-#else /* CONFIG_SMP */
-#define _stp_free_percpu(ptr) kfree(ptr)
-void *_stp_alloc_percpu(size_t size)
-{
-        void *ret = kmalloc(size, STP_ALLOC_FLAGS);
-        if (ret)
-                memset(ret, 0, size);
-        return ret;
-}
-#endif /* CONFIG_SMP */
-
 #endif /* _ALLOC_C_ */
index 86a1b2702c873ed0b39b7c2e5aeea578dcf7b09f..9fc414a77f0a45f75c3331c6f9a164a17294f458 100644 (file)
@@ -207,7 +207,7 @@ static int _stp_map_init(MAP m, unsigned max_entries, int type, int key_size, in
                        if (cpu < 0)
                                tmp = kmalloc(size, STP_ALLOC_FLAGS);
                        else
-                               tmp = kmalloc_node(size, STP_ALLOC_FLAGS, cpu);
+                               tmp = kmalloc_node(size, STP_ALLOC_FLAGS, cpu_to_node(cpu));
                
                        if (!tmp)
                                return -1;
index e00b82201e2f665b47b09db82a702ef3f2b222dd..98a283cf005db456b0f0275365857fa6392779a2 100644 (file)
@@ -143,7 +143,7 @@ exit1:
 void _stp_stat_del (Stat st)
 {
        if (st) {
-               _stp_free_percpu (st->sd);
+               free_percpu (st->sd);
                kfree (st->agg);
                kfree (st);
        }
This page took 0.03267 seconds and 5 git commands to generate.