NOMMU: stack versus malloc?

Denys Vlasenko vda.linux at googlemail.com
Tue Oct 9 20:34:02 UTC 2007


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

> AFAIK there was RESERVE_CONFIG_BUFFER for (potentially big) stack users.

Yes. But it looks like _nobody_ benefits from big objects on stack.
So I intend to gradually move big stack users to malloc.
--
vda



More information about the busybox mailing list