Linux OOM kernel module when there is memory in the cache

Embedded system, no swap, kernel v2.6.36, memory compression enabled.

With heavy use, all RAM is tied to the cache. The cache used about 70MB of memory. When a custom spatial process allocates memory, no problem, the cache gives it.

But there is a third party device driver that seems to be trying to allocate a 5th order physical page and doesn't work with OOM. A quick look at buddyinfo confirms this ... there is no 5th order page. But as soon as I drop the cache, many become available and the device driver is no longer OOM.

So it seems to me that the virtual memory allocation will cause the cache to fall, but the physical memory allocation won't? It doesn't make sense, because then kernel modules can be OOM when memory is tied in cache, and this behavior seems more harmful than slow disk access without caching.

Is there a setting option for this?

Thank!

+3


source to share


1 answer


So here's what's going on. I still don't know why using large cache calls OOM modules for kernel modules. The problem is third party code that we don't have access to, so who knows what they are doing.

I think it can be argued that this is by design where the non-critical disk cache can take all available free memory and call kernel modules for OOM, then IMHO maybe the disk cache should leave something for the kernel.

I decided to limit the cache instead, so there is always some "really free" memory left for the kernel to use, and not dependent on the "free" memory associated with the cache.

I installed a kernel patch that will add / proc / sys / vm / pagecache _ratio so you can set how much memory the disk cache can fetch. But this was never included in the kernel for whatever reason (I thought it was a good idea, especially if the disk cache could trigger an OOM kernel). But I didn't want to mess with kernel patches for convenience and future reasons. If anyone just makes a one-time deal and doesn't mind patches here is the link: http://lwn.net/Articles/218890/



My solution is that I recompiled the kernel and included groups, and I use that to limit memory usage to a group of processes that are responsible for a lot of disk access (hence the cache run). After configuring it, it works fine. I'll leave my setup for a weekend stress test and see if the OOM is still happening.

Thank you Jesus.

Edit: I think I found my own answer. / Proc / sys / vm / has VM configuration options. The tuned options related to this issue are: min_free_kbytes, lowmem_reserve_ratio and extfrag_threshold

+1


source







All Articles