[PATCH 0/3] ARM 4Kstacks: introduction

Ming Lei tom.leiming at gmail.com
Mon Oct 24 06:36:35 EDT 2011


Hi,

On Sat, Oct 22, 2011 at 9:36 PM, Russell King - ARM Linux
<linux at arm.linux.org.uk> wrote:
> On Sat, Oct 22, 2011 at 04:50:15PM +0800, Ming Lei wrote:
>> On Wed, Oct 19, 2011 at 6:51 PM, Arnd Bergmann <arnd at arndb.de> wrote:
>> > On Tuesday 18 October 2011 17:26:44 Tim Bird wrote:
>> >> Even inside Sony, usage of 4K stacks is limited
>> >> to some very special cases, where memory is exceedingly
>> >> tight (we have one system with 4M of RAM).  And we
>> >> don't mind lopping off features or coding around
>> >> problem areas to support our special case.
>> >
>> > I would imagine that in those cases, you can gain more by reducing the
>> > number of threads in the system. What is the highest number of
>> > concurrent threads that you expect in a limited use case with no
>> > networking or block devices?
>>
>> If system run for some time, sometimes it may be difficult for
>> memory allocator to allocate 2 continuous page frames even  there are
>> many spare page frames in system because of
>> fragment issue, so the patch does make sense.
>
> If memory fragmentation is an issue for this, it probably means that we
> need to switch to a software page size of 8K (or maybe 16K) rather than
> stick with the hardware 4K size.  That would be a much more reliable
> solution, especially as the L1 page table is 16K (if you're suffering
> from memory fragmentation, the first thing which'd get you is the L1
> page table allocation, not the kernel stack allocation.)

If large page size is taken, memory utilization will be decreased a lot, so
may cause some low memory system not workable at all.

>> Anyway, it provides one option for user to apply 4k stack to avoid
>> such kind of process creation failure.
>
> I refer you to the comments made by people who've tried running with 4K
> stacks on x86, and their _vast_ experience of doing this.  If they say
> that it causes stack overflows, then it's a problem.

Stack overflow depends on code running path. For some low memory
and simple application, the code path is not deep as x86, so providing
a option of enabling 4K stack still makes sense for this kind of case or
application.


thanks,
-- 
Ming Lei



More information about the linux-arm-kernel mailing list