From: Frank Ch. Eigler Date: Wed, 21 May 2014 17:43:48 +0000 (-0400) Subject: linux runtime: switch to vmalloc for context[] element allocation X-Git-Tag: release-2.6~107^2~43 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=681120bbf7f233317c9372e3c43abdde7b31e22c;p=systemtap.git linux runtime: switch to vmalloc for context[] element allocation 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. --- diff --git a/runtime/linux/runtime_context.h b/runtime/linux/runtime_context.h index 4789bfbde..a23638143 100644 --- a/runtime/linux/runtime_context.h +++ b/runtime/linux/runtime_context.h @@ -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; } }