From owner-freebsd-hackers Fri Sep 8 7: 5: 5 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from tungsten.btinternet.com (tungsten.btinternet.com [194.73.73.81]) by hub.freebsd.org (Postfix) with ESMTP id C9F7137B43E for ; Fri, 8 Sep 2000 07:04:58 -0700 (PDT) Received: from host62-6-66-155.btinternet.com ([62.6.66.155] helo=btinternet.com) by tungsten.btinternet.com with esmtp (Exim 3.03 #83) id 13XOly-00006V-00 for freebsd-hackers@freebsd.org; Fri, 08 Sep 2000 15:04:54 +0100 Message-ID: <39B8EFFA.785E6D46@btinternet.com> Date: Fri, 08 Sep 2000 14:56:10 +0100 From: John Toon X-Mailer: Mozilla 4.74 [en] (X11; U; FreeBSD 4.0-RELEASE i386) X-Accept-Language: en MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Subject: Re: Shared Memory Issues References: <39B4BD1D.676139D4@btinternet.com> <20000905230110.A9425@host.cer.ntnu.edu.tw> <39B58ABD.1B215190@btinternet.com> <39B7C08B.5841BA62@linkline.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Lance Rocker wrote: > Hello, > > I too had problems with running out of shared mem segments, so I wrote > my first ever perl script that does something useful for me. I've > attached it to this email and I'll paste it in below too, for > convenience. > > I noticed that many (most?) of the shared mem segments in use, when I > was running out of them, didn't actually have any processes attached to > them. This perl script just goes through, finds those non-attached > shared mem segments, and deletes them. I've found running it > periodically works great for me, you may even want to put it in your > crontab and let it run once a day, just as a little proactive > housekeeping. Hey, nice script. Is there anything Perl can't do these days? ;^) I'm currently just enjoying the power of awk. I hope it doesn't get forgotten in the shadow of Perl. However, it seems strange that you're getting non-attached memory segments. Surely it is the job of the kernel to clean up after processes (if they're badly programmed and don't do it themselves)? Perhaps one program is leaking? My system has been up for two days now since last reboot, I just ran your program, and I had 55 shared memory segments, 0 non-attached... > For the record, here are the kernel options I use with this kernel: > > options SYSVSHM #SYSV-style shared memory > options SYSVMSG #SYSV-style message queues > options SYSVSEM #SYSV-style semaphores > options SHMALL=16384 > options SHMMAX="(SHMMAXPGS*PAGE_SIZE+1)" > options SHMMAXPGS=8192 > options SHMMIN=128 > options SHMMNI=128 > options SHMSEG=96 > > I think that last one makes the biggest difference, and is the one you > may want to make as large as possible, though 96 works fine for my 64MB > of ram. This is a 4.0-release kernel, and I use XFree86 4.0 with > Enlightenment as my window manager. It definitely does! The default setting, as someone correctly pointed out, in LINT, is SHMSEG=9. As you can see above, my system is currently using 55, more than 5X that limit! I've sent in a brief e-mail to freebsd-stable, suggesting that the GENERIC kernel default is altered to something a little higher. The SHMSEG setting is under the "undocumented" options in LINT, which is not helpful or conducive to people fixing this problem. It's a good job freebsd-hackers exists... ;^) The SHMSEG=1024 setting I've got is probably excessive, but I would guess the performance degradation is negligible to non-existent in having more than you need, especially due to FreeBSD's unmatched memory management, as I've noticed no difference in performance. > yes, ipcs and ipcrm are the ones my perl script uses. Check out the > manpage for each of them. . . I like to run "ipcs -mbop" to get a lot > of info about used shared mem segments. > > -Lance Yes, they both have more settings than I was aware of. Oh, the joy of manpages... -- "I'm entirely unaccountable for any moments of sanity contained herein." :s/Windows/UNIX John Toon | j.a.toon@btinternet.com | "Sonnilon" To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message