Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Jan 2009 19:51:45 GMT
From:      Kirk Strauser <kirk@strauser.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/130274: Can't shmget() more than 2GB of memory, regardless of kern.ipc.shm{max, all}
Message-ID:  <200901071951.n07JpjXH050990@www.freebsd.org>
Resent-Message-ID: <200901072000.n07K06tm071774@freefall.freebsd.org>

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

>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@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:



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