From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752025AbdBIIkV (ORCPT ); Thu, 9 Feb 2017 03:40:21 -0500 Received: from mx2.suse.de ([195.135.220.15]:46571 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751878AbdBIIkS (ORCPT ); Thu, 9 Feb 2017 03:40:18 -0500 Date: Thu, 9 Feb 2017 09:40:06 +0100 From: Michal Hocko To: Hoeun Ryu Cc: Kees Cook , Michal Marek , Andrew Morton , Emese Revfy , Ingo Molnar , =?iso-8859-1?Q?Micka=EBl_Sala=FCn?= , Nicholas Piggin , Andy Lutomirski , "Eric W. Biederman" , Mateusz Guzik , linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Subject: Re: [PATCH v2 2/2] fork: make number of cached stacks (vmapped) configurable using Kbuild Message-ID: <20170209084005.GC10257@dhcp22.suse.cz> References: <1486613040-30555-1-git-send-email-hoeun.ryu@gmail.com> <1486613040-30555-2-git-send-email-hoeun.ryu@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1486613040-30555-2-git-send-email-hoeun.ryu@gmail.com> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 09-02-17 13:03:47, Hoeun Ryu wrote: > Introducing NR_VMAP_STACK_CACHE, the number of cached stacks for virtually > mapped kernel stack can be configurable using Kbuild system. > default value is 2. This should really explain _why_ we want/need this. The config space is really large already and there should better be a good reason to make it even larger. Which workload will benefit from a different than default cache size and why? Without a really good reasons NACK from me. > Signed-off-by: Hoeun Ryu > --- > arch/Kconfig | 8 ++++++++ > kernel/fork.c | 2 +- > 2 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/arch/Kconfig b/arch/Kconfig > index d49a8e6..066d111 100644 > --- a/arch/Kconfig > +++ b/arch/Kconfig > @@ -849,6 +849,14 @@ config VMAP_STACK > the stack to map directly to the KASAN shadow map using a formula > that is incorrect if the stack is in vmalloc space. > > +config NR_VMAP_STACK_CACHE > + int "Number of cached stacks" > + default "2" > + depends on VMAP_STACK > + help > + This determines how many stacks can be cached for virtually > + mapped kernel stacks. > + > config ARCH_WANT_RELAX_ORDER > bool > > diff --git a/kernel/fork.c b/kernel/fork.c > index 7911ed2..73ba1da 100644 > --- a/kernel/fork.c > +++ b/kernel/fork.c > @@ -166,7 +166,7 @@ void __weak arch_release_thread_stack(unsigned long *stack) > * vmalloc() is a bit slow, and calling vfree() enough times will force a TLB > * flush. Try to minimize the number of calls by caching stacks. > */ > -#define NR_CACHED_STACKS 2 > +#define NR_CACHED_STACKS CONFIG_NR_VMAP_STACK_CACHE > static DEFINE_PER_CPU(struct vm_struct *, cached_stacks[NR_CACHED_STACKS]); > #endif > > -- > 2.7.4 > -- Michal Hocko SUSE Labs