Messages in this thread | | | Subject | Re: Out of memory error | From | Peter Zijlstra <> | Date | Sat, 31 Jan 2009 14:48:40 +0100 |
| |
On Sat, 2009-01-31 at 22:30 +0800, Cliffe wrote:
> > Its simply a case of you using kmalloc(GFP_ATOMIC) and that's failing. > > > > So it has nothing to do with stack size because we are talking heap? > What could be causing the problem?
Right, heap. The thing is, Linux has a greedy memory usage, and tries to keep as much as possible in memory, this means that we're basically in a constant state of low memory.
Regular allocations (GFP_KERNEL) can sleep, and can therefore reclaim memory (write out stuff dirty to disk, swap a little, etc..).
Your allocation (GFP_ATOMIC) isn't allowed to sleep, and can therefore not reclaim memory -- if it really hits rock bottom, not uncommon, it just fails to provide memory.
Any code using GFP_ATOMIC (or for that matter, any kernel allocation, GFP_KERNEL can fail too, just not as easy) must be able to deal with allocation failures.
How to do that is very domain specific.
> How limited is the stack?
Depends on the arch and build details, 4k is a reasonable assumption.
> > Furthermore, it appears to me you're not using frame pointers for your > > kernel builds, please ammend that, it gives far more readable output. > > > > I'll look into that. Is that a kernel compile config option?
CONFIG_FRAME_POINTER=y
| |