Page MenuHomeFreeBSD

Remove swblk_t.
ClosedPublic

Authored by markj on Thu, Feb 13, 5:24 PM.

Details

Summary

It was used only to store the bounds of each swap device. However,
since swblk_t is a signed 32-bit int and daddr_t is a signed 64-bit
int, swp_pager_isondev() may return an invalid result if swap devices
are repeatedly added and removed and sw_end for a device ends up
becoming a negative number.

Note that the removed comment about maximum swap size still applies.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

markj created this revision.Thu, Feb 13, 5:24 PM
jeff accepted this revision.Thu, Feb 13, 11:04 PM
This revision is now accepted and ready to land.Thu, Feb 13, 11:04 PM
kib accepted this revision.Fri, Feb 14, 1:30 PM
markj added a comment.Fri, Feb 14, 4:04 PM

This change probably can't be MFCed. We could fix the problem in a different way, by changing swaponsomething() to allocate block ranges more carefully. The current algorithm just scans the list of existing swap devices and places the new one after the end of the last one. I think I will just commit the change and make the block range allocation smarter in a follow-up change.

kib added a comment.Fri, Feb 14, 4:25 PM

This change probably can't be MFCed.

Why ?

We could fix the problem in a different way, by changing swaponsomething() to allocate block ranges more carefully. The current algorithm just scans the list of existing swap devices and places the new one after the end of the last one. I think I will just commit the change and make the block range allocation smarter in a follow-up change.

swdevt is kernel-internal, more it is sys/vm internal. The external userspace view on it is provided by struct xswdev.

markj added a comment.Fri, Feb 14, 4:37 PM
In D23666#519989, @kib wrote:

This change probably can't be MFCed.

Why ?

We could fix the problem in a different way, by changing swaponsomething() to allocate block ranges more carefully. The current algorithm just scans the list of existing swap devices and places the new one after the end of the last one. I think I will just commit the change and make the block range allocation smarter in a follow-up change.

swdevt is kernel-internal, more it is sys/vm internal. The external userspace view on it is provided by struct xswdev.

I was worried that removal of swblk_t would cause some out-of-tree code to fail to compile (e.g. because of copy-and-paste of libkvm code). Maybe this is still acceptable for the stable branches, I am not sure. I will add a MFC marker and wait for any reported fallout from ports.

This revision was automatically updated to reflect the committed changes.