mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Yakov Lerner" <iler.ml@gmail.com>
To: "Xavier Bestel" <xavier.bestel@free.fr>
Cc: Kernel <linux-kernel@vger.kernel.org>
Subject: Re: coping with swap-exhaustion in 2.4.33-4
Date: Thu, 23 Nov 2006 15:03:40 +0200	[thread overview]
Message-ID: <f36b08ee0611230503q763e03edge12a5e4d0d8b5ed5@mail.gmail.com> (raw)
In-Reply-To: <1164285412.13074.131.camel@frg-rhel40-em64t-03>

On 11/23/06, Xavier Bestel <xavier.bestel@free.fr> wrote:
> On Thu, 2006-11-23 at 14:30 +0200, Yakov Lerner wrote:
> >     Where can I read anything about how kernel is supposed to
> > react to the 'swap-full' condition ? We have troubles on the
> > production machine which routinely arrives to the swap-full state
> > no matter how I increase the swap, because user proceses multi-fork
> > and then want to allocate a lot of virtual memory.
>
> Did you disable memory overcommit ?

The /proc/sys/vm/overcommit_memory is 0 (the default is 0, no ?)

This is test program, memstress.c. We make sure we touch all allocated chunks.

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


int main(int argc, char **argv) {
    char *p;
    int size = 10*1024*1024;
    int k;
    int bypass_prompt = 0;
    int mb = 0;
    int bytes = 0;

    printf("Warning this allocation test may kill your computer by
exhausting the swap+memory\n");
    if( argc > 1 && 0 == strcmp("-f", argv[1])) {
        bypass_prompt = 1;
    }
    if(!bypass_prompt) {
        printf("Press Enter to proceed, or Ctrl-C to cancel; or use -f
option to bypass the prompt\n");
        getchar();
    }


    for(k=0; ; k++)  {
        p = malloc(size);
        if(p) {
            memset(p, 0xff, size );
            bytes += size;
            printf("%d mb\n", bytes / (1024*1024) );
        }
        poll(0,0, 1);
    }
}

  reply	other threads:[~2006-11-23 13:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-23 12:30 Yakov Lerner
2006-11-23 12:33 ` Yakov Lerner
2006-11-23 12:36 ` Xavier Bestel
2006-11-23 13:03   ` Yakov Lerner [this message]
2006-11-23 14:08   ` Yakov Lerner

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=f36b08ee0611230503q763e03edge12a5e4d0d8b5ed5@mail.gmail.com \
    --to=iler.ml@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xavier.bestel@free.fr \
    /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

all inboxes | Powered by JetHome®