qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Rob Landley <rob@landley.net>
To: Paul Brook <paul@codesourcery.com>
Cc: Markus Hitter <mah@jump-ing.de>,
	qemu-devel@nongnu.org, Robert Reif <reif@earthlink.net>
Subject: Re: [Qemu-devel] [PATCH] fix possible NULL pointer use in hw/ptimer.c
Date: Fri, 4 Jan 2008 20:47:02 -0600	[thread overview]
Message-ID: <200801042047.03059.rob@landley.net> (raw)
In-Reply-To: <200801050107.59131.paul@codesourcery.com>

On Friday 04 January 2008 19:07:58 Paul Brook wrote:
> > On modern operating systems, allocations only return zero when you
> > exhaust virtual memory.  Returning nonzero doesn't mean you have enough
> > memory, because it's given you a redundant copy on write mapping of the
> > zero page and will fault in physical pages when you write to 'em, which
> > has _no_ return value.  Instead, the out of memory killer will shoot your
> > program in the head in the middle of it's run
>
> Decent operating systems allow the system administrator gets to choose how
> optimistic memory allocation is. You're describing wildly-optimistic mode,
> which is often but not always the default.

True, but if you completely disable overcommit then fork() a large process and 
exec() a small one, you haven't got enough memory even though you're not 
really _using_ any to do so.

You can disable overcommit and give the system an egregious amount of swap 
space, but then your pathological case is the system going into swap 
thrashing la-la land and essentially freezing (advancing at 0.1% of its 
normal rate, if that, for _hours_) instead of killing some runaway processes 
(or rebooting) and recovering.  Not necessarily and improvement, especially 
if you're the one with the pager.

It is alas, not a simple problem to get right.  fork() and exec() being 
separate system calls isn't always an improvement over a combined one.  
(Espeically since exec() needs a file, not a file handle.  You can't re-exec 
your current process unless you can find and reopen it, you can't exec() from 
a pipe...  And then there's nommu vfork(), always fun...)

> Paul

Rob
-- 
"One of my most productive days was throwing away 1000 lines of code."
  - Ken Thompson.

  reply	other threads:[~2008-01-05  2:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-03  2:29 [Qemu-devel] [PATCH] fix possible NULL pointer use in hw/ptimer.c Robert Reif
2008-01-03  2:43 ` Paul Brook
2008-01-03  2:57   ` Robert Reif
2008-01-03 14:02     ` Paul Brook
2008-01-04 17:29       ` Markus Hitter
2008-01-04 17:44         ` Paul Brook
2008-01-04 18:14           ` Robert Reif
2008-01-05  0:44         ` Rob Landley
2008-01-05  1:07           ` Paul Brook
2008-01-05  2:47             ` Rob Landley [this message]
2008-01-05  9:55               ` Markus Hitter
2008-01-06 12:14                 ` Avi Kivity

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=200801042047.03059.rob@landley.net \
    --to=rob@landley.net \
    --cc=mah@jump-ing.de \
    --cc=paul@codesourcery.com \
    --cc=qemu-devel@nongnu.org \
    --cc=reif@earthlink.net \
    /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;
as well as URLs for NNTP newsgroup(s).