Smart scanning mode for KSM
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v4 Latest4 patches 0 repliesNew
- v34 patches 5 repliesApplied 4/4
- v24 patches 2 repliesSuperseded
Earlier versions · 1
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v1 | 4 patches | 9 replies | Superseded |
Changes from the cover letter
- V4:
- Changed default from disabled to enabled
- Changed commit message for first patch to mention it is enabled
- Changed documentation to mention it is enabled by default
- Changed cover letter description to mention it is enabled by default
- V3:
- Renamed field skip_age to remaining_skips
- Moved fields after old_checksum
- Changed should_skip_rmap_item to use remaining_skips field
- V2:
- Renamed function inc_skip_age() to skip_age()
- Added comment to skip_age() function
- Renamed function skip_rmap_item() to should_skip_rmap_item()
- Added more comments to should_skip_rmap_item function
- Added explicit modification of age with overflow check
Patches in v4 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | mm/ksm: add "smart" page scanning modemm/ | +103 | 0 replies | |
| 2/4 | mm/ksm: add pages_skipped metricmm/ | +12 | 0 replies | |
| 3/4 | mm/ksm: document smart scan modeDocumentation/ | +9 | 0 replies | |
| 4/4 | mm/ksm: document pages_skipped sysfs knobDocumentation/ | +2 | 0 replies |
Reviews trailers per patch
All 4 patches have a Reviewed-by or Acked-by.
| Patch | David Hildenbrand |
|---|---|
| 1/4 | R-b |
| 2/4 | R-b |
| 3/4 | R-b |
| 4/4 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v4 0/4] Smart scanning mode for KSM
This patch series adds "smart scanning" for KSM.
What is smart scanning?
=======================
KSM evaluates all the candidate pages for each scan. It does not use historic information from previous scans. This has the effect that candidate pages that couldn't be used for KSM de-duplication continue to be evaluated for each scan.
The idea of "smart scanning" is to keep historic information. With the historic information we can temporarily skip the candidate page for one or several scans.
Details:
========
"Smart scanning" is to keep two small counters to store if the page has been used for KSM. One counter stores how often we already tried to use the page for KSM and the other counter stores how often we skip a page.
How often we skip the candidate page depends how often a page failed KSM de-duplication. The code skips a maximum of 8 times. During testing this has shown to be a good compromise for different workloads.
New sysfs knob:
===============
Smart scanning is enabled by default. With /sys/kernel/mm/ksm/smart_scan smart scanning can be disabled.
Monitoring:
===========
To monitor how effective smart scanning is a new sysfs knob has been introduced. /sys/kernel/mm/pages_skipped report how many pages have been skipped by smart scanning.
Results:
========
- Various workloads have shown a 20% - 25% reduction in page scans For the instagram workload for instance, the number of pages scanned has been reduced from over 20M pages per scan to less than 15M pages.
- Less pages scans also resulted in an overall higher de-duplication rate as some shorter lived pages could be de-duplicated additionally
- Less pages scanned allows to reduce the pages_to_scan parameter and this resulted in a 25% reduction in terms of CPU.
- The improvements have been observed for workloads that enable KSM with madvise as well as prctl
Changes:
- V4:
- Changed default from disabled to enabled
- Changed commit message for first patch to mention it is enabled
- Changed documentation to mention it is enabled by default
- Changed cover letter description to mention it is enabled by default
- V3:
- Renamed field skip_age to remaining_skips
- Moved fields after old_checksum
- Changed should_skip_rmap_item to use remaining_skips field
- V2:
- Renamed function inc_skip_age() to skip_age()
- Added comment to skip_age() function
- Renamed function skip_rmap_item() to should_skip_rmap_item()
- Added more comments to should_skip_rmap_item function
- Added explicit modification of age with overflow check
Stefan Roesch (4):
mm/ksm: add "smart" page scanning mode
mm/ksm: add pages_skipped metric
mm/ksm: document smart scan mode
mm/ksm: document pages_skipped sysfs knob
Documentation/admin-guide/mm/ksm.rst | 11 +++ mm/ksm.c | 115 +++++++++++++++++++++++++++ 2 files changed, 126 insertions(+)
base-commit: 15bcc9730fcd7526a3b92eff105d6701767a53bb
Signature · 1 line
2.39.3