On Fri, Jul 8, 2011 at 12:16 PM, Greg Ungerer <g...@snapgear.com> wrote:

> 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.
>
> I am sorry for that my original findings were not correct. schedule()
function can return, the code "goto need_resched" is not executed
repeatedly. It's ret_to_user/ret_slow_syscall entry in
arch/arm/kernel/entry-common.S calls schedule() function repeatedly.

I have checked for stack, and don't find any overflows at this point.
I did want to use a separate IRQ stack for IRQ handling, like x86. But I
don't know how much & how difficult the work will be.

>
>
>  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.
>
> Regards
> Greg
>
>
> ------------------------------**------------------------------**
> ------------
> Greg Ungerer  --  Principal Engineer        EMAIL:     g...@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
>



-- 
Best Regards

Erjian
_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to