[uClinux-dev] Can we decrease the uclinux kernel stack size to 4KB on ARM paltform

Greg Ungerer gerg at snapgear.com
Fri Jul 8 00:16:19 EDT 2011

Hi Erjiang,

On 05/07/11 13:08, Erjiang Li wrote:
> Hi All,
>   I have been working on uClinux kernel on ARM platform recently, and I
> want to decrease the kernel stack size from 8K to 4K, i.e. change the
> following code (in include/asm-arm/thread_info.h):
>         #define THREAD_SIZE_ORDER       1
>         #define THREAD_SIZE                   8192
>   to
>          #define THREAD_SIZE_ORDER       0
>          #define THREAD_SIZE                   4096
> But after this modification, it fails to boot up linux on my ARM
> development board now. It stops at the position of pdflush_init(), and
> the functions calling chain is as following:
>   ...
> ->pdflush_init()->start_one_pdflush_thread()->kthread_run()->kthread_create()->wait_for_completion()->wait_for_common()->do_wait_for_common()->schedule()
> In schedule() function, below code is executed repeatedly:
>    if (unlikely(test_thread_flag(TIF_NEED_RESCHED)))
>                          goto need_resched;
> So the function schedule() can't return.

Have you checked that the stack at this point isn't larger than
the 4k you have allowed for?

I know the above call chain doesn't look too bad, but double check
the current stack. And of course the real problem is that interrupts
will come in and need more of the current kernel stack.

> BTW, my uclinux version is 2.6.25, and my ARM cpu is MMU-less.

That is kind of old.

> Can anyone give me some advice on this problem. I wonder if we can
> decrease THREAD_SIZE to 4K on ARM platform. Some one told me that ARM
> uClinux needs separate interrupt stack for 4K THREAD_SIZE. Is that true?

I haven't heard that. I use 4k stacks on uClinux/ColdFire builds and
that seems ok on the systems I have used it on.


Greg Ungerer  --  Principal Engineer        EMAIL:     gerg at snapgear.com
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close                             FAX:         +61 7 3217 5323
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com

More information about the uClinux-dev mailing list