qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Re: [PATCH 1/4] Add a scatter-gather list type and acce


From: Paul Brook
Subject: Re: [Qemu-devel] Re: [PATCH 1/4] Add a scatter-gather list type and accessors
Date: Wed, 4 Feb 2009 23:58:12 +0000
User-agent: KMail/1.9.9

> >>> Would be nice to check for malloc failures and fail gracefully at
> >>> least.
> >>
> >> Do you mean an exit(1)?  If so we could just put it in qemu_malloc().
> >
> > In theory, some users may be able to cope with malloc failure.  In
> > practice, I don't think anyone can.  I'm open to suggestion.
>
> malloc() will never fail on Linux with overcommit enabled; since Linux
> is fairly useless without overcommit, it means you'll never see a failure.

I disagree about "Linux is fairly useless without overcommit". Certain common 
linux applications maybe, however...

> Other ways of allocating memory (stack growth, first access to anonymous
> memory) are not covered.  They can fail (most ungracefully) without
> strict overcommit control.
>
> So I suggest to have qemu_malloc() and its friends abort on failure.

I'll support this.  In theory it's sometimes possible to recover from Out Of 
Memory conditions. However in practice I don't think there's any real scope 
for this in qemu.  If were allocating huge chunks of ram on the fly then 
something else is already badly wrong.

IMHO pushing the error up (down?) the callchain is unlikely to provide the 
user with significantly better information, we may as well bail out in 
qemu_malloc.

Paul




reply via email to

[Prev in Thread] Current Thread [Next in Thread]