From owner-freebsd-arch Mon Mar 24 19:24:26 2003 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E097E37B43A for ; Mon, 24 Mar 2003 19:24:21 -0800 (PST) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 31CF343FB1 for ; Mon, 24 Mar 2003 19:24:21 -0800 (PST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.7/8.12.7) id h2P3OKhi096231; Mon, 24 Mar 2003 21:24:20 -0600 (CST) (envelope-from dan) Date: Mon, 24 Mar 2003 21:24:20 -0600 From: Dan Nelson To: Poul-Henning Kamp , Wes Peters , freebsd-arch@FreeBSD.ORG Subject: Re: Patch to protect process from pageout killing Message-ID: <20030325032420.GA22424@dan.emsphone.com> References: <200303240823.48262.wes@softweyr.com> <7019.1048523782@critter.freebsd.dk> <20030324213519.GA63147@dan.emsphone.com> <20030325012844.GB4406@HAL9000.homeunix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030325012844.GB4406@HAL9000.homeunix.com> X-OS: FreeBSD 5.0-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.4i X-Spam-Status: No, hits=-26.0 required=5.0 tests=IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES,REPLY_WITH_QUOTES, USER_AGENT_MUTT autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In the last episode (Mar 24), David Schultz said: > Thus spake Dan Nelson : > > How about changing the kill logic to look at RLIMIT_RSS? The > > process exceeding its limit by the largest amount gets killed. > > That way you can exempt certain processes by raising their limit. > > Set named's limit to say 10MB, and when memory gets tight the > > system will see it's exceeding its quota by 20MB and kill it first. > > I think that's overengineering the problem. First of all, it means > that on any system where RLIMIT_RSS is unlimited by default, the > machine now deadlocks when it runs out of memory. Second, it is only > marginally useful to go as far as specifying priorities and quotas > and such on process killability. Most of the time, people can divide > the processes on thier system into two categories: critical and > killable. RSS overcommit would be the first sort priority. If nothing is over its limit, you fall back on the old "biggest process dies" rule. Set the critical processes at an infinite RSS, set the killable ones at a reasonable RSS, set your cannon fodder processes at 0. The default RSS is infinity so you get classic behaviour. In the embedded server case, there's no swap space so the RSS limit isn't even being used anyway. There is still the inheritance problem, though, so a RSS=inf daemon would have to manually set the rlimit to 0 after forking a killable process. -- Dan Nelson dnelson@allantgroup.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message