Date: Wed, 10 Dec 2008 17:36:17 +0100 From: "Hell, Robert" <Robert.Hell@fabasoft.com> To: <freebsd-questions@freebsd.org> Subject: PostgreSQL on FreeBSD 7.0 amd64 with more than 2GB shared memory Message-ID: <B710F3299F04664DB6B37C258FDEEB940229B958@FABAMAIL.fabagl.fabasoft.com>
next in thread | raw e-mail | index | archive | help
Hi, I'm trying to run PostgreSQL 8.3 on a FreeBSD 7.0 amd64 server with more than 2GB shared memory. The machine has 32GB RAM installed. After setting kern.ipc.shmmax and kern.ipc.shmall to the appropriate values, I still had no chance to start postgres with more than 2GB of shared memory. I wrote a small test which does the same as postgres: shmget and shmat: #include <sys/ipc.h> #include <sys/shm.h> #include <stdio.h> #include <errno.h> int main() { int shmid, memKey =3D 1; void *memAddress; unsigned long size =3D 2147483648UL; shmid =3D shmget(memKey, size, IPC_CREAT | IPC_EXCL); if (shmid < 0) { printf("shmget failed: %d\n", errno); return 1; } memAddress =3D shmat(shmid, NULL, 0); if (memAddress =3D=3D (void *) -1) { printf("shmat failed: %d\n", errno); } return 0; } I found out that shmget failed with ENOMEM in shmget_allocate_segment (sysv_shm.c) because of an overflow of size (requested shared memory in bytes): int i, segnum, shmid, size; ... size =3D round_page(uap->size); if (shm_committed + btoc(size) > shminfo.shmall) { return (ENOMEM); } When changing size to an unsigned long shmget works - but now shmat then fails again with ENOMEM. Is there any easy way to use a shared memory segment which is larger than 2GB? Kind regards, Robert
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B710F3299F04664DB6B37C258FDEEB940229B958>