Re: [RFC] [PATCH] VM & VFS changes

From: Andre Guibert de Bruet <andy_at_siliconlandmark.com>
Date: Wed, 1 Jun 2005 08:53:15 -0400 (EDT)
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.       */
Received on Wed Jun 01 2005 - 10:53:21 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:35 UTC