HomeFreeBSD

Replace global swhash in swap pager with per-object trie to track swap

Description

Replace global swhash in swap pager with per-object trie to track swap
blocks assigned to the object pages.

  • The global swhash_mtx is removed, trie is synchronized by the corresponding object lock.
  • The swp_pager_meta_free_all() function used during object termination is optimized by only looking at the trie instead of having to search whole hash for the swap blocks owned by the object.
  • On swap_pager_swapoff(), instead of iterating over the swhash, global object list have to be inspected. There, we have to ensure that we do see valid trie content if we see that the object type is swap.

Sizing of the swblk zone is same as for swblock zone, each swblk maps
SWAP_META_PAGES pages.

Proposed by: alc
Reviewed by: alc, markj (previous version)
Tested by: alc, pho (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 month
Differential revision: https://reviews.freebsd.org/D11435