Subject: Re: swapoff=YES as default? (was Re: Additional swap/dump magic)
To: None <tech-userlevel@NetBSD.org>
From: Daniel Carosone <dan@geek.com.au>
List: tech-userlevel
Date: 08/29/2006 10:46:45
--5uO961YFyoDlzFnP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Tue, Aug 29, 2006 at 01:15:36AM +0200, Klaus Heinz wrote:
> Can anyone tell me why changing the default of swapoff=NO to swapoff=YES
> in /etc/defaults/rc.conf would be wrong?

The concern is that it makes rebooting slower: swapoff forces the
contents to be paged in, mostly to be thrown away again shortly after.

If you have multiple swap spaces, you could end up paging other stuff
out to swap2 to make room for the contents of swap1, and then paging
in again when you swapoff swap2.

It might even hang or livelock the reboot, if there's something that
won't die holding on to those pages when swapoff is run.

That's the concern. Whether it justifies the setting, or whether some
smarter response (perhaps involving a watchdog or timeout around the
swapoff?) might better address the concern, is another question.

It also seems possible that the kernel could close the device once the
last process owning pages in the swap space exits, long after a
userland swapoff might have a chance to make a difference.  There was
a discussion a while back about shutdown hook ordering that is
relevant here, where swap, raid, cgd, etc devices might be stacked in
different orders.

--
Dan.
--5uO961YFyoDlzFnP
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (NetBSD)

iD8DBQFE8450EAVxvV4N66cRAm9gAJoCo7r1VjkSugNqGkeNLoRkAfxChACeJG8u
B2I+BgTdP4jqrap9J0ah3jw=
=g0/x
-----END PGP SIGNATURE-----

--5uO961YFyoDlzFnP--