tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: alloca() in kernel code



>> [...alloca() in kernel code...]
> The kernel stack is rather small, we should not start allocating
> variable-sized stuff on it.

You say that as though the part after the comma follows from the part
before it.  If so, I don't understand why.  The alternative seems to me
to be to allocate a statically-sized buffer that's the maximum that
could be needed - and, indeed, you remarked below (in text I've cut)
that that's what you've done in such cases.  But, surely, if you're
short of stack, it's better to allocate only what you need, so the sum
of the allocations is as small as possible, rather than to allocate
maximum-sized buffers, whose total size will be as big as possible?

I'm presumably missing something here, but what?

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index