From owner-cvs-src Wed Mar 19 6:37:51 2003 Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 899B037B401; Wed, 19 Mar 2003 06:37:45 -0800 (PST) Received: from vinyl.catpipe.net (vinyl.catpipe.net [195.249.214.189]) by mx1.FreeBSD.org (Postfix) with ESMTP id A188143F3F; Wed, 19 Mar 2003 06:37:43 -0800 (PST) (envelope-from regnauld@vinyl.catpipe.net) Received: by vinyl.catpipe.net (Postfix, from userid 1006) id E79152E13; Wed, 19 Mar 2003 15:36:19 +0100 (CET) Date: Wed, 19 Mar 2003 15:36:19 +0100 From: Phil Regnauld To: Wes Peters Cc: Juli Mallett , Eivind Eklund , Mike Silbersack , David Schultz , src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/vm vm_map.c vm_map.h vm_pageout.c Message-ID: <20030319143619.GA47243@catpipe.net> References: <200303122313.h2CNDHMU046431@repoman.freebsd.org> <20030314012954.A42430@FreeBSD.org> <20030314101857.A98861@FreeBSD.org> <200303171156.40901.wes@softweyr.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200303171156.40901.wes@softweyr.com> User-Agent: Mutt/1.3.27i Received: from tetard.starbsd.org ([62.242.165.154]) by moof.catpipe.net (8.12.8/8.11.6) with ESMTP id h2JEag64028688 for ; Wed, 19 Mar 2003 15:36:42 +0100 (CET) (envelope-from regnauld@starBSD.org) Received: by tetard.starbsd.org (Postfix, from userid 1001) id 7C0F716E5D; Wed, 19 Mar 2003 15:33:03 +0100 (MET) X-message-flag: Outlook: spreading viruses since 1997! http://www.rodos.net/outlook/ X-Operating-System: FreeBSD 4.6-RELEASE i386 Organization: *BSD X-Spam-Status: No, hits=-3.2 required=5.0 tests=IN_REP_TO,MSG_ID_ADDED_BY_MTA_2 version=2.11 Sender: owner-cvs-src@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Wes Peters (wes) writes: > > o Add a flag in the proc struct signalling 'don't kill me'. This flag > is not inheritable. (I recycled the now-deprecated P_NOSWAP flag for > this). > > o Hack squid and a few other essential and potentially large programs > (such as bind) to set this flag. > > This change effectively stopped our system from committing suicide, > encouraging it to kill off worker-slave processes that can be restarted > when load reduces instead of killing the heart of the box. I can work > up a patch if someone would like to see this on a recent system. Funny you mention this approach -- I came up with a similar idea back in November. This is how I formulated it back then: ... Problem with overcommit if that if a process eats ram like a pig, or leaks, or runs away, it will still be the last process after that (the one that makes the overflow) to touch a page after the resource hog that buys it. And there goes X11. Idea: a "contract" mechanism by which a process registers to the kernel and says "ok, during my life, I will never go over X MB RAM (effective, not overcommit)". Warning: this is not a malloc, just a hint. - if the process respects its contract, stays below X (good memory policy, reuses its pools to the max, etc...), then when both VM and physical mem are exhausted, this process will not be lined up against the wall - if a process does not respect its quota, it loses its privileges, and when/if memory runs out, it gets a last cigarette like the others - if a process comes after the others, and asks for a "garantee" X which is superior to whatever is left, then the demand is refused. it's left up to the process to decide what to do - if all reg'ed processes on the system have resspected their contract, but there's no more memory anyway, then we have to shoot one -- probably the most recent contractor, or the one eating the least/most mem (arbitrarily ?) Applications that would benefit greatly: any large monolithic semi-critical subsystem (Oracle, X11, ...) Applications not needing it: any pre-forked base app (Apache et al.) Cases to manage: 1) P asks 50 MB uses 40. VM usage increases. Finally there is only 5 MB left. P touches 6 MB of pages, i.e. 1 MB too much => ? 2) what about forks and exec ? fork: parent/child relationship, global quota: the parent must plan usage in VM of all its children (Apache, Postfix, ...) ... or by process ? exec: new processes not protected by contract unless explicitly told to be. Global quota inherited, but not duplicated (same area/qty, minus pages not released by old process). useful for binaries for which we don't have sources: write a wrapper for the binary, or use a login.conf demon class, contract for the mem you need, exec the binary Questions: has it already been done ? would it be useful ? Cheers, Phil -- _ _ |_ | regnauld@catpipe.net catpipe Systems ApS | (_(_||_ | *BSD solutions, consulting, development | | Tlf.: +45 7021 0050 http://www.catpipe.net/ | To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-src" in the body of the message