From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([69.77.167.62] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1KxGNR-0008QG-Mt for garchives@archives.gentoo.org; Tue, 04 Nov 2008 07:31:01 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1AD15E01C3; Tue, 4 Nov 2008 07:31:01 +0000 (UTC) Received: from bossdog.realss.com (bossdog.realss.com [211.157.114.130]) by pigeon.gentoo.org (Postfix) with ESMTP id 6113CE01C3 for ; Tue, 4 Nov 2008 07:31:00 +0000 (UTC) Received: from localhost (unknown [127.0.0.1]) by bossdog.realss.com (Postfix) with ESMTP id D90A41C00E6 for ; Tue, 4 Nov 2008 15:31:15 +0800 (CST) Received: from bossdog.realss.com ([127.0.0.1]) by localhost (bossdog.realss.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 05234-06 for ; Tue, 4 Nov 2008 15:31:14 +0800 (CST) Received: from [192.168.1.101] (unknown [221.219.6.9]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by bossdog.realss.com (Postfix) with ESMTP id 72F091C004B for ; Tue, 4 Nov 2008 15:31:14 +0800 (CST) Message-ID: <490FFA2F.9010705@realss.com> Date: Tue, 04 Nov 2008 15:30:55 +0800 From: Zhang Weiwu Organization: Real Softservice User-Agent: Thunderbird 2.0.0.14 (X11/20080621) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] limit maximum memory size of any process References: In-Reply-To: X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at bossdog.realss.com X-Archives-Salt: 46e04e56-7d52-4ca6-b4f7-18763c26fdc0 X-Archives-Hash: df14a597fefc40b0826e9e066d62c2b7 Matthias Bethke wrote: > Hi Zhang, > on Mon, Nov 03, 2008 at 06:24:00PM +0800, you wrote: >> I hope I can configure the system so that any process uses more than 50% >> of memory are automatically killed. first I was recommend to use ulimit >> by googling around. However this seems doesn't work even if I set both >> -d and -m (here is my .xinitrc) >> >> ~$ cat .xinitrc >> #export XMODIFIERS=@im=FCITX >> #fcitx & >> ulimit -d 300000 >> ulimit -m 300 >> exec /usr/bin/fluxbox >> >> >> Result: OpenOffice stands still even when it takes 80% memory (read from >> top). >> So: is ulimit the solution? If so, what option should I set? > > I interpret the above as "use a maximum of 300,000 KiB of memory, of > which 300 may be resident (i.e. in physical memory) and 299,700 swapped > out." That doesn't sound good, although I'm not sure I'm reading it > correctly. Sorry, it seems I used these parameter without care. I guess I only need to set physical memory limit, a.k.a. resident memory. OT: I don't know why I have max locked memory (kbytes, -l) 32 But it has been like that before I set ulimit. > What I do is use /etc/sercurity/limits.conf (from pam_limits) with a > couple of entries like those: > | @users hard nproc 1000 > | mb hard nproc 5000 > | @users hard as 2097152 > | mb hard as 6291456 > | mb hard nice -5 > | mb hard rtprio 5 > Meaning, everyone but me (mb) may use up to 1000 processes per login, > with a max. address space of 2 GiB each; for myself the limit is 6 GiB > and 5k processes. Myself I cannot accidentially set a negative > nice-value because I left the soft limit at its default (0 for non-root > users) but using ulimit I can set it to the hard limit of -5 and nice-up > processes even as a normal user. I don't have a file called /etc/sercurity/limits.conf and neither can I find information about it by using 'man limits.conf'. Further I couldn't find a package called pam_limits to emerge. Can you give me some clue which package I should emerge in order to set limits.conf ? Thank you very much for prompt help!