You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
0 commit comments