From owner-freebsd-arch Mon Mar 24 13:35:29 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 0313E37B404 for ; Mon, 24 Mar 2003 13:35:26 -0800 (PST) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1E10143F75 for ; Mon, 24 Mar 2003 13:35:25 -0800 (PST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.7/8.12.7) id h2OLZKPB045421; Mon, 24 Mar 2003 15:35:20 -0600 (CST) (envelope-from dan) Date: Mon, 24 Mar 2003 15:35:20 -0600 From: Dan Nelson To: Poul-Henning Kamp Cc: Wes Peters , freebsd-arch@FreeBSD.ORG Subject: Re: Patch to protect process from pageout killing Message-ID: <20030324213519.GA63147@dan.emsphone.com> References: <200303240823.48262.wes@softweyr.com> <7019.1048523782@critter.freebsd.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7019.1048523782@critter.freebsd.dk> 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), Poul-Henning Kamp said: > In message <200303240823.48262.wes@softweyr.com>, Wes Peters writes: > > As promised, here's the patch to protect a process from being > > killed when pageout is in memory shortage. This allows a process > > to specify that it is important enough to be skipped when pageout > > is looking for the largest process to kill. > > > > My needs are simple. We make a box that is a web proxy and runs > > from a memory disk, using flash for permanent storage. The flash > > is mounted only when a configuration write is needed, the box runs > > from the memory disk. We've experienced a problem at certain > > customer sites where bind will consume a lot (~30 MB) of ram and > > then pageout will kill the largest process, which is usually either > > named or squid. This pretty much kills the box. We'd much rather > > have pageout kill off some of the squid worker processes, we can > > recover from that. > > > > Is this a good approach to the problem? Feedback welcome. > > I can certainly see the point, but I'm not sure this is the way. > > I am not sure that we want to use the resource limits facility for > booleans, some of the logic sourounding the suser checks may not hold > tight. 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. -- Dan Nelson dnelson@allantgroup.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message