Subject: Re: swapctl -a doesn't do load-balancing; whyzzat?
To: None <greywolf@starwolf.com>
From: Chuck Cranor <chuck@xxx.research.att.com>
List: tech-kern
Date: 09/02/2000 21:35:00
In article <Pine.NEB.4.21.0009021604390.8927-100000@mage.starwolf.com>,
Greywolf <greywolf@starwolf.com> wrote:
>I just checked my swap and noticed it was dangerously low (eyecandy
>does that to ya), so I added another swap partition.  I'm curious as
>to why, when you add swap, it doesn't try to spread the load out
>at that time.  I now have all of my swapped stuff on one disk and
>nothing happening on the other one.


looking at src/sys/uvm/uvm_swap.c at uvm_swap_alloc(), the claim
is that it uses round-robin to allocate from swap devices of the
same priority.   so, once you've added a new swap partition stuff
will gradually migrate over there.   did that happen?

it would be possible (but messy) to have sys_swapctl/SWAP_ON initiate
a bunch of I/O to equalize the swap usage, but i don't think it would
have a positive impact on performance (generally, if stuff is happy
to rest for a long while on swap, then just avoid the extra i/o and 
leave it there -- if you suffer from exessive swaping the best thing to 
do is buy more RAM if possible).  


if you look at uvm_swap.c, you might also want to read the big comment
at the top that i wrote most of (it explains the data structures, 
locking, and swap related commands).


chuck

-- 
Chuck Cranor                            http://www.research.att.com/info/chuck
Senior Technical Staff Member		chuck@research.att.com
Internet and Networking Systems Research Lab
AT&T Labs-Research, Florham Park, NJ