CVS commit: src/sys/uvm
"Robert Elz" <[email protected]>
| Newsgroups | gmane.os.netbsd.devel.cvs |
|---|---|
| Message-ID | <[email protected]> |
Module Name: src Committed By: kre Date: Fri Feb 13 03:44:49 UTC 2026 Modified Files: src/sys/uvm: uvm_swap.c Log Message: PR bin/59996 - handle hidden swap list reordering A different attempt to achieve what 2 revs back was attempting. The swap lists must be locked (uvm_swap_data_lock) when we are traversing the lists of swap devices, as otherwise the lists can reorder themselves behind our back. But we cannot hold that lock when actually doing the processing, as our process might need to page/swap to copy out data, and doing that will also attempt to take the lock - panic (or doom). Instead, traverse the lists with the lock held, so they are stable, but do nothing but keep a record of all of the swapdevs (independent of their lists) and then use this new list of swapdevs to actually do the work. The number or identity of the swap devices cannot change during all of this, as we also hold swap_syscall_lock which prevents any other swapctl() operations (like adding or deleting devices) from occurring. Once we have done that, the number of swap devices found is the number returned from swapctl(SWAP_STATS) (provided it is no bigger than requested). Note that this does not guarantee that the number of devices returned from swapctl(SWAP_STATS) will agree with an earlier call to swapctl(SWAP_NSWAP) - that is obviously impossible, absolutely anything might have occurred between the two calls. To generate a diff of this commit: cvs rdiff -u -r1.213 -r1.214 src/sys/uvm/uvm_swap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.