Re: Multiple swap partition uglies (fwd)

Riley Williams (rhw@ps.cus.umist.ac.uk)
Tue, 26 May 1998 09:42:50 +0100 (BST)


Hi Paul.

>> Hang on - both partitions have been specified as "pri=1" there,
>> and my understanding was that swap partitions have to have
>> DIFFERENT priorities - also, on my system, all swap priorities are
>> negative...

> from man 2 swapon

> PRIORITY
> Each swap area has a priority, either high or low. The
> default priority is low. Within the low-priority areas,
> newer areas are even lower priority than older areas.

> All priorities set with swapflags are high-priority,
> higher than default. They may have any non-negative value
> chosen by the caller. Higher numbers mean higher prior-
> ity.

> Swap pages are allocated from areas in priority order,
> highest priority first. For areas with different priori-
> ties, a higher-priority area is exhausted before using a
> !! lower-priority area. If two or more areas have the same
> !! priority, and it is the highest priority available, pages
> !! are allocated on a round-robin basis between them.

Nods - but note the following paragraph...

> As of Linux 1.3.6, the kernel usually follows these rules,
> but there are exceptions.

That appears to be referring to an OLD kernel - a VERY OLD one...but
it's the same wording as the one on my system...

> nuff said?

Not sure...

> and from man 8 swapon

> -p priority
> Specify priority for swapon. This option is only
> available if swapon was compiled under and is used
> under a 1.3.2 or later kernel. priority is a value
> between 0 and 32767. See swapon(2) for a full
> description of swap priorities. Add pri=value to
> the option field of /etc/fstab for use with swapon
> -a.

> which _says_ the priorities are positive numbers. However, I've
> seen posts with negative priorities mentioned, so I'm not really
> sure.

I seem to remember something relating to early in the 2.0 series
(around 2.0.11 IIRR) where a bug was found to exist relating to swap
areas with equal priorities, and I don't think it was ever tracked
down, but the advice given then was NOT to use swap areas with equal
priority...

>> That would tend to indicate a configuration error - especially
>> since the system I run that has two swap partitions (with
>> DIFFERENT priority levels) does NOT suffer from the problem, even
>> though it otherwise matches the specification given in the
>> original message...

> What's wierd is that I don't seem to have any problems as long as
> the swaps have different priorities (dosen't seem to matter which
> is higher). Problem only seems to come up for priorities the same.
> When I know more, I'll be posting back to linux-kernel.

That sounds like the bug report mentioned above...

Incidentally, my method of assigning [differing] priorities is simply
to list the swap partitions in /etc/fstab in descending order of the
priority with which I want them used, and let mount -a assign the
relevant priorities at boot time. I get priorities of -2 and -3
assigned on one system, and -1 and -2 on the other (I only have the
two with multiple swap partitions)...

Best wishes from Riley.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu