Subject: Re: VM in NetBSD
To: Roland McGrath <>
From: Dirk Steinberg <>
List: current-users
Date: 02/07/1994 20:16:05
>>>>> "Roland" == Roland McGrath <> writes:

    Roland>    According to the manual page of the vnconfig command,
    Roland> it should allow you to start swapping on a file, by
    Roland> hooking this file up to a special vn-device. I haven't
    Roland> actually tried this (has someone?), but it looks like an
    Roland> option for additional swapspace at runtime.

    Roland> I would also like to be able to add partitions with swapon
    Roland> at runtime when I have not configured them into the
    Roland> kernel.  This hasn't worked for me, and I don't see a
    Roland> reason why it couldn't.

    Roland> Removing partitions at runtime is obviously a stickier
    Roland> issue.  As I understand it, netbsd sprinkles pages evenly
    Roland> across all the active swap partitions.  This makes it
    Roland> difficult to remove partitions; the kernel would need some
    Roland> special swap-reassigning code.  I presume that to allow
    Roland> removal of active swap areas, Linux just allocates
    Roland> linearly so that later space you haven't consumed yet is
    Roland> always removable.

No. To remove an active swap area, Linux (I think) disables writing
new pages to said swap area, walks through the swap area and forces
each used page into memory (using the page fault code). You obviously
have to have enough memory available, or at least other swap areas.
The VMM may decide to swap out those pages being brought in to other
swap areas, but all this should not require any special code. You just
need to

	1. bring in the page,

	2. disassociate the page with the backing store so that the
	   page looks like it has never been paged out.

I don't know much about *BSD VM, but I think it should be possible to
do this in NetBSD, too.