Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Nov 2011 18:22:36 +0200
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Andreas Tobler <andreast-list@fgznet.ch>
Cc:        FreeBSD Arch <freebsd-arch@freebsd.org>
Subject:   Re: powerpc64 malloc limit?
Message-ID:  <20111130162236.GA50300@deviant.kiev.zoral.com.ua>
In-Reply-To: <4ED5BE19.70805@fgznet.ch>
References:  <4ED5BE19.70805@fgznet.ch>

next in thread | previous in thread | raw e-mail | index | archive | help

--MaxviSYR+Gwa10R8
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Nov 30, 2011 at 06:24:41AM +0100, Andreas Tobler wrote:
> All,
>=20
> while working on gcc I found a very strange situation which renders my=20
> powerpc64 machine unusable.
> The test case below tries to allocate that much memory as 'wanted'. The=
=20
> same test case on amd64 returns w/o trying to allocate mem because the=20
> size is far to big.
>=20
> I couldn't find the reason so far, that's why I'm here.
>=20
> As Nathan pointed out the VM_MAXUSER_SIZE is the biggest on powerpc64:
> #define VM_MAXUSER_ADDRESS      (0x7ffffffffffff000UL)
>=20
> So, I'd expect a system to return an allocation error when a user tries=
=20
> to allocate too much memory and not really trying it and going to be=20
> unusable. Iow, I'd exepect the situation on powerpc64 as I see on amd64.
>=20
> Can anybody explain me the situation, why do I not have a working limit=
=20
> on powerpc64?
>=20
> The machine itself has 7GB RAM and 12GB swap. The amd64 where I compared=
=20
> has around 4GB/4GB RAM/swap.
>=20
> TIA,
> Andreas
>=20
> include <stdlib.h>
> #include <stdio.h>
>=20
> int main()
> {
>          void *p;
>=20
>          p =3D (void*) malloc (1152921504606846968ULL);
>          if (p !=3D NULL)
>                  printf("p =3D %p\n", p);
>=20
>          printf("p =3D %p\n", p);
>          return (0);
> }

First, you should provide details of what consistutes 'the unusable
machine situation' on powerpc.

That said, on amd64 the user map is between 0 and 0x7fffffffffff, which
obviously less then the requested allocation size 0x100000000000000.
If you look at the kdump output on amd64, you will see that malloc()
tries to mmap() the area, fails and retries with obreak(). Default
virtual memory limit is unlimited, so my best quess is that on amd64
vm_map_findspace() returns immediately.

On powerpc64, I see no reason why vm_map_entry cannot be allocated, but
please note that vm object and pages shall be only allocated on demand.
So I am curious how does your machine breaks and where.

--MaxviSYR+Gwa10R8
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (FreeBSD)

iEYEARECAAYFAk7WWEwACgkQC3+MBN1Mb4iCKwCfYPE7yETlYQz1KTZDJrcHQFYU
eAkAnRLJQco/VXNjHPN3QMIYl1XyZo+C
=Jwut
-----END PGP SIGNATURE-----

--MaxviSYR+Gwa10R8--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111130162236.GA50300>