From: Neil Horman <nhorman@lvl7.com>
To: "Kim, Kwansuk" <kskim@neowave.co.kr>
Cc: linuxppc-embedded@lists.linuxppc.org
Subject: Re: The maximum size of stack in linuxppc kernel
Date: Fri, 19 Apr 2002 07:52:53 -0400 [thread overview]
Message-ID: <3CC00515.4429E463@lvl7.com> (raw)
In-Reply-To: OMENKEONFDLIGLHPFALBMELMCIAA.kskim@neowave.co.kr
Hello-
The exact size of the stack is based on the size of the task_union structure
in sched.h. Because of the way a union works in C the task_struct defined in
the union is aligned toward the low address end of the structure, which is
overall 8K in length, to satisfy the stack variable space requirements. The
remainder of that space is used as kernel stack on behalf of whichever process
causes a trap into the kernel. I think in the event of an interrupt, the kernel
stack used is whichever one the current variable points to. So to summarize,
the total allocated kernel stack size for any given process is 8K minus the size
of the task structure defined in sched.h
hope that helps!
Neil
"Kim, Kwansuk" wrote:
>
> Hi, everyone,
>
> I'm writing a device driver on my PPC405GP custom board, and
>
> I wonder the maximum size of stack which is used for function call.
>
> I searched kernel_source/Documantation and found such a comment.
>
> A rigid stack limit
> The kernel stack is about 6K in 2.2 (for most
> architectures: it's about 14K on the Alpha), and shared
> with interrupts so you can't use it all. Avoid deep
> recursion and huge local arrays on the stack (allocate
> them dynamically instead).
>
> But I wonder exact maximum size of the kernel I'm using (2.4.18-pre7)
>
> How can I find it in the kernel source?
>
> I wish you a nice weekend!
>
> ==============================================
> Just for fun...
> - Linus Torvalds
> ==============================================
> Kwansuk Kim
> Engineer, NeoWave Inc.
> Tel +82-31-380-4927 Fax +82-31-380-4747
> E-mail: kskim@neowave.co.kr
> ==============================================
>
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
next prev parent reply other threads:[~2002-04-19 11:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-19 11:38 The maximum size of stack in linuxppc kernel Kim, Kwansuk
2002-04-19 11:52 ` Neil Horman [this message]
2002-04-19 15:00 ` Tom Rini
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=3CC00515.4429E463@lvl7.com \
--to=nhorman@lvl7.com \
--cc=kskim@neowave.co.kr \
--cc=linuxppc-embedded@lists.linuxppc.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).