From owner-freebsd-hackers Sat Jul 6 00:22:43 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id AAA25560 for hackers-outgoing; Sat, 6 Jul 1996 00:22:43 -0700 (PDT) Received: from helmholtz.salk.edu (helmholtz.salk.edu [198.202.70.34]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id AAA25546 for ; Sat, 6 Jul 1996 00:22:30 -0700 (PDT) Received: from helmholtz (helmholtz [198.202.70.34]) by helmholtz.salk.edu (8.7.5/8.7.3) with SMTP id AAA18851 for ; Sat, 6 Jul 1996 00:22:26 -0700 (PDT) Date: Sat, 6 Jul 1996 00:22:25 -0700 (PDT) From: Tom Bartol X-Sender: bartol@helmholtz To: hackers@freebsd.org Subject: Shared Memory Questions Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Hello FreeBSD Hackers, I have a few questions regarding shared memory in FreeBSD. I've been using FreeBSD 2.1.0-release since it came out in November, 1995 and think is the best free unix for intels machines without a doubt. Many thanks to the FreeBSD team and hackers for your heroic contribution to the OS world! Now for my questions: I'm running an excellent image manipulation tool called "The Gimp" on a P5/133 with 64MB RAM and FreeBSD 2.1.0-release. This program makes extensive use of shared memory for iterprocess communication with external image manipulation modules called "plug-ins". These plug-ins are user customizable and give the gimp incredible power and potential. The documentation with the gimp talks about how most unix varieties have default shared memory parameters which are set too low to handle many of the things that the gimp needs to do, especially when you try to operate on large images. Sure enough, on my machine I run out of shared memory when I try to manipulate or load large images. ipcs -M gives me the following output: shminfo: shmmax: 4194304 (max shared memory segment size) shmmin: 1 (min shared memory segment size) shmmni: 32 (max number of shared memory identifiers) shmseg: 8 (max shared memory segments per process) shmall: 1024 (max amount of shared memory in pages) which I suppose is telling me that my max seg size is only ~4MB, and since the pagesize command tells me that a page is only 4096 bytes I can only allocate a total of 1024*4096 bytes in shared memory anyway! I've poked around in the kernel sources and FAQ's that come with 2.1.0-release and have found only one small FAQ regarding shared memory, namely that in addition to enabling shared memory with the SYSVSHM kernel config option there is an option called SHMMAXPGS which can be set thusly: options "SHMMAXPGS=64" The FAQ shows shared memory being set to 64 pages, or 256KB -- not quite big enough. The LINT kernel config file does not list this option. Upon further investigation I found a kernel source file called /usr/src/sys/conf/param.c which sets the default values for shmmax, shmmin, shmmni, shmseg, and shmall reported by the ipcs -M command as above. Setting SHMMAXPGS to 16384 gave me the expected result of increasing available shared memory to 64MB and I can now open large images but gimp now sometimes runs short on shmseg. I tried increasing this parameter by editing param.c directly and setting shmseg to a nice round figure of 128. The kernel this generated was unstable in that the ipcs -b command would sometimes seg fault and would report nonsense values for which shared memory segments were currently in use etc... I reduce shmseg to 16 which SEEMS to be working O.K. for now, though I still run out of segs in gimp from time to time, but I'd like to be able to choose and tune the shared memory parameters at will, and to do so with config options if possible. Or better yet, why can't the kernel just allow these resources to grow without bound until RAM and VM are exhausted? So, the bottom line is this -- can any of you give some advice on how to tune shared memory in FreeBSD? Are these numbers meant to be hard coded and un-tweekable? Can it be done at all? I really know next to nothing about shared memory and any help you can give would be greatly appreciated (virtual beers etc...) :) Thanx, Tom