* The maximum size of stack in linuxppc kernel
@ 2002-04-19 11:38 Kim, Kwansuk
2002-04-19 11:52 ` Neil Horman
0 siblings, 1 reply; 3+ messages in thread
From: Kim, Kwansuk @ 2002-04-19 11:38 UTC (permalink / raw)
To: linuxppc-embedded
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/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: The maximum size of stack in linuxppc kernel
2002-04-19 11:38 The maximum size of stack in linuxppc kernel Kim, Kwansuk
@ 2002-04-19 11:52 ` Neil Horman
2002-04-19 15:00 ` Tom Rini
0 siblings, 1 reply; 3+ messages in thread
From: Neil Horman @ 2002-04-19 11:52 UTC (permalink / raw)
To: Kim, Kwansuk; +Cc: linuxppc-embedded
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/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: The maximum size of stack in linuxppc kernel
2002-04-19 11:52 ` Neil Horman
@ 2002-04-19 15:00 ` Tom Rini
0 siblings, 0 replies; 3+ messages in thread
From: Tom Rini @ 2002-04-19 15:00 UTC (permalink / raw)
To: Neil Horman; +Cc: Kim, Kwansuk, linuxppc-embedded
On Fri, Apr 19, 2002 at 07:52:53AM -0400, Neil Horman wrote:
> 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
And, if you're finding your self in need of growing the stack, you need
to stop and think about what you're doing since this is almost always
the wrong approach.
--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-04-19 15:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-19 11:38 The maximum size of stack in linuxppc kernel Kim, Kwansuk
2002-04-19 11:52 ` Neil Horman
2002-04-19 15:00 ` Tom Rini
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).