Re: Swap partition priority

From: Joshua Armstrong <darthferrett_at_gmail.com>
Date: Tue, 18 Aug 2026 14:00:02 UTC
I’ll throw my hat into this ring.

As soon as I’m finished with my meeting, I’ll check the swap management / virtual memory code to see if interleaving is hardcoded or not. I believe the current (and long-standing, according to my ancient copy of the Unix System Administration Handbook) behavior is to interleave swap writes between configured devices for performance.

I agree, however, that having a priority system would make more sense in today’s world. I sometimes end up creating a temporary zvol and using that as emergency extra swap if I’m building world, but I would assume this has a performance penalty (though perhaps not massive) versus swap partitions on bare disks.

-Joshua

> On Aug 18, 2026, at 3:48 AM, Miroslav Lachman <000.fbsd@quip.cz> wrote:
> 
> On 18/08/2026 09:49, Stéphane Rochoy wrote:
>> Andrea Venturoli <ml@netfence.it> writes:
>>> Is it possible to set swap partition priority?
>>> According to swapon(8), the answer is no, but I wonder if the man page
>>> might be outdated, if patches are available, etc...
>>> 
>>> The reason is I have SSDs and HDDs in the same system: I normally use
>>> swap on SSDs (for speed obviously), but sometimes the amount is not enough.
>>> So I'm ponderind adding swap on HDDS too, but this would slow down
>>> everyrting unless it's really used as last resort.
>> Hello,
>> Long ago I came accross a setup were the swap device was a GEOM mirror
>> (see gmirror(8)). AFAIK it was working except for vmcores: the kernel
>> was always using the first device which required to help savecore(8) a
>> bit.
>> So maybe there's some GEOM class matching your needs.
> There is geom_concat - see man gconcat. It may be possible to use it for swap (never tried it).
> 
> Best regards
> Miroslav Lachman
>