Skip to content

RFC Increase success rates and reduce latency of compaction v1

Mel Gorman linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest14 patches 18 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14mm, compaction: Shrink compact_controlmm/internal.h+2 -21 reply
2/14mm, compaction: Rearrange compact_controlmm/internal.h+3 -31 reply
3/14mm, compaction: Remove last_migrated_pfn from compact_controlmm/compaction.c mm/internal.h+9 -171 reply
4/14mm, compaction: Rename map_pages to split_map_pagesmm/compaction.c+29 -312 replies
5/14mm, compaction: Skip pageblocks with reserved pagesmm/compaction.c+7 -02 replies
6/14mm, migrate: Immediately fail migration of a page with no migration handlermm/migrate.c+1 -14 replies
7/14mm, compaction: Always finish scanning of a full pageblockmm/compaction.c mm/internal.h+8 -121 reply
8/14mm, compaction: Use the page allocator bulk-free helper for lists of pagesinclude/linux/gfp.h mm/compaction.c mm/page_alloc.c+18 -112 replies
9/14mm, compaction: Ignore the fragmentation avoidance boost for isolation and compactionmm/page_alloc.c+1 -14 replies
10/14mm, compaction: Use free lists to quickly locate a migration sourcemm/compaction.c mm/internal.h+179 -20 replies
11/14mm, compaction: Keep migration source private to a single compaction instancemm/compaction.c+87 -250 replies
12/14mm, compaction: Use free lists to quickly locate a migration targetmm/compaction.c+197 -40 replies
13/14mm, compaction: Capture a page under direct compactioninclude/linux/compaction.h include/linux/sched.h kernel/sched/core.c +3 more+96 -120 replies
14/14mm, compaction: Do not direct compact remote memorymm/compaction.c+10 -00 replies

Reviews trailers per patch

6 of 14 patches have a Reviewed-by or Acked-by.

PatchVlastimil Babka
1/14A-b
2/14A-b
3/14A-b
4/14
5/14
6/14A-b
7/14A-b
8/14A-b
9/14
10/14
11/14
12/14
13/14
14/14

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC PATCH 00/14] Increase success rates and reduce latency of compaction v1

This is a very preliminary RFC. I'm posting this early as the __GFP_THISNODE discussion continues and has started looking at the compaction implementation and it'd be worth looking at this series fdirst. The cc list is based on that dicussion just to make them aware it exists. A v2 will have a significantly trimmed cc.

This series reduces scan rates and success rates of compaction, primarily by using the free lists to shorten scans and better controlling of skip information and whether multiple scanners can target the same block. There still is much room for improvement but we probably should get these out of the way first as they are pre-requisites for anything smarter.

Test data is still incomplete but I'm not expecting major differences on 2-socket vs 1-socket given the type of series. That might be wrong.

Primarily I'm using thpscale to measure the impact of the series. The benchmark creates a large file, maps it, faults it, punches holes in the mapping so that the virtual address space is fragmented and then tries to allocate THP. It re-executes for different numbers of threads. From a fragmentation perspective, the workload is relatively benign but it does stress compaction.

The overall impact on latencies for a 1-socket machine is

                                    4.20.0-rc6             4.20.0-rc6
                                mmotm-20181210           capture-v1r8
Amean     fault-both-3      3842.11 (   0.00%)     2898.64 *  24.56%*
Amean     fault-both-5      5201.92 (   0.00%)     4296.58 (  17.40%)
Amean     fault-both-7      7086.15 (   0.00%)     6203.55 (  12.46%)
Amean     fault-both-12    11383.58 (   0.00%)     9309.13 *  18.22%*
Amean     fault-both-18    16616.53 (   0.00%)     6245.27 *  62.42%*
Amean     fault-both-24    18617.05 (   0.00%)    15083.42 *  18.98%*
Amean     fault-both-30    24372.88 (   0.00%)    11498.60 *  52.82%*
Amean     fault-both-32    22621.58 (   0.00%)     9684.82 *  57.19%*

24-62% reduction in fault latency (be it base or huge page)

The allocation success rates which are using MADV_HUGEPAGE are as follows;

                               4.20.0-rc6             4.20.0-rc6
                           mmotm-20181210           capture-v1r8
Percentage huge-3        85.74 (   0.00%)       98.12 (  14.44%)
Percentage huge-5        89.16 (   0.00%)       98.83 (  10.85%)
Percentage huge-7        85.98 (   0.00%)       97.99 (  13.97%)
Percentage huge-12       84.19 (   0.00%)       99.00 (  17.59%)
Percentage huge-18       81.20 (   0.00%)       98.92 (  21.83%)
Percentage huge-24       82.60 (   0.00%)       99.08 (  19.95%)
Percentage huge-30       82.87 (   0.00%)       99.22 (  19.74%)
Percentage huge-32       81.98 (   0.00%)       98.97 (  20.72%)

So, it's showing that the series is not far short of allocating 100% of the requested pages as huge pages. Finally the overall scan rates are as follows

Compaction migrate scanned 677936161 4756927
Compaction free scanned 352045485 256525622
Kcompactd migrate scanned 751732 751080
Kcompactd free scanned 113784579 93099786

These are still pretty crazy scan rates but direct compaction migration scanning is reduced by 99% and the free scanner is reduced by 27% so it's a step in the right direction.

 include/linux/compaction.h |   3 +-
 include/linux/gfp.h        |   7 +-
 include/linux/sched.h      |   4 +
 kernel/sched/core.c        |   3 +
 mm/compaction.c            | 638 ++++++++++++++++++++++++++++++++++++++-------
 mm/internal.h              |  21 +-
 mm/migrate.c               |   2 +-
 mm/page_alloc.c            |  70 ++++-
 8 files changed, 637 insertions(+), 111 deletions(-)
Signature · 1 line
2.16.4