vm overcommit handling

David Kuehling dvdkhlng at gmx.de
Sat Jan 15 08:34:18 EST 2011


Hi,

currently the NanoNote comes with a setting of
/proc/sys/vm/overcommit_memory = 0.  This makes Linux' memory manager
overly fussy with memory allocations, memory mappings and fork().

The result is that large applications like Octave do not start due to
missing memory, or sometimes a large application like Emacs is unable to
execute a child process via fork() and exec() since the memory manager
asseses that memory would not suffice to perform fork() on a huge
process.

In reality, memory mostly *does* suffice, though.  It's just that there
are more pages assigned to processes, than there is available RAM.
Especially with large executables this is not a problem, since
executables are mapped read-only from disk files to memory.  If memory
runs low, these read-only pages can just be dropped, and reloaded from
disk whenever they are needed again.

Setting /proc/sys/vm/overcommit_memory = 1 makes Linux memory manager
more generous and allows processes to occupy more pages than there is
RAM.  The downside is, that applications then sometimes don't fail on
calling malloc(), but instead segfault when they try to access pages
that cannot be allocated to available RAM.  

In reality I've seen that the Linux OOM killer comes along and kills
applications that it deems to memory hungry.  I saw that behaviour with
overcommit_memory set to 0 as well to 1, so I guess generally setting it
to 1 won't make things much worse than they are already.

So are you ok with such a change?

The right place to change that setting would be from /etc/sysctl.conf.
Should I add a sysctl.conf to data/qi_lb60/files/etc/ ?

Would be nice to add it in a place that effects config.minimal as well
as config.full_system.  I want my config.minimal images to be able to
run Octave out-of-the-box.  BTW Octave consists of about 38MB of
read-only library code that needs to be mapped.  Of course depending on
what you do, you won't actually use most of that code.

cheers,

David

PS: some more info is available here:
http://www.mjmwired.net/kernel/Documentation/sysctl/vm.txt
-- 
GnuPG public key: http://user.cs.tu-berlin.de/~dvdkhlng/dk.gpg
Fingerprint: B17A DC95 D293 657B 4205  D016 7DEF 5323 C174 7D40
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.en.qi-hardware.com/pipermail/discussion/attachments/20110115/7fb851b1/attachment.pgp>


More information about the discussion mailing list


interactive