Page MenuHomeFreeBSD

Fix object locking races in swapoff.
AbandonedPublic

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

Details

Reviewers
None
Summary

swap_pager_swapoff_object()'s goal is to allocate pages for all valid
swap blocks belonging to the object, for which there is no resident
page. If the page corresponding to a block is already resident and
valid, the block can simply be discarded.

The existing implementation tries to minimize the number of I/Os used.
For each cluster of swap blocks, it finds maximal runs of valid swap
blocks not resident in memory, and valid resident pages. During this
processing, the object lock may be dropped in several places: when
calling getpages, or when blocking on a busy page in
vm_page_grab_pages(). While the lock is dropped, another thread may
free swap blocks, causing getpages to page in stale data.

Fix the problem following a suggestion from Jeff: use getpages'
readahead capability to perform clustering rather than doing it
ourselves. The simplies the code a bit without reintroducing the old
behaviour of performing one I/O per page.

Diff Detail

Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 29349
Build 27248: arc lint + arc unit

Event Timeline

markj created this revision.Thu, Feb 13, 5:22 PM
markj abandoned this revision.Fri, Feb 14, 5:10 PM