Skip to content

mm/compaction: allow more aggressive proactive compaction

Michal Clapinski linux-mm lkml 4 versions – Applied

Status from this message: [merged mm-stable] mm-compaction-reduce-the-difference-between-low-and-high-watermarks.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 0 repliesApplied 2/2
  2. v32 patches 6 repliesSuperseded
  3. v22 patches 0 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v12 patches7 repliesSuperseded

Changes in v4 from the cover letter

- Replace the leeway tunable with an equation based on proactiveness.
- Add graphs to prove it works.
v3: Remove gerrit ids from commit msgs.
v2: Change commit msgs and document the new sysctl.

Patches in v4 All 2 applied

#Subject and filesSizeRepliesApplied
1/2mm/compaction: remove low watermark cap for proactive compactionmm/compaction.c+1 -60 repliesApplied
2/2mm/compaction: reduce the difference between low and high watermarksDocumentation/admin-guide/sysctl/vm.rst mm/compaction.c+9 -20 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH v4 0/2] mm/compaction: allow more aggressive proactive compaction

Our goal is to keep memory usage of a VM low on the host. For that reason, we use free page reporting which by default reports free pages of order 9 and larger to the host to be freed. The feature works well only if the memory in the guest is not fragmented below pages of order
9. Proactive compaction can be reused to achieve defragmentation after some parameter tweaking.

When the fragmentation score (lower is better) gets larger than the high watermark, proactive compaction kicks in. Compaction stops when the score goes below the low watermark (or no progress is made and backoff kicks in). Let's define the difference between high and low watermarks as leeway. Before these changes, the minimum possible value for low watermark was 5 and the leeway was hardcoded to 10 (so minimum possible value for high watermark was 15).

To test this, I created a VM with 19GB of memory and free page reporting enabled. The VM was ~idle. I meassured the memory usage from inside the guest (/proc/meminfo) and from the host (provided by the hypervisor).
Before:
https://drive.google.com/file/d/1Xw23lRry_PgEH3f6QRnSGvoHh2u9UHyI/view?usp=sharing
After:
https://drive.google.com/file/d/1wMhpIzepx6t44F70yCPA50n1S5V2AT-a/view?usp=sharing

v4:
- Replace the leeway tunable with an equation based on proactiveness.
- Add graphs to prove it works.
v3: Remove gerrit ids from commit msgs.
v2: Change commit msgs and document the new sysctl.

Michal Clapinski (2):
mm/compaction: remove low watermark cap for proactive compaction mm/compaction: reduce the difference between low and high watermarks

 Documentation/admin-guide/sysctl/vm.rst |  6 ++++++
 mm/compaction.c                         | 12 ++++--------
 2 files changed, 10 insertions(+), 8 deletions(-)
Signature · 1 line
2.49.0.504.g3bcea36a83-goog