From owner-freebsd-current@FreeBSD.ORG Wed Jun 1 12:53:21 2005 Return-Path: X-Original-To: current@FreeBSD.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5044616A41C; Wed, 1 Jun 2005 12:53:21 +0000 (GMT) (envelope-from andy@siliconlandmark.com) Received: from lexi.siliconlandmark.com (lexi.siliconlandmark.com [209.69.98.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id DDD6143D4C; Wed, 1 Jun 2005 12:53:20 +0000 (GMT) (envelope-from andy@siliconlandmark.com) Received: from lexi.siliconlandmark.com (localhost [127.0.0.1]) by lexi.siliconlandmark.com (8.13.3/8.13.3) with ESMTP id j51CrFo6037011; Wed, 1 Jun 2005 08:53:15 -0400 (EDT) (envelope-from andy@siliconlandmark.com) Received: from localhost (andy@localhost) by lexi.siliconlandmark.com (8.13.3/8.13.3/Submit) with ESMTP id j51CrFTK037008; Wed, 1 Jun 2005 08:53:15 -0400 (EDT) (envelope-from andy@siliconlandmark.com) X-Authentication-Warning: lexi.siliconlandmark.com: andy owned process doing -bs Date: Wed, 1 Jun 2005 08:53:15 -0400 (EDT) From: Andre Guibert de Bruet To: Don Lewis In-Reply-To: <200506010640.j516efHC091087@gw.catspoiler.org> Message-ID: <20050601083308.D69811@lexi.siliconlandmark.com> References: <200506010640.j516efHC091087@gw.catspoiler.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Information: Please contact the ISP for more information X-SL-MailScanner: Found to be clean X-SL-SpamCheck: not spam, SpamAssassin (score=-2.541, required 6, autolearn=not spam, AWL 0.06, BAYES_00 -2.60) X-MailScanner-From: andy@siliconlandmark.com Cc: current@FreeBSD.org Subject: Re: [RFC] [PATCH] VM & VFS changes X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2005 12:53:21 -0000 On Tue, 31 May 2005, Don Lewis wrote: > On 1 Jun, Andre Guibert de Bruet wrote: >> I would like to present a unified set of VM and VFS diffs for wider >> scrutiny and testing. I have been running these diffs since May 10th >> across daily reboots with no issues. >> >> What this patch does: >> - Adds code that cleanly unmounts swaps (Forcing page-in first) after the >> final sync but before all of the filesystems are unmounted. This causes >> references to swap slices in devfs to not be dangling when the machine is >> rebooted. > > What if there is not enough RAM it page in the swap contents? This may > be likely to happen if swap-backed md(4) devices are used. This code is run after all processes have been killed off. If the machine does not have enough RAM to run idle with just init, in single-user mode, it might not meet the advertised minimum RAM requirements to run FreeBSD. > This problem is a bit complicated because there can be various > combinations of: > > mounted file systems that reside on swap-backed memory disks > > mounted file systems that reside on vnode-backed memory disks > > vnode-backed memory disks used as swap devices > > so that there is no simple ordering of operations that can be used on > shutdown. I think that even some wierd cases like a mounted file system > that resides on a vnode-backed memory disk, whose backing file resides > in a file system that resides on a swap-backed memory disk, might be > legitimate. > > On shutdown, file systems should be unmounted, swap devices should be > disabled, and memory disks should be unconfigured, all in reverse > dependency order. When swap-backed memory disks are unconfigured, their > contents can be discarded and the contents don't have to be paged in > before disabling the backing swap device. > > I don't even want to think about swapping to a swap-backed memory disk. Right now, FreeBSD reboots after killing off processes and unmounting filesystems. I took a long hard look at the VM and shutdown code and came to the conclusion that sw's weren't being disabled before the call to cpu_reset(). You might see in my patch that I am disabling swap the same way that the kernel would if one were using the swapoff command, by means of swap_pager_swapoff(). Since users with the exotic setups you mentioned end up calling this function in-kernel when disabling their exotic swaps, all forward deps are handled, as filesystems have not yet been unmounted. All testing, comments and suggestions appreciated. Thanks for your (as usual) excellent input! :) Andy /* Andre Guibert de Bruet * 6f43 6564 7020 656f 2e74 4220 7469 6a20 */ /* Code poet / Sysadmin * 636f 656b 2e79 5320 7379 6461 696d 2e6e */ /* GSM: +1 734 846 8758 * 5520 494e 2058 6c73 7565 6874 002e 0000 */ /* WWW: siliconlandmark.com * Tormenting bytes since 1980. */