07.01.08 @ 20:58 Dag-Erling Smørgrav wrote:Yes, but when they have a multi-gigabyte-RAM server, and told that Linux will be better - no matter they are technically so competent or not, we can loose users... I've heard about disabling it for selected processes or things like memory reservation backed by temporary files done by OS (afair, it was HP-UX). Or Linux overcommit switch, for which this ordinary people are happy enough to not blame (here are defaults): master:~# cat /proc/sys/vm/overcommit_ratio 50 master:~# cat /proc/sys/vm/overcommit_memory 0 master:~# cat /usr/src/linux-2.6.16.21-0.8/Documentation/vm/overcommit-accounting The Linux kernel supports the following overcommit handling modes 0 - Heuristic overcommit handling. Obvious overcommits of address space are refused. Used for a typical system. It ensures a seriously wild allocation fails while allowing overcommit to reduce swap usage. root is allowed to allocate slighly more memory in this mode. This is the default. 1 - Always overcommit. Appropriate for some scientific applications. 2 - Don't overcommit. The total address space commit for the system is not permitted to exceed swap + a configurable percentage (default is 50) of physical RAM. Depending on the percentage you use, in most situations this means a process will not be killed while accessing pages but will receive errors on memory allocation as appropriate. The overcommit policy is set via the sysctl `vm.overcommit_memory'. The overcommit percentage is set via `vm.overcommit_ratio'. The current overcommit limit and amount committed are viewable in /proc/meminfo as CommitLimit and Committed_AS respectively. Gotchas ------- The C language stack growth does an implicit mremap. If you want absolute guarantees and run close to the edge you MUST mmap your stack for the largest size you think you will need. For typical stack usage this does not matter much but it's a corner case if you really really care In mode 2 the MAP_NORESERVE flag is ignored. How It Works ------------ The overcommit is based on the following rules For a file backed map SHARED or READ-only - 0 cost (the file is the map not swap) PRIVATE WRITABLE - size of mapping per instance For an anonymous or /dev/zero map SHARED - size of mapping PRIVATE READ-only - 0 cost (but of little use) PRIVATE WRITABLE - size of mapping per instance Additional accounting Pages made writable copies by mmap shmfs memory drawn from the same pool Status ------ o We account mmap memory mappings o We account mprotect changes in commit o We account mremap changes in size o We account brk o We account munmap o We report the commit status in /proc o Account and check on fork o Review stack handling/building on exec o SHMfs accounting o Implement actual limit enforcement To Do ----- o Account ptrace pages (this is hard) master:~# 1) It is simpler to understand a relatively short summary or ask help from language-knowing man for this not so big text, than try to ask such man for many pages 2) Such an article would be good in terms of advocacy, to explain why this is not a bug, we are not-worse-in-this-place than their-cool-OS, and what programmer should do. Of course, in case this is really so - or maybe we want to commit a patch (Kostik Belousov's one may be good start point) with tunable allowing to disable overcommit?.. -- WBR, Vadim Goncharov _______________________________________________ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
| Sunil Naidu | Re: Linux 2.6.20-rc6 |
| Alan Cox | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Chris Snook | Re: init's children list is long and slows reaping children. |
| Greg Kroah-Hartman | [PATCH 001/196] Chinese: Add the known_regression URI to the HOWTO |
git: | |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| David Miller | [GIT]: Networking |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| Eric W. Biederman | Re: [PATCH 10/11] avoid kobject name conflict with different namespaces |
