FreeBSD Developer Summit: Swap Space Managmenet
Date: TBD
Overview
Depending on the workload and system hardware a system may require swap or may require more or less swap while processing some workloads. Some systems require more swap than others while some workloads periodically require more swap than others.
Swap space reccommendataions have evolved over the years from a rule of thumb of 4x swap to memory ratio, to a 2x ratio, to a 1x ratio or even no swap for database servers. Generally this recommendation is fine except when workload demands additional swap, i.e. an aggressive git gc to to compact a large git repo, such as ports and base.
Configuring FreeBSD swap is a simple matter of allocating space through partitioning or adding a disk, adding a zvol, or using a swapfile. These must be configured manually, using swapon/swapoff or at boot in fstab(5). All swap "devices" used equally regardless or priority regardless of their location and regardless of their performance or impact to the system.
If you would like to participate, contact the working group chairs below and CC devsummit@. You will be then added to this page. Please include a list of things you want to talk about or the areas you are interested in. This helps us in planning the session and to bring people together with common interests.
It is possible to bring in people who cannot attend in person via video conference or chat tools. Notes during the session will be published later on for the whole community to see what we discussed.
Goals
The purpose of this working group is to explore various possibilities to enhance FreeBSD's swap space management to more dynamically manage swap "devices."
Areas of investigation and discussion will include:
- Swap space priorities, as Linux currently supports.
- new nswapon(2) syscall?
- replace the existing swapon(2) syscall?
- Trim support for swap (as supported by Linux).
- Enhance devd to support detection and remediation of swap shortage.
- devd becomes a general event manager? (it already defacto is)
- threshold, configurable through a sysctl, triggers an event
- Swap to memory -- memory compression.
In particular, we would like to cover the following topics. This is not an exhaustive list and if you feel there is something missing that you want to talk about, contact one of the session chairs and we will include your topic here. Note that the numbering of the topics does not represent an ordering or importance indication of any kind, but rather a reference to the second table with the "topic of interest" column.
Topics
Topic Description |
Swap space priorities |
Swap trim support |
devd as an event manager |
Memory compression |
Attending
To attend, you must register for the developer summit as well as by email for this working group and be confirmed by the working group organizer. Follow the guidelines described on the main page or what you received by email. Please contact the session chair with any questions.
Please DO add yourself here and email the session chair if you plan to attend.
# |
Name |
Username / Affiliation |
Topics of Interest |
Notes |
1 |
cy |
* |
Session chair |
|
2 |
markj |
* |
|
|
3 |
imp |
devd |
would need a hangouts end-point in the room to participate |
|
4 |
wg |
* |
|
|
5 |
|
|
|
|
The Google Hangouts meeting URL: Add the following to your Google calendar: https://calendar.google.com/event?action=TEMPLATE&tmeid=NjFnamNjMWg3MHMzaWI5bWNrc2pnYjlrY3BoNjJiOW9jb3JtY2JiNDYxaG1hY3IzNzRxajhvaG9jOCBjc2NodWJlckBt&tmsrc=cschuber%40gmail.com
Results
- Swap space priorities, as Linux currently supports
- currenly supported on Linux.
- general consensus to add nswapon(2) syscall, not replace existing swapon(2)
- add a version number to the nswap struct
- no opinions re prio unsigned or signed int.
- a fair bit of discussion regarding migration more active pages from lower priority devices to higher priority devices:
- swap space migration:
- migrate more actively used pages from lower priority devices to higher priority devices.
- migration could occur by removing the page from a lower priority device and written to a higher priority device when it is subsequently paged out again.
- avoid swap space fragmentation.
- asynchronous defragmentation of swap devices in a separate kernel thread
- Trim support for swap (as supported by Linux)
- trim support should NOT be default: this may have performance implications on some devices.
- Swap to memory -- memory compression
- TBD: swap to non-pagable md device with compression or separately managed through kernel.
View on YouTube