> If not, what is your opinion of the two approaches above?
1408 bytes of local storage out of a 4K stack on x86 sounds
too big ... especially if you implement as suggested above:
someroutine(int count)
{
struct foo foo[8], *foop;
if (count < 8)
foop = foo;
else
foop = kmalloc(8*sizeof *foop, GFP_...);
....
}
The problem here is that you have already burned up a
big patch of the stack with your local structure. So
kmalloc() is called without much left. Most of the time
this doesn't matter because kmalloc() will just give
you a block from the slab without much further stack use.
But if memory is low, then the kmalloc() call will trigger
a much deeper stack sequence to try to free up some, and
since you already used a bunch of stack, this may push
you over the edge ... but you won't know unless your test
suites happen to trigger a memory shortage that happens
just as you make this pfm call with >8 count.
-Tony
_______________________________________________
perfmon mailing list
[email protected]
http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/