
On Sat, Oct 05, 2013 at 09:57:28PM +0200, Wolfgang Denk wrote:
Dear Tom Rini,
In message 20131004170203.GL15917@bill-the-cat you wrote:
I really don't like this. We're now allocating for example 256KiB on the stack, rather than malloc. I posted a patch recently to convert the non-redundant case to malloc instead for this reason. I believe the answer is we need to be using memalign here, like common/bouncebuf.c::bounce_buffer_start does. Can you do this? If not, can you test a patch? Thanks.
What exactly don't you like in using the stack for temporary data buffers? That's what it has been invented for. Using malloc() is only useful when the allocated buffers neet to be kept across file scope, which appears not to be the case here.
For file scope buffers, usign the satck is the most efficient and preferred approach - it's fast and results in minimal (virtually no) code.
Why do you hesitate to use the stack?
Mainly to allow us to work in restricted stack areas like SPL where we simply may not have that much space available.