public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Vedran Furač" <vedranf@vedranf.mine.nu>
To: linux-kernel@vger.kernel.org
Subject: Re: Memory overcommit
Date: Tue, 13 Oct 2009 19:13:34 +0200	[thread overview]
Message-ID: <hb2cfu$r08$2@ger.gmane.org> (raw)
In-Reply-To: <20091013120840.a844052d.kamezawa.hiroyu@jp.fujitsu.com>

KAMEZAWA Hiroyuki wrote:

> On Mon, 12 Oct 2009 13:51:07 +0200 Vedran Furač
> <vedranf@vedranf.mine.nu> wrote:
>> /proc/meminfo MemTotal:        3542532 kB MemFree:          892972
>> kB Buffers:            2664 kB Cached:           130940 kB
>> 
>> ...that there is almost 900MB free memory. But OK, I can live with
>> it.
>> 
>> So, my question is: why today overcommit isn't turned off *by
>> default*? I have it turned off for a few years now and only side
>> effect is that I don't get processes killed randomly anymore, I
>> don't loose valuable time and data.
>> 
> "isn't turned off" means "vm.overcommit_memory==2" ?

Yes, "2: always check, never overcommit" as per proc(5)

> And...what's version your kernel is ?

Applies to every 2.6.

> oom-killer still finds "definitely-not-guilty" ones ?

Yes. It's always repeatable. Just compile and run that code. I'll
probably just file a bug report.

> I guess the reason of default value is that the kernel assume
> processes will not always use all mmaped range. There will be unused
> range in process's virtual memory and it can be big.
> 
> For example, typical case in a server, when you run multi-thread
> program (like java VM),
> 
> - stack per thread - malloc() arena per thread
> 
> can makes difference among size-of-mapped-range v.s. used-pages
> bigger. I saw Gigabytes of unused range on ia64 host,...statck size
> was big.

Yes, I noticed that JVM allocates gigabytes but then uses less than 10%
of that and, as a consequence, eclipse sometimes fails to start although
there's plenty of free memory. So overcommiting is some kind of a
workaround for broken software that allocate not what they need but what
they might need in some rare occurrences. I would rather like fixing
this userland software than risking OOM situations and random killing of
innocent processes.

> And if strict check(vm.ovecommit_memory=2) is used, mmap() return
> -ENOMEM whenever it hits limit.

