All of lore.kernel.org
 help / color / mirror / Atom feed
* Memory overcommit
@ 2005-12-09 22:00 Tracy R Reed
  2005-12-11  2:00 ` Kip Macy
  0 siblings, 1 reply; 128+ messages in thread
From: Tracy R Reed @ 2005-12-09 22:00 UTC (permalink / raw)
  To: xen-devel

I have been using Xen on a daily basis on a production (but not
critical) machine for a number of months now. It's looking really good.

One thing that I have not yet seen anyone mention as a feature that I
would really like to see is the ability to overcommit memory. I have 2G
of RAM in my machine. I would like to give a developer his own virtual
domain to sandbox his application development without having to dedicate
a whole piece of hardware to just him. But I know he won't really log in
and use it all that often. If I give him 512M of my 2G that's 25% of my
memory that will likely be unutilized most of the time. It would be
great if I could assign more memory to domains than I actually have and
just let it swap out idle pages. I bet there are a lot of boxes out
there, especially in webserver colo's, that really don't get much
traffic and really don't need as much RAM as they have in them for
normal day to day operations. Just let them swap everything back in and
use up to the maximum RAM configured for that domain if they get busy
and need it but let it swap out the rest of the time so other busier
domains can use the physical RAM.

This is feature #1 on my Xen wishlist. Is there any work going into this
area?

-- 
Tracy R Reed
http://copilotconsulting.com
1-877-MY-COPILOT

^ permalink raw reply	[flat|nested] 128+ messages in thread
* Memory overcommit
@ 2009-10-12 11:51 Vedran Furač
  2009-10-13  3:08 ` KAMEZAWA Hiroyuki
  0 siblings, 1 reply; 128+ messages in thread
From: Vedran Furač @ 2009-10-12 11:51 UTC (permalink / raw)
  To: linux-kernel

Hi! I don't know if this is appropriate place to ask such questions and
if not, please point me to such place.

Let's simulate a process gone berserk with this piece of code:

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>

int main()
{
  char *buf;
  while(1) {
    buf = malloc (1024*1024*100);
    if ( buf == NULL ) {
      perror("malloc");
      getchar();
      exit(EXIT_FAILURE);
    }
    sleep(1);
    memset(buf, 1, 1024*1024*100);
  }
  return 0;
}

# echo 0 > /proc/sys/vm/overcommit_memory

Compile, run and soon result is:
- System freezes for a second or two
- OOMK wakes up
- X crashes

Now, I'm back to VT1 and dmesg shows 8 process were killed by OOMK
(including X server and some long running daemons with small memory
footprint like automount) before the real culprit was killed. This
random killing spree *really* gives bad reputation to linux and people
usually point this out as an argument against it.

But, there is an easy fix:
# echo 2 > /proc/sys/vm/overcommit_memory
Run the program again and after a few seconds you'll get:

"malloc: Cannot allocate memory"

and that's all what happens. Nothing gets killed and one (and others
too) can continue to work without loosing time, data or both. Only
somewhat strange is that kernel contradicts itself when it says there is
no more and in the same time saying:

/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.

Regards,

Vedran


^ permalink raw reply	[flat|nested] 128+ messages in thread

end of thread, other threads:[~2009-11-04  3:22 UTC | newest]

Thread overview: 128+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-09 22:00 Memory overcommit Tracy R Reed
2005-12-11  2:00 ` Kip Macy
2005-12-11 15:45   ` Keir Fraser
2005-12-11 19:59     ` Rik van Riel
2005-12-13 16:10       ` Keir Fraser
2005-12-13 16:25         ` Jacob Gorm Hansen
  -- strict thread matches above, loose matches on Subject: below --
2009-10-12 11:51 Vedran Furač
2009-10-13  3:08 ` KAMEZAWA Hiroyuki
2009-10-13 17:13   ` Vedran Furač
2009-10-14  4:51     ` KAMEZAWA Hiroyuki
2009-10-20 21:52       ` Vedran Furač
2009-10-26  1:55         ` KAMEZAWA Hiroyuki
2009-10-26 16:16           ` Vedran Furač
2009-10-26 16:16             ` Vedran Furač
2009-10-27  3:22             ` KAMEZAWA Hiroyuki
2009-10-27  3:22               ` KAMEZAWA Hiroyuki
2009-10-27  6:10               ` KOSAKI Motohiro
2009-10-27  6:10                 ` KOSAKI Motohiro
2009-10-27  6:34                 ` Minchan Kim
2009-10-27  6:34                   ` Minchan Kim
2009-10-27  6:36                   ` KAMEZAWA Hiroyuki
2009-10-27  6:36                     ` KAMEZAWA Hiroyuki
2009-10-27  6:55                     ` Minchan Kim
2009-10-27  6:55                       ` Minchan Kim
2009-10-27  6:46                   ` KOSAKI Motohiro
2009-10-27  6:46                     ` KOSAKI Motohiro
2009-10-27  6:56                     ` Minchan Kim
2009-10-27  6:56                       ` Minchan Kim
2009-10-27 17:12               ` Vedran Furač
2009-10-27 17:12                 ` Vedran Furač
2009-10-27 18:02                 ` KOSAKI Motohiro
2009-10-27 18:30                   ` Vedran Furač
2009-10-27 18:30                     ` Vedran Furač
2009-10-27 20:44               ` Hugh Dickins
2009-10-27 20:44                 ` Hugh Dickins
2009-10-27 21:04                 ` David Rientjes
2009-10-27 21:04                   ` David Rientjes
2009-10-28  0:08                   ` Vedran Furač
2009-10-28  0:08                     ` Vedran Furač
2009-10-28  0:25                     ` David Rientjes
2009-10-28  0:25                       ` David Rientjes
2009-10-28  0:39                       ` Vedran Furač
2009-10-28  0:39                         ` Vedran Furač
2009-10-28  4:08                         ` David Rientjes
2009-10-28  4:08                           ` David Rientjes
2009-10-28  4:55                           ` KAMEZAWA Hiroyuki
2009-10-28  4:55                             ` KAMEZAWA Hiroyuki
2009-10-28  5:13                             ` David Rientjes
2009-10-28  5:13                               ` David Rientjes
2009-10-28  6:05                               ` KAMEZAWA Hiroyuki
2009-10-28  6:05                                 ` KAMEZAWA Hiroyuki
2009-10-28  6:17                                 ` David Rientjes
2009-10-28  6:17                                   ` David Rientjes
2009-10-28  6:20                                   ` KAMEZAWA Hiroyuki
2009-10-28  6:20                                     ` KAMEZAWA Hiroyuki
2009-10-29  8:38                                     ` David Rientjes
2009-10-29  8:38                                       ` David Rientjes
2009-10-29 11:11                                       ` Vedran Furač
2009-10-29 11:11                                         ` Vedran Furač
2009-10-29 19:53                                         ` David Rientjes
2009-10-29 19:53                                           ` David Rientjes
2009-10-29 23:48                                           ` KAMEZAWA Hiroyuki
2009-10-29 23:48                                             ` KAMEZAWA Hiroyuki
2009-10-30  9:10                                             ` David Rientjes
2009-10-30  9:10                                               ` David Rientjes
2009-10-30  9:36                                               ` KAMEZAWA Hiroyuki
2009-10-30  9:36                                                 ` KAMEZAWA Hiroyuki
2009-10-30 10:49                                                 ` Thomas Fjellstrom
2009-11-03 20:49                                                 ` David Rientjes
2009-11-03 20:49                                                   ` David Rientjes
2009-11-04  0:50                                                   ` KAMEZAWA Hiroyuki
2009-11-04  0:50                                                     ` KAMEZAWA Hiroyuki
2009-11-04  1:58                                                     ` David Rientjes
2009-11-04  1:58                                                       ` David Rientjes
2009-11-04  2:17                                                       ` KAMEZAWA Hiroyuki
2009-11-04  2:17                                                         ` KAMEZAWA Hiroyuki
2009-11-04  3:10                                                         ` David Rientjes
2009-11-04  3:10                                                           ` David Rientjes
2009-11-04  3:19                                                           ` KAMEZAWA Hiroyuki
2009-11-04  3:19                                                             ` KAMEZAWA Hiroyuki
2009-10-30 13:59                                           ` Vedran Furač
2009-10-30 13:59                                             ` Vedran Furač
2009-10-30 19:24                                             ` David Rientjes
2009-10-30 19:24                                               ` David Rientjes
2009-11-02 19:58                                               ` Vedran Furač
2009-11-02 19:58                                                 ` Vedran Furač
2009-10-28 13:28                           ` Vedran Furač
2009-10-28 13:28                             ` Vedran Furač
2009-10-28 20:10                             ` David Rientjes
2009-10-28 20:10                               ` David Rientjes
2009-10-29  3:05                               ` Vedran Furač
2009-10-29  3:05                                 ` Vedran Furač
2009-10-29  8:35                                 ` David Rientjes
2009-10-29  8:35                                   ` David Rientjes
2009-10-29 11:01                                   ` Vedran Furač
2009-10-29 11:01                                     ` Vedran Furač
2009-10-29 19:42                                     ` David Rientjes
2009-10-29 19:42                                       ` David Rientjes
2009-10-30 13:53                                       ` Vedran Furač
2009-10-30 13:53                                         ` Vedran Furač
2009-10-30 14:08                                         ` Thomas Fjellstrom
2009-10-30 14:08                                           ` Thomas Fjellstrom
2009-10-30 15:13                                           ` Vedran Furač
2009-10-30 15:13                                             ` Vedran Furač
2009-10-30 14:12                                         ` Andrea Arcangeli
2009-10-30 14:12                                           ` Andrea Arcangeli
2009-10-30 14:41                                           ` Vedran Furač
2009-10-30 14:41                                             ` Vedran Furač
2009-10-30 15:15                                             ` Andrea Arcangeli
2009-10-30 15:15                                               ` Andrea Arcangeli
2009-10-30 16:24                                               ` Hugh Dickins
2009-10-30 16:24                                                 ` Hugh Dickins
2009-11-02 19:56                                               ` Vedran Furač
2009-11-02 19:56                                                 ` Vedran Furač
2009-10-30 19:44                                         ` David Rientjes
2009-10-30 19:44                                           ` David Rientjes
2009-11-02 19:56                                           ` Vedran Furač
2009-11-02 19:56                                             ` Vedran Furač
2009-10-28  0:43                 ` KAMEZAWA Hiroyuki
2009-10-28  0:43                   ` KAMEZAWA Hiroyuki
2009-10-28  2:47                 ` KOSAKI Motohiro
2009-10-28  2:47                   ` KOSAKI Motohiro
2009-10-28  3:17                   ` KAMEZAWA Hiroyuki
2009-10-28  3:17                     ` KAMEZAWA Hiroyuki
2009-10-28  4:12                   ` David Rientjes
2009-10-28  4:12                     ` David Rientjes
2009-10-28  8:10                     ` Hugh Dickins
2009-10-28  8:10                       ` Hugh Dickins

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.