Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Vaneet Narang <v.narang@samsung.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Maninder Singh <maninder1.s@samsung.com>,
	"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
	"will@kernel.org" <will@kernel.org>,
	"oleg@redhat.com" <oleg@redhat.com>,
	"keescook@chromium.org" <keescook@chromium.org>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"adobriyan@gmail.com" <adobriyan@gmail.com>,
	"rostedt@goodmis.org" <rostedt@goodmis.org>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"steve.capper@arm.com" <steve.capper@arm.com>,
	"vincenzo.frascino@arm.com" <vincenzo.frascino@arm.com>,
	"anshuman.khandual@arm.com" <anshuman.khandual@arm.com>,
	"ardb@kernel.org" <ardb@kernel.org>,
	"james.morse@arm.com" <james.morse@arm.com>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"maz@kernel.org" <maz@kernel.org>,
	"kristina.martsenko@arm.com" <kristina.martsenko@arm.com>,
	"samitolvanen@google.com" <samitolvanen@google.com>,
	"ebiederm@xmission.com" <ebiederm@xmission.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"gladkov.alexey@gmail.com" <gladkov.alexey@gmail.com>,
	"daniel.m.jordan@oracle.com" <daniel.m.jordan@oracle.com>,
	"walken@google.com" <walken@google.com>,
	"bernd.edlinger@hotmail.de" <bernd.edlinger@hotmail.de>,
	"laoar.shao@gmail.com" <laoar.shao@gmail.com>,
	"avagin@gmail.com" <avagin@gmail.com>,
	"john.johansen@canonical.com" <john.johansen@canonical.com>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	AMIT SAHRAWAT <a.sahrawat@samsung.com>
Subject: RE: [PATCH 1/1] arm64: add support for PAGE_SIZE aligned kernel stack
Date: Tue, 04 Aug 2020 11:45:26 +0530	[thread overview]
Message-ID: <20200804061526epcms5p3ff393f7e51d28ed896105c868bd31e5b@epcms5p3> (raw)
In-Reply-To: <20200803123447.GA89825@C02TD0UTHF1T.local>

Hi Mark,

>> currently THREAD_SIZE is always in power of 2, which will waste
>> memory in cases there is need to increase of stack size.
>
>If you are seeing issues with the current stack size, can you please
>explain that in more detail? Where are you seeing problems? Which
>configuration options do you have selected?
>
>I'm not keen on making kernel stack sizes configurable as it's not
>currently possible for the person building the kernel to figure out a
>safe size (and if this were possible, it's be better to handle this
>automatically).
>
>If the stack size is too small in some configurations I think we need to
>ensure that it is appropriately sized regardless of whether the person
>building the kernel believes they can identify a reasonable size.

Motivation behind these changes is saving memory on our system. 
Our system runs around 2500 threads concurrently so saving 4Kb  
might help us in saving 10MB memory.

To ensure 12KB is sufficient for our system we have used stack tracing and 
realised maximum stack used is not more than 9KB. 
 /sys/kernel/tracing/stack_max_size

Tracing interface defined by kernel to track maximum stack size can be used
by others to decide appropriate stack size.

>> Thus adding support for PAGE_SIZE(not power of 2) stacks for arm64.
>> User can decide any value 12KB, 16KB, 20 KB etc. based on value
>> of THREAD_SHIFT. User can set any value which is PAGE_SIZE aligned for
>> PAGE_ALIGNED_STACK_SIZE config.
>> 
>> Value of THREAD_SIZE is defined as 12KB for now, since with irq stacks
>> it is enough and it will save 4KB per thread.
>
>How are you certain of this?

Prev ARM64 uses 16KB stack size to store IRQ stack and thread on the same kernel stack.
Now since these are stored seperately so maximum kernel stack requirement is also reduced. 
ARM still uses 8KB stack to store both SVC and IRQ mode stack. So ARM64 shouldn't
have requirement more than double when compared to ARM. 
So considering these points we realised 12KB stack might be sufficient
for our system. Analyzing stack using stack tracer confirmed max stack requirement.

This is still configurable, if some system has higher stack requirement then user can 
go with 16KB but there should be option to change it.

 
Regards,
Vaneet Narang

  parent reply	other threads:[~2020-08-04  6:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200802165825epcas5p3a2127be681530fdd785db0f8961eaf96@epcas5p3.samsung.com>
2020-08-02 16:35 ` Maninder Singh
2020-08-03 12:34   ` Mark Rutland
     [not found]   ` <CGME20200802165825epcas5p3a2127be681530fdd785db0f8961eaf96@epcms5p3>
2020-08-04  6:15     ` Vaneet Narang [this message]
     [not found]   ` <CGME20200802165825epcas5p3a2127be681530fdd785db0f8961eaf96@epcms5p1>
2020-08-07 11:17     ` Maninder Singh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200804061526epcms5p3ff393f7e51d28ed896105c868bd31e5b@epcms5p3 \
    --to=v.narang@samsung.com \
    --cc=a.sahrawat@samsung.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=ardb@kernel.org \
    --cc=arnd@arndb.de \
    --cc=avagin@gmail.com \
    --cc=bernd.edlinger@hotmail.de \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=daniel.m.jordan@oracle.com \
    --cc=ebiederm@xmission.com \
    --cc=gladkov.alexey@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=james.morse@arm.com \
    --cc=john.johansen@canonical.com \
    --cc=keescook@chromium.org \
    --cc=kristina.martsenko@arm.com \
    --cc=laoar.shao@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maninder1.s@samsung.com \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=samitolvanen@google.com \
    --cc=steve.capper@arm.com \
    --cc=vincenzo.frascino@arm.com \
    --cc=walken@google.com \
    --cc=will@kernel.org \
    --subject='RE: [PATCH 1/1] arm64: add support for PAGE_SIZE aligned kernel stack' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).