kern/130274: Can't shmget() more than 2GB of memory,
regardless of kern.ipc.shm{max, all}
Kirk Strauser
kirk at strauser.com
Wed Jan 7 12:00:07 PST 2009
>Number: 130274
>Category: kern
>Synopsis: Can't shmget() more than 2GB of memory, regardless of kern.ipc.shm{max,all}
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Jan 07 20:00:06 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator: Kirk Strauser
>Release: 7.1-RELEASE
>Organization:
The Strauser Group
>Environment:
FreeBSD db1.daycos.com 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Fri Jan 2 22:14:00 CST 2009 root at db1.daycos.com:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
I cannot use shmget() to allocate 2GB or more of shared memory, regardless of the settings of kern.ipc.shmmax and kern.ipc.shmall. Right now, I have:
$ sysctl kern.ipc.shmmax
kern.ipc.shmmax: 8589934592
$ sysctl kern.ipc.shmall
kern.ipc.shmall: 2097152 # 8GB / 4096
Here's a minimal test program I wrote:
########################
#include <stdio.h>
#include <sys/shm.h>
int main() {
size_t size = 2*1024*1024*1024l - 4096;
int segid;
printf("Requested: %zd\n", size);
segid = shmget(234, size, IPC_CREAT);
if(segid == -1) {
perror("Died");
return;
}
printf("SHM ID : %zd\n", segid);
}
########################
If I define "size" to be no larger than 2GB-4KB, then the program finishes successfully. Otherwise, it fails with [ENOSPC].
>How-To-Repeat:
Try to allocate 2GB or more of shared memory.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list