|
Message-Id: <1486136013-27565-1-git-send-email-hoeun.ryu@gmail.com> Date: Sat, 4 Feb 2017 00:33:21 +0900 From: Hoeun Ryu <hoeun.ryu@...il.com> To: Andrew Morton <akpm@...ux-foundation.org>, Michal Hocko <mhocko@...e.com>, Ingo Molnar <mingo@...nel.org>, Andy Lutomirski <luto@...nel.org>, Kees Cook <keescook@...omium.org>, "Eric W. Biederman" <ebiederm@...ssion.com>, Mateusz Guzik <mguzik@...hat.com> Cc: linux-kernel@...r.kernel.org, kernel-hardening@...ts.openwall.com, Hoeun Ryu <hoeun.ryu@...il.com> Subject: [PATCH 3/3] fork: allocate vmapped kernel stacks for cache when a cpu is up when a cpu is up, predefined number of stacks are allocated and cached immediately. Signed-off-by: Hoeun Ryu <hoeun.ryu@...il.com> --- kernel/fork.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/kernel/fork.c b/kernel/fork.c index 50de6cf..ee4067d 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -194,6 +194,21 @@ static int alloc_vm_stack_cache(unsigned int cpu) vm_stack_cache->cur = 0; vm_stack_cache->nr = 0; + for (i = 0; i < NR_CACHED_STACKS; i++) { + void *stack = __vmalloc_node_range(THREAD_SIZE, THREAD_SIZE, + VMALLOC_START, VMALLOC_END, + THREADINFO_GFP | __GFP_HIGHMEM, + PAGE_KERNEL, + 0, cpu_to_node(cpu), + __builtin_return_address(0)); + if (!stack) + return -ENOMEM; + + vm_stacks[i] = find_vm_area(stack); + vm_stack_cache->cur++; + vm_stack_cache->nr++; + } + return 0; } -- 2.7.4
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.