Re: Out of memory error

From: Peter Zijlstra
Date: Sat Jan 31 2009 - 08:48:54 EST


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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/