From owner-svn-src-all@FreeBSD.ORG Wed Jan 28 11:27:14 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E1C6D1065674; Wed, 28 Jan 2009 11:27:14 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id 73B9D8FC0C; Wed, 28 Jan 2009 11:27:14 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-107-120-227.carlnfd1.nsw.optusnet.com.au (c122-107-120-227.carlnfd1.nsw.optusnet.com.au [122.107.120.227]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n0SBQnH4015485 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 28 Jan 2009 22:26:50 +1100 Date: Wed, 28 Jan 2009 22:26:49 +1100 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Kostik Belousov In-Reply-To: <20090126201146.GD2009@deviant.kiev.zoral.com.ua> Message-ID: <20090128221540.M45316@delplex.bde.org> References: <200901230058.n0N0wEjY026935@svn.freebsd.org> <20090125162123.GB17198@hoeg.nl> <20090126041926.J43097@delplex.bde.org> <20090125175751.GC17198@hoeg.nl> <20090126051910.E2148@besplex.bde.org> <20090126190310.GA31728@zim.MIT.EDU> <20090126201146.GD2009@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Ed Schouten , src-committers@FreeBSD.org, Tom Rhodes , svn-src-all@FreeBSD.org, Bruce Evans , svn-src-head@FreeBSD.org, David Schultz Subject: Re: svn commit: r187607 - head/usr.bin/truss X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 11:27:15 -0000 On Mon, 26 Jan 2009, Kostik Belousov wrote: > On Mon, Jan 26, 2009 at 02:03:10PM -0500, David Schultz wrote: >> On Mon, Jan 26, 2009, Bruce Evans wrote: >>> - P_SYSTEM has something to do with swapping, and I also removed the >>> PS_INMEM setting for init. I have always used NO_SWAPPING and haven't >>> used a swap partition since memory sizes reached 64MB, so I wouldn't >>> have noticed problems with this. init doesn't run often so it is >>> quite likely to be swapped (if allowed to) if real memory runs out. >> >> Process kstack swapping was removed several years ago, so >> "swapping out" a process just deactivates all of its pages. >> In principle this could be safe to do with init, but it's probably >> a bad idea, and perhaps could lead to deadlock in the >> out-of-swap-space -> kill a process -> reparent the zombie to init >> path. PS_INMEM will prevent init from being swapped out. > > Process kernel stacks swapping, or more explicitely, allowance to page out > threads kernel stacks, is in the kernel. It is performed by vmdaemon, > look for the call to swapout_procs(). > > Kernel stack contains pcb, but not the struct thread. Notifying the target > process about raised signal requires only struct proc and referenced > structures (p_sigact, p_sigqueue etc) that cannot be paged out. > > More interesting propery of the P_SYSTEM process is the immunity to the > oom killer. But vm_pageout_oom() explicitely cares to not kill pid 1 > or pid < 48. Anyway, I now think my removal of the explicit setting of PS_INMEM is just a style fix (removal of dead code). PS_INMEM is set for process 0 and should be inherited on fork for all processes including init; it should only be cleared for any process long after the fork of init, if swapping occurs, as part of swapping out (mainly to indicate that the swapout has occurred). If swapping out of init is to be prevented, then it should be done of init should be prevented using a flag different from P_SYSTEM, since P_SYSTEM has too much scope and the pid hacks are ugly, but the pid hacks work for now. Bruce