From owner-freebsd-arch Mon Mar 24 17:23:13 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 EAF6937B404 for ; Mon, 24 Mar 2003 17:23:05 -0800 (PST) Received: from HAL9000.homeunix.com (12-233-57-131.client.attbi.com [12.233.57.131]) by mx1.FreeBSD.org (Postfix) with ESMTP id ED38A43FAF for ; Mon, 24 Mar 2003 17:23:04 -0800 (PST) (envelope-from das@FreeBSD.ORG) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.6/8.12.5) with ESMTP id h2P1N4ah004584; Mon, 24 Mar 2003 17:23:04 -0800 (PST) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.6/8.12.5/Submit) id h2P1N3Ua004583; Mon, 24 Mar 2003 17:23:03 -0800 (PST) (envelope-from das@FreeBSD.ORG) Date: Mon, 24 Mar 2003 17:23:03 -0800 From: David Schultz To: Wes Peters Cc: freebsd-arch@FreeBSD.ORG Subject: Re: Patch to protect process from pageout killing Message-ID: <20030325012303.GA4406@HAL9000.homeunix.com> Mail-Followup-To: Wes Peters , freebsd-arch@FreeBSD.ORG References: <200303240823.48262.wes@softweyr.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200303240823.48262.wes@softweyr.com> X-Spam-Status: No, hits=-19.6 required=5.0 tests=IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES,REPLY_WITH_QUOTES 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 Thus spake Wes Peters : > 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. Very nice. Inheritance of this attribute seems to be a contentious issue. Making inheritance tunable might be a good idea. You wouldn't be able to piggyback on rlimit, though. There's a significant userland component of this as well, although that's probably a job for another day. It basically consists of making it possible to specify that certain standard system daemons should have this attribute. > + (p->p_flag & P_PROTECTED) || > ((p->p_pid < 48) && (vm_swap_size != 0))) { > PROC_UNLOCK(p); > continue; The pid < 48 magic can probably go away, while you're at it. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message