headsup: swap_pager.c

Poul-Henning Kamp phk at phk.freebsd.dk
Thu Jul 31 14:19:36 PDT 2003


I am in the process of changing the on-disk layout policy used by
the swap_pager.

Currently we have a compiled in max number of swap devices, and the
virtual "swapdevice" is striped over these.

People who do not adjust NSWAPDEV to match their configuration spend
a lot of RAM on holding the radix bitmap which is 3/4 empty:

	critter phk> sysctl kern.malloc | grep -i swap
		 SWAP     2   753K    753K        2  64
	critter phk> pstat -s
	Device          1K-blocks     Used    Avail Capacity
	/dev/ad0s1b       1321312        0  1321312     0%

This is because the radix bitmap gets allocated for the full
stripe width, but only one quarter of it is actually used.

Another thing is that striping does not belong in the swap_pager in
the first place, we have CCD and similar pieces of code for that.


The new layout will allocate the devices sequentially in the "virtual
swapdevice" and allocation will (for now) be round robin between
the devices.  Later I would like to implement load based device
selection (ie: pick the device with the lowest recent average access
time).

If disk striping is necessary for the disks used for swap-space,
do it with ccd(4) and call swapon on that.

This change will also remove the compiled in limit on the number
of swapdevices, and may also increase the upper size limit for each
swap device by a factor four.

Casualties of this will the ability to get swap information out of
kvm images.  If this, contrary to current evidence is very important
to us, we can reimplement it later.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.


More information about the freebsd-arch mailing list