Re: Multiple swap partition uglies (fwd)

Rik van Riel (
Thu, 21 May 1998 22:13:45 +0200 (MET DST)

On Fri, 22 May 1998, Paul Wilkins wrote:

> Rik - the problem is NOT with swapoff. Swapoff'ing one of the drives
> actually solves the problem (ok it takes a while, but this is no
> different from the performance I get _all the time_ when swapping off
> two drives). The problem is with the 2 swap drive setup.
> Sometimes, paging takes forever. When I swapoff one of the drives, to
> revert to a 1 swap partition setup, the problem goes away.
> Clear as mud?

Absolutely clear. You have 1 disk off of which the programs,
libraries and other files are paged and is used for swap and
another disk which is used for swap and not-often-used data.

This means that the first disk will have to perform double
duty, which can be very slow, especially when the swap partition
is physically remote from the / and /usr partition.

Remember that executable, library and regular mmap() data is
paged in from the filesystem and never hits the swap area.
This means that it's better to spread the load in a more even
way: executables on one drive and swap on the others.

> It'd be nice if this was fixed, swapping off just one drive sucks
> compared to the performance of two drives (when it works).

It's not broken. You make one drive do double duty and complain
that it works worse than spreading out the load more equal.
Of course, when you only do swapping and no paging (strange
workload), swapping to multiple drives _is_ faster.

Changing workloads make this impossible to tune, but a
possible solution could be to change the selection of
the to-use swap device in the following way:
- use the highest-priority swap device, but
- give a penalty for outstanding I/O requests to the drive, thus
- maybe selecting another drive when there's more I/O load to
one of the drives

Alternatively, we can keeps stats of the I/O load on drives
(halved each second?) and apply penalties (1 point per
I/O per second?) to aid in the selection of the best swap

Maybe we could better use a fractional approach, ie: we
divide the priority by the number of I/O operations per
second (+1) so we can give swap priorities based on
drive speed. (drive twice as fast --> twice as much I/Os)

| Linux: - LinuxHQ MM-patches page | Scouting webmaster |
| - kswapd ask-him & complain-to guy | Vries cubscout leader |
| | <> |

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to