[comp.unix.questions] More than one swap device ?

mbl900@anusf.anu.edu.au (Mathew BM LIM) (03/21/91)

I am the administrator of a soon to be installed Fujitsu VP2200 running
UXP (Fujitsu's SysVR4). I have been trying to plan our file system structure
and swap space allocation. We will have 256 MBytes of physical memory
and perhaps a 32GByte SSU (Solid State Unit - basically a Solid State Disk
drive type thingy). There will be 3 disk controllers, each attached to
two channels and supporting a string of 8 - 16 disks each.

With regard to swap space allocation, if more than one swap device has been
defines, how does Unix (SYSV) decide which to use? Presumably pages cannot be
split between swap areas, or can they? 

The reason I am asking this is to help me decide how many swap areas to
have and if placing them on different disks is good enough or would placing
them on different disk controllers altogether be a much better idea?

It would also be nice to be able to define the SSU to be the "primary"
swap space and the others as "secondary". Each of the secondaries would
ideally be equally active.

Any ideas welcome.

-- 
---
Mathew Lim, Unix Systems Programmer, ANU Supercomputer Facility, ANU, Australia.
Telephone : +61 6 249 2750	| ACSnet   : Mathew.BM.Lim@anu.oz
Fax       : +61 6 247 3425	| Internet : Mathew.BM.Lim@anu.edu.au

weimer@garden.kodak.COM (Gary Weimer (588-0953)) (03/22/91)

In article <1991Mar21.132725@anusf.anu.edu.au>, mbl900@anusf.anu.edu.au
(Mathew BM LIM) writes:
|> I am the administrator of a soon to be installed Fujitsu VP2200 running
|> UXP (Fujitsu's SysVR4). I have been trying to plan our file system structure
|> and swap space allocation.

I don't know how universal it is, but SunOS (bsd derived) has swapon(8)
for adding swap space (If you don't have it, you don't need to know how
it works, so I won't explain it). If this is used, swaping is
interleaved (supposedly equally) between the devices.

weimer@ssd.kodak.com ( Gary Weimer )

mbl900@anusf.anu.edu.au (Mathew BM LIM) (03/22/91)

In article <1991Mar21.193820.752@ssd.kodak.com>, weimer@garden.kodak.COM (Gary Weimer (588-0953)) writes:
|> 
|> In article <1991Mar21.132725@anusf.anu.edu.au>, mbl900@anusf.anu.edu.au
|> (Mathew BM LIM) writes:
|> |> I am the administrator of a soon to be installed Fujitsu VP2200 running
|> |> UXP (Fujitsu's SysVR4). I have been trying to plan our file system structure
|> |> and swap space allocation.
|> 
|> I don't know how universal it is, but SunOS (bsd derived) has swapon(8)
|> for adding swap space (If you don't have it, you don't need to know how
|> it works, so I won't explain it). If this is used, swaping is
|> interleaved (supposedly equally) between the devices.
|> 
|> weimer@ssd.kodak.com ( Gary Weimer )

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?

-- 
---
Mathew Lim, Unix Systems Programmer, ANU Supercomputer Facility, ANU, Australia.
Telephone : +61 6 249 2750	| ACSnet   : Mathew.BM.Lim@anu.oz
Fax       : +61 6 247 3425	| Internet : Mathew.BM.Lim@anu.edu.au

mike_s@EBay.Sun.COM (Mike "The Claw" Sullivan) (03/22/91)

In <1991Mar22.125135@anusf.anu.edu.au> mbl900@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@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

torek@elf.ee.lbl.gov (Chris Torek) (03/22/91)

In article <1991Mar22.125135@anusf.anu.edu.au> mbl900@anusf.anu.edu.au
(Mathew BM LIM) writes:
>Yes, I know about swapon(8), but just what does "interleaved (supposedly
>equally)" mean? ... My guess is that it is implementation dependant,
>does anyone have any hard knowledge on this subject?

It is indeed implementation dependent, and yes, people do have hard
knowledge on the subject.

For more specifics, see the two `Unix internals' books, one by Bach and
one by Karels, Leffler, McKusick, and Quarterman.  Neither one will
describe whatever you have (Murphy's Law).
-- 
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427)
Berkeley, CA		Domain:	torek@ee.lbl.gov