NOMMU: stack versus malloc?

Mike Frysinger vapier at gentoo.org
Wed Oct 10 16:00:32 PDT 2007


On Tuesday 09 October 2007, Denys Vlasenko wrote:
> On Tuesday 09 October 2007 20:41, Bernhard Fischer wrote:
> > On Tue, Oct 09, 2007 at 02:56:49PM -0400, Mike Frysinger wrote:
> > >On Tuesday 09 October 2007, Denys Vlasenko wrote:
> > >> A question to people who work with NOMMU machines:
> > >>
> > >> Obviously, having small stack usage is important for
> > >> small, NOMMU machines.
> > >>
> > >> However, after a certain point you cannot just eliminate
> > >> stack usage, you must move it to other storage.
> > >>
> > >> For example, lineedit.c currently eats 12k+ if stack.
> > >>
> > >> I can convert it into malloc use.
> > >>
> > >> Question: is it better or actually worse?
> > >> Line editing is invoked repeatedly, and repeated malloc/free
> > >> of random-sized blocks can increase fragmentation
> > >> -> increase memory consumption.
> > >
> > >it really depends on the size of the consumption ... on nommu, the
> > > default stack is 4k, so i'd say if you're talking about more than 1k,
> > > it should be a malloc ...
>
> Ick... We have lots of ~4k stack users... and Makefile sets stack to 20k
>  IIRC, correct me if I'm wrong:
>
> # Busybox is a stack-fatty so make sure we increase default size
> # TODO: use "make stksizes" to find & fix big stack users
> # (we stole scripts/checkstack.pl from the kernel... thanks guys!)
> FLTFLAGS += -s 20000

we set the stack to 20k because of all the fatty stack buffers ;) ... so this 
is a chicken & egg argument

thinking about it more, fragmentation tends to be a much worse issue on no-mmu 
than OOM, so allocating/freeing small buffers over the place would be 
nasty ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: This is a digitally signed message part.
Url : http://busybox.net/lists/busybox/attachments/20071010/46087326/attachment.pgp 


More information about the busybox mailing list