Page MenuHomeFreeBSD

Fix object locking races in swapoff.
AbandonedPublic

Authored by markj on Feb 13 2020, 5:22 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 29 2023, 1:45 PM
Unknown Object (File)
Dec 20 2023, 9:57 AM
Unknown Object (File)
Dec 20 2023, 6:48 AM
Unknown Object (File)
Nov 15 2023, 8:45 PM
Unknown Object (File)
Nov 6 2023, 12:06 PM
Unknown Object (File)
Oct 14 2023, 7:45 PM
Unknown Object (File)
Sep 10 2023, 8:04 PM
Unknown Object (File)
Jun 14 2023, 9:46 PM
Subscribers
None

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 Passed
Unit
No Test Coverage
Build Status
Buildable 29349
Build 27248: arc lint + arc unit