More than one swap device ?

Mike "The Claw" Sullivan mike_s at EBay.Sun.COM
Fri Mar 22 16:52:45 AEST 1991


In <1991Mar22.125135 at anusf.anu.edu.au> mbl900 at anusf.anu.edu.au (Mathew BM LIM) writes:

>Yes, I know about swapon(8), but just what does "interleaved (supposedly
>equally)" mean? Does the kernel remember which device it used last time and
>use the other one for the next page? Are the devices selected randomly so that
>on average they are equally used? Or is one device used all the time
>until it fills up then overflows to the next? My guess is that it is
>implementation dependant, does anyone have any hard knowledge on this subject?

As of 4.1.1 (and I believe since 4.0, where swapon appeared), when you add
a swap device it is added to a list of swap devices. The way the kernel
spreads anonymous (swap) page allocations is by allocating a megabyte
of consective pages on one device, then going on to the next. So yes, it
remembers how much it has allocated on one swap device, and when it
reaches 1MB, it goes to the next. No, it doesn't use up one device and
then overflow to the next (unless that device was <1MB in size). It doesn't
have any knowledge about relative access speeds of your separate swap devices;
that is left up to the administrator.

I believe you can patch the kernel variable swap_maxcontig to change the
1MB value above. Whether you would want to, I don't know.

	Mike
--
Mike Sullivan                     Internet: msullivan at EBay.Sun.COM
Sun Education                     UUCP:     ..!sun!yavin!msullivan
Software Course Developer         Compuserve: 75365,764
"The old Maxwell Smart silhouette on the window shade trick. That's the



More information about the Comp.unix.questions mailing list