]> sourceware.org Git - systemtap.git/commitdiff
linux runtime: switch to vmalloc for context[] element allocation
authorFrank Ch. Eigler <fche@redhat.com>
Wed, 21 May 2014 17:43:48 +0000 (13:43 -0400)
committerFrank Ch. Eigler <fche@redhat.com>
Wed, 21 May 2014 17:43:48 +0000 (13:43 -0400)
The new eventcount.stp changes can result in relatively large context
structures (33712 bytes each on f19/x86-64), which the stp_kmalloc
widget can sometimes fail to allocate.  Switching to the numa-aware
vmalloc front-end lets these allocations succeed.

TBD: those contexts shouldn't be that large.

runtime/linux/runtime_context.h

index 4789bfbdef9585c67b628ed37327f035567a4718..a236381431dca0a5a9f56edb17c6359ccffd1c1a 100644 (file)
@@ -20,10 +20,10 @@ static int _stp_runtime_contexts_alloc(void)
        for_each_possible_cpu(cpu) {
                /* Module init, so in user context, safe to use
                 * "sleeping" allocation. */
-               contexts[cpu] = _stp_kzalloc_gfp(sizeof(struct context),
-                                                STP_ALLOC_SLEEP_FLAGS);
+                contexts[cpu] = _stp_vzalloc_node(sizeof (struct context),
+                                                  cpu_to_node(cpu));
                if (contexts[cpu] == NULL) {
-                       _stp_error ("context (size %lu) allocation failed",
+                       _stp_error ("context (size %lu per cpu) allocation failed",
                                    (unsigned long) sizeof (struct context));
                        return -ENOMEM;
                }
@@ -37,7 +37,7 @@ static void _stp_runtime_contexts_free(void)
 
        for_each_possible_cpu(cpu) {
                if (contexts[cpu] != NULL) {
-                       _stp_kfree(contexts[cpu]);
+                       _stp_vfree(contexts[cpu]);
                        contexts[cpu] = NULL;
                }
        }
This page took 0.03175 seconds and 5 git commands to generate.