public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Per Hallsmark <per.hallsmark@t2data•se>
To: linuxppc-embedded <linuxppc-embedded@ozlabs•org>,
	Martin Egholm Nielsen <martin@egholm-nielsen•dk>
Subject: RE: Overcommit (OOM) problem on embedded device (PPChameleon)
Date: Wed, 30 Mar 2005 12:30:43 +0200	[thread overview]
Message-ID: <42416091@webmail> (raw)

I think your main problem is that the stock 2.4.x kernel doesn't support
ovecommit_memory type 2 (i believe)...
Look in mm/mmap.c and search for overcommit_memory, then do same
in the sources for your redhat kernels.

Perhaps there's a patch for it floating around somewhere? ;-)

>===== Original Message From Martin Egholm Nielsen <martin@egholm-nielsen•dk> 
=====
>Hi there,
>
>I hope this is the place to go...
>
>I have a some problems figuring out the OOM-killer and configuring the
>overcommit_memory parameter. Hope someone here can guide me in the right
>directions...
>
>Specs:
>I'm having an embedded Linux system running on a PPC405EP (PPChameleon)
>with 64 megs of RAM, some flash, but (ofcourse) no swap space. It runs a
>2.4.20 kernel patched with drivers for my device.
>
>Problem:
>I have an application that is killed by the OOM (I guess) when it tries
>to "use" more memory than present on the system.
>Bolied down, memory is allocated with "sbrk" and then touch'ed (see
>test-application below).
>
>With "/proc/sys/vm/overcommit_memory" set to 2, I expected that "sbrk"
>would return "-1L" (0xFFFFFFFF), but it doesn't, hence is
>terminated/killed by the kernel.
>
>However, both my desktop Linux (RH 7.3)/2.4.18-10/i386 and Linux
>(FC2)/2.6.5/i386 did what I expected:
>
># ./exhaust_mem
>...
>ffffffff
>
>Out of memory
># #Yeaaaah!
>
>Having searched the web, I see that this may be related with the fact
>that there is no swap enabled on the embedded device.
>However, I tried disabling the swap (commented in fstab), but the
>desktop linux still behaves "correct".
>
>Can I do anything in order to get it the way I expected?
>
>Best regards,
>  Martin Egholm
>
>=== exhaust_mem.c ===
>
>#include <unistd.h>
>#include <stdio.h>
>#define SIZE 1000000
>
>int main( int i )
>{
>   while ( 1 ) {
>     char *v = sbrk( SIZE );
>     char *p;
>
>     printf( "%x\n\n", v );
>
>     if ((long)v < 0) {
>       fprintf(stderr, "Out of memory\n");
>       exit(1);
>     } // if
>
>     for (p = v; p < v + SIZE; ++p) {
>       *p = 42;
>     } // for
>
>   } // while
>} // main
>
>
>
>
>
>
>_______________________________________________
>Linuxppc-embedded mailing list
>Linuxppc-embedded@ozlabs•org
>https://ozlabs.org/mailman/listinfo/linuxppc-embedded

             reply	other threads:[~2005-03-30 10:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-30 10:30 Per Hallsmark [this message]
2005-03-31  6:50 ` Overcommit (OOM) problem on embedded device (PPChameleon) Martin Egholm Nielsen
2005-03-31  8:23 ` Martin Egholm Nielsen
2005-03-31 16:15   ` David Adair
2005-03-31 20:13     ` Martin Egholm Nielsen
2005-04-01  9:58     ` Martin Egholm Nielsen
  -- strict thread matches above, loose matches on Subject: below --
2005-03-29 19:30 Martin Egholm Nielsen
2005-03-29 19:46 ` Eugene Surovegin

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=42416091@webmail \
    --to=per.hallsmark@t2data$(echo .)se \
    --cc=linuxppc-embedded@ozlabs$(echo .)org \
    --cc=martin@egholm-nielsen$(echo .)dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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