From: Chase Venters <chase.venters@clientec.com>
To: "Abu M. Muttalib" <abum@aftek.com>
Cc: Robin Holt <holt@sgi.com>, Alan Cox <alan@lxorguk.ukuu.org.uk>,
nickpiggin@yahoo.com.au, Robert Hancock <hancockr@shaw.ca>,
chase.venters@clientec.com, kernelnewbies@nl.linux.org,
linux-newbie@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm <linux-mm@kvack.org>
Subject: RE: Commenting out out_of_memory() function in __alloc_pages()
Date: Tue, 11 Jul 2006 10:35:58 -0500 (CDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0607111025320.19812@turbotaz.ourhouse> (raw)
In-Reply-To: <BKEKJNIHLJDCFGDBOHGMEEJMDCAA.abum@aftek.com>
On Tue, 11 Jul 2006, Abu M. Muttalib wrote:
>
> I fail to understand that why the OS doesn't return NULL as per man pages of
> malloc. It insteat results in OOM.
Well, my "malloc" manpage describes the Linux behavior under "Bugs",
though it gives the overcommit practice a harsh and unfair treatment. Let
me give you an example of why the OS behaves in this way.
Say I've got an Apache web server that is going to fork() 10 children.
Under traditional fork() semantics, you need 10 copies of all of the
memory holding stuff like configuration structures, etc. There are two
reasons why we might not want 10 copies:
1. Some of those pages of data won't change. So why have 10 copies that
you're going to have to constantly move in and out of cache?
2. Why waste that memory in the first place?
Now, if we were just worried about #1, we could "reserve" room for 9
copies and still share the single copy (in a CoW scheme). But the act of
reserving the room would probably just slow fork() down needlessly (when
fork() is one of the most common and possibly expensive system calls).
Now apps get overcommitted memory too because they do things like ask for
a ton of memory and then not use it, or use it gradually... in either
case, Linux (by default) gambles that it can make better choices.
And it turns out that in 999 out of 1000 cases, it can.
If you want strict malloc(), you can use the sysctl to turn off
overcommit. It's even appropriate to do so for certain applications.
> ~Abu.
>
Thanks,
Chase
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2006-07-11 15:35 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-07 9:46 Abu M. Muttalib
2006-07-07 9:54 ` Robin Holt
2006-07-11 14:57 ` Abu M. Muttalib
2006-07-11 15:08 ` Abu M. Muttalib
2006-07-11 15:19 ` Abu M. Muttalib
2006-07-13 5:12 ` Mouhammad Tayseer Alquoatli
2006-07-11 15:35 ` Chase Venters [this message]
2006-07-24 9:44 ` Abu M. Muttalib
2006-07-07 21:21 ` Chase Venters
[not found] <fa.AmXizdwfdZtqgKFSMcRp3U0QZXI@ifi.uio.no>
2006-07-08 18:06 ` Robert Hancock
2006-07-09 4:23 ` Abu M. Muttalib
2006-07-09 5:18 ` Chase Venters
2006-07-09 6:11 ` Abu M. Muttalib
2006-07-09 7:55 ` Chase Venters
2006-07-09 11:55 ` Alan Cox
2006-07-09 11:48 ` Abu M. Muttalib
2006-07-09 12:01 ` Willy Tarreau
2006-07-09 12:13 ` Abu M. Muttalib
2006-07-09 12:15 ` Willy Tarreau
2006-07-09 13:12 ` Abu M. Muttalib
2006-07-09 13:23 ` Willy Tarreau
2006-07-09 12:09 ` Alan Cox
2006-07-09 12:03 ` Abu M. Muttalib
2006-07-09 12:03 ` Nick Piggin
2006-07-09 14:34 ` Abu M. Muttalib
2006-07-09 15:15 ` Nick Piggin
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=Pine.LNX.4.64.0607111025320.19812@turbotaz.ourhouse \
--to=chase.venters@clientec.com \
--cc=abum@aftek.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=hancockr@shaw.ca \
--cc=holt@sgi.com \
--cc=kernelnewbies@nl.linux.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-newbie@vger.kernel.org \
--cc=nickpiggin@yahoo.com.au \
/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