Re: Swap partition priority

Joshua Armstrong <[email protected]>
Newsgroups gmane.os.freebsd.devel.hackers
Message-ID <[email protected]>
I don’t have a login to comment on the review, but my thoughts:

It works but in the event the first device is full, it needs to walk the tree and check subsequent devices for each write until it finds one where the page will fit. I’d prefer moving the conditional down to line 963 and conditioning out the TAILQ_NEXT call instead:

		swp_sizecheck();
		if (swap_devices_roundrobin)
			swdevhd = TAILQ_NEXT(sp, sw_list);

That way it remembers the one that it’s currently writing to and doesn’t need to look for somewhere to write each time.

-Joshua

> On Aug 21, 2026, at 9:10 AM, Andrea Venturoli <[email protected]> wrote:
> 
> On 8/18/26 19:04, Andrea Venturoli wrote:
> 
>>> If there’s no problem with adding an optional parameter to the struct that swapon(2) passes to the kernel
>> Actually I was thinking about something much simpler and very basic.
>> unknown_sysctl=0: default behaviour
>> unknown_sysctl=1: use the devices in order of "swapon" (when the first is full, move to the second and so on).
>> This would not require any modifications to swapon(2), but only to swp_pager_getswapspace (besides adding the sysctl, obviously).
>> Right?
>> At least this could be a first step and allow for testing.
> 
> I've created a review:
>> https://reviews.freebsd.org/D59081
> 
> 
> I'd be happy if some expert could have a look at it.
> 
> bye & Thanks
> 	av.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.