% strace -f -e mmap java -version
[...]
mmap(NULL, 996147200, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = -1 ENOMEM (Cannot
allocate memory)

And that should be fine.

> Against random-kill, you may have 2 choices.
> 
> 1. use  /proc/<pid>/oom_adj 2. use  memory cgroup.
> 
> Something more easy-to-use method may be appriciated. We have above 2
> now.

These are just bad workarounds for bad OOM algorithm. I tested this
little program on multiple systems (including windows) without any
tweaking and linux behavior is, unfortunately *the worst*.  :/


Regards,

Vedran


  reply	other threads:[~2009-10-13 17:14 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-12 11:51 Memory overcommit Vedran Furač
2009-10-13  3:08 ` KAMEZAWA Hiroyuki
2009-10-13 17:13   ` Vedran Furač [this message]
2009-10-14  4:51     ` KAMEZAWA Hiroyuki
     [not found]       ` <4ADE3121.6090407@gmail.com>
     [not found]         ` <20091026105509.f08eb6a3.kamezawa.hiroyu@jp.fujitsu.com>
2009-10-26 16:16           ` Vedran Furač
2009-10-27  3:22             ` KAMEZAWA Hiroyuki
2009-10-27  6:10               ` KOSAKI Motohiro
2009-10-27  6:34                 ` Minchan Kim
2009-10-27  6:36                   ` KAMEZAWA Hiroyuki
2009-10-27  6:55                     ` Minchan Kim
2009-10-27  7:45                       ` [RFC][PATCH] oom_kill: avoid depends on total_vm and use real RSS/swap value for oom_score (Re: " KAMEZAWA Hiroyuki
2009-10-27  7:56                         ` Minchan Kim
2009-10-27 12:38                           ` Andrea Arcangeli
2009-10-28  0:22                             ` KAMEZAWA Hiroyuki
2009-10-28  0:45                               ` Vedran Furač
2009-10-27  7:56                         ` KAMEZAWA Hiroyuki
2009-10-27  8:14                           ` Minchan Kim
2009-10-27  8:33                             ` KAMEZAWA Hiroyuki
2009-10-27  8:52                               ` Minchan Kim
2009-10-27  8:56                                 ` KAMEZAWA Hiroyuki
2009-10-27 17:41                         ` Vedran Furač
2009-10-28  0:13                           ` KAMEZAWA Hiroyuki
2009-10-27 18:39                         ` Hugh Dickins
2009-10-27 18:47                           ` Andrea Arcangeli
2009-10-28  0:32                             ` KAMEZAWA Hiroyuki
2009-11-05 19:02                             ` Pavel Machek
2009-10-28  0:28                           ` KAMEZAWA Hiroyuki
2009-10-27  6:46                   ` KOSAKI Motohiro
2009-10-27  6:56                     ` Minchan Kim
2009-10-27 17:12               ` Vedran Furač
2009-10-27 18:02                 ` KOSAKI Motohiro
2009-10-27 18:30                   ` Vedran Furač
2009-10-27 20:44               ` Hugh Dickins
2009-10-27 21:04                 ` David Rientjes
2009-10-28  0:08                   ` Vedran Furač
2009-10-28  0:25                     ` David Rientjes
2009-10-28  0:39                       ` Vedran Furač
2009-10-28  4:08                         ` David Rientjes
2009-10-28  4:55                           ` KAMEZAWA Hiroyuki
2009-10-28  5:13                             ` David Rientjes
2009-10-28  6:05                               ` KAMEZAWA Hiroyuki
2009-10-28  6:17                                 ` David Rientjes
2009-10-28  6:20                                   ` KAMEZAWA Hiroyuki
2009-10-29  8:38                                     ` David Rientjes
2009-10-29 11:11                                       ` Vedran Furač
2009-10-29 19:53                                         ` David Rientjes
2009-10-29 23:48                                           ` KAMEZAWA Hiroyuki
2009-10-30  9:10                                             ` David Rientjes
2009-10-30  9:36                                               ` KAMEZAWA Hiroyuki
2009-10-30 10:49                                                 ` Thomas Fjellstrom
2009-11-03 20:49                                                 ` David Rientjes
2009-11-04  0:50                                                   ` KAMEZAWA Hiroyuki
2009-11-04  1:58                                                     ` David Rientjes
2009-11-04  2:17                                                       ` KAMEZAWA Hiroyuki
2009-11-04  3:10                                                         ` David Rientjes
2009-11-04  3:19                                                           ` KAMEZAWA Hiroyuki
2009-10-30 13:59                                           ` Vedran Furač
2009-10-30 19:24                                             ` David Rientjes
2009-11-02 19:58                                               ` Vedran Furač
2009-10-28 13:28                           ` Vedran Furač
2009-10-28 20:10                             ` David Rientjes
2009-10-29  3:05                               ` Vedran Furač
2009-10-29  8:35                                 ` David Rientjes
2009-10-29 11:01                                   ` Vedran Furač
2009-10-29 19:42                                     ` David Rientjes
2009-10-30 13:53                                       ` Vedran Furač
2009-10-30 14:08                                         ` Thomas Fjellstrom
2009-10-30 15:13                                           ` Vedran Furač
2009-10-30 14:12                                         ` Andrea Arcangeli
2009-10-30 14:41                                           ` Vedran Furač
2009-10-30 15:15                                             ` Andrea Arcangeli
2009-10-30 16:24                                               ` Hugh Dickins
2009-11-02 19:56                                               ` Vedran Furač
2009-10-30 19:44                                         ` David Rientjes
2009-11-02 19:56                                           ` Vedran Furač
2009-10-28  0:43                 ` KAMEZAWA Hiroyuki
2009-10-28  2:47                 ` KOSAKI Motohiro
2009-10-28  3:17                   ` KAMEZAWA Hiroyuki
2009-10-28  4:12                   ` David Rientjes
2009-10-28  8:10                     ` Hugh Dickins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='hb2cfu$r08$2@ger.gmane.org' \
    --to=vedranf@vedranf.mine.nu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vedran.furac@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox