Modernizing swapping: virtual swap spaces
7 hours ago
- #kernel
- #memory-management
- #swapping
- Swap entries identify slots on swap devices for holding pages of data, with a 64-bit value split into device index and offset.
- Current swap table design ties swapped-out pages to specific devices, complicating device removal and requiring kernel scans to update page-table entries.
- Zswap intercepts pages during swap-out, compresses them, and stores in memory, but requires backing device space allocation upfront, leading to wasted storage.
- Pham proposes virtual swap spaces with a single swap table independent of devices, using swp_desc structures to map virtual slots to real locations.
- Virtual swap spaces allow easy movement of pages between devices or zswap, eliminating the need for page-table scans during device removal.
- The new design increases memory usage and complexity, with performance regressions noted, though improvements have been made.
- Concerns about memory overhead and performance under pressure may delay merging, with further development needed.
- Swap tiers proposal by Youngjun Park allows configuring multiple swap devices into performance tiers, complementing virtual swap spaces.
- Recent developments indicate increased interest in improving swapping performance, flexibility, and maintainability in the kernel.