Subject: Re: qemu and "Could not allocate physical memory"
To: Joel CARNAT <joel@carnat.net>
From: Lubomir Sedlacik <salo@Xtrmntr.org>
List: netbsd-users
Date: 09/26/2005 11:59:39
--Yia77v5a8fyVHJSl
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Sep 26, 2005 at 11:19:54AM +0200, Joel CARNAT wrote:
> I'm trying to get qemu use more than 64Mbits of RAM (with 3.0_BETA and
> 3.99.8, both i386, and 512Mo of RAM). Google points me to ulimit but
> it doesn't seem to be my problem (my bash has ulimit=3Dunlimited, and
> running qemu as root isn't better).
>=20
> I noticed some value in sysctl :
> proc.curproc.rlimit.datasize.soft =3D 134217728
> proc.curproc.rlimit.datasize.hard =3D 1073741824
>=20
> proc.curproc.rlimit.datasize.soft looks like the one than has to be
> modified. I tried doing so :
> # sudo sysctl -w proc.curproc.rlimit.datasize.soft=3D0
> proc.curproc.rlimit.datasize.soft: 134217728 -> 0
> # sudo sysctl -w proc.curproc.rlimit.datasize.soft=3D536870912
> proc.curproc.rlimit.datasize.soft: 134217728 -> 536870912

you are raising limits for the sysctl(8) process itself.

> each time, it goes back to it's initial value...
> so :
> 1. any trick to have qemu use 128Mo or 256Mo ?

you need to raise the limits for the shell executing qemu.  use
ulimit/limit commands of your shell to change datasize soft limit (e.g.,
for bourne style shells: ulimit -d).

> 2. any trick to modify datasize.soft, if it's the solution to my pb ?

you need to change proc.$pid_of_the_process.rlimit.datasize.soft, not
proc.curproc.rlimit.datasize.soft.  see also sysctl(8):

 EXAMPLES

     ...

     To redirect core dumps to the /var/tmp/<username> directory,
           sysctl -w proc.$$.corename=3D/var/tmp/%u/%n.core
     should be used.
           sysctl -w proc.curproc.corename=3D/var/tmp/%u/%n.core
     changes the value for the sysctl process itself, and will not have
     the desired effect.


regards,

--=20
-- Lubomir Sedlacik <salo@{NetBSD,Xtrmntr,silcnet}.org>   --

--Yia77v5a8fyVHJSl
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)

iD8DBQFDN8aKiwjDDlS8cmMRAjiQAJ45kuxVQ9tqtDRUe8WmINSnqOLk0QCfY8nl
6wUm0k5xxVUYowVp4SwYG+w=
=rMsr
-----END PGP SIGNATURE-----

--Yia77v5a8fyVHJSl--