[U-Boot] [PATCH 02/11] env_mmc.c: Make the non-redundant env_relocate_spec use malloc not stack

Wolfgang Denk wd at denx.de
Mon Oct 7 07:41:50 CEST 2013


Dear Tom,

In message <20131006204046.GN15917 at bill-the-cat> you wrote:
> 
> > In message <1380227287-26057-3-git-send-email-trini at ti.com> you wrote:
> > > Switch the case of non-redundant non-embedded environment to use malloc
> > > to allocate buffers, rather than place them on the stack, like the
> > > redundant case does.
> > 
> > What exactly would be the benefit of this change?  It just adds code
> > size and execution time and makes the code more complex, without any
> > appearent advanteages?
>
> The main advantage is that we can use this code in environments with
> less than CONFIG_ENV_SIZE worth of stack available.  Arguably it makes
> the behaviour and code paths similar for redundant and non-redundant
> cases (but someone posted a patch to make the redundant case use the
> stack).

Instead of stack size you pay for that with additional size of the
malloc() arena.  As I just explained in the other mail [1], this is
even worse to deal with and will result in less memoy available for
other purposes.

And yes, we definitely should use the stack for the redundant case as
well.  Do you want me to submit such a patch?

[1] http://article.gmane.org/gmane.comp.boot-loaders.u-boot/171217


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Anyone can count the seeds in an apple.
No one can count the apples in a seed.


More information about the U-Boot mailing list