Re: Swap partition priority

Andrea Venturoli <[email protected]>
Newsgroups gmane.os.freebsd.devel.hackers
Message-ID <[email protected]>
On 8/21/26 19:10, Joshua Armstrong wrote:

> It works

OK.
I'll extend testing from the test VM to a real server.
Thanks.



> 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 had thought of this: my conclusion, perhaps naive, was that the list 
will hold at most a few items, so it wouldn't be such a big penalty.
Isn't it so?



 >  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.
Hmm...
Doesn't this mean the system will:
_ start swapping on the first (fast) partition;
_ when such partition is full, move to the next (slow) one;
_ however, if space is freed on the first partition, it won't go back 
here and keep swapping on the second one until it's full?

(I agree the conditional here would avoid the call to TAILQ_NEXT, which 
is useless in this case, though).



> Of course, my suggestion has the consequence that once a device can’t fit a page,
 > it will no longer be considered, so you’d end up with a slightly
 > storage-inefficient setup as a tradeoff.

In my case I think the inefficiency (of writing on the HDD, instead of 
the SSD), would be several order of magnitude worse than walking the 
list each time.



 > The other way would end up storing smaller pages on the lowest device
 > where they will fit, every time. That might be preferable?
Unfortunately I'm too ignorant to be able to answer here.



  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.