• Mel Gorman's avatar
    mm, compaction: finish pageblock scanning on contention · cb2dcaf0
    Mel Gorman authored
    Async migration aborts on spinlock contention but contention can be high
    when there are multiple compaction attempts and kswapd is active.  The
    consequence is that the migration scanners move forward uselessly while
    still contending on locks for longer while leaving suitable migration
    sources behind.
    
    This patch will acquire the lock but track when contention occurs.  When
    it does, the current pageblock will finish as compaction may succeed for
    that block and then abort.  This will have a variable impact on latency
    as in some cases useless scanning is avoided (reduces latency) but a
    lock will be contended (increase latency) or a single contended
    pageblock is scanned that would otherwise have been skipped (increase
    latency).
    
                                         5.0.0-rc1              5.0.0-rc1
                                    norescan-v3r16    finishcontend-v3r16
    Amean     fault-both-1         0.00 (   0.00%)        0.00 *   0.00%*
    Amean     fault-both-3      3002.07 (   0.00%)     3153.17 (  -5.03%)
    Amean     fault-both-5      4684.47 (   0.00%)     4280.52 (   8.62%)
    Amean     fault-both-7      6815.54 (   0.00%)     5811.50 *  14.73%*
    Amean     fault-both-12    10864.02 (   0.00%)     9276.85 (  14.61%)
    Amean     fault-both-18    12247.52 (   0.00%)    11032.67 (   9.92%)
    Amean     fault-both-24    15683.99 (   0.00%)    14285.70 (   8.92%)
    Amean     fault-both-30    18620.02 (   0.00%)    16293.76 *  12.49%*
    Amean     fault-both-32    19250.28 (   0.00%)    16721.02 *  13.14%*
    
                                    5.0.0-rc1              5.0.0-rc1
                               norescan-v3r16    finishcontend-v3r16
    Percentage huge-1         0.00 (   0.00%)        0.00 (   0.00%)
    Percentage huge-3        95.00 (   0.00%)       96.82 (   1.92%)
    Percentage huge-5        94.22 (   0.00%)       95.40 (   1.26%)
    Percentage huge-7        92.35 (   0.00%)       95.92 (   3.86%)
    Percentage huge-12       91.90 (   0.00%)       96.73 (   5.25%)
    Percentage huge-18       89.58 (   0.00%)       96.77 (   8.03%)
    Percentage huge-24       90.03 (   0.00%)       96.05 (   6.69%)
    Percentage huge-30       89.14 (   0.00%)       96.81 (   8.60%)
    Percentage huge-32       90.58 (   0.00%)       97.41 (   7.54%)
    
    There is a variable impact that is mostly good on latency while allocation
    success rates are slightly higher.  System CPU usage is reduced by about
    10% but scan rate impact is mixed
    
    Compaction migrate scanned    27997659.00    20148867
    Compaction free scanned      120782791.00   118324914
    
    Migration scan rates are reduced 28% which is expected as a pageblock is
    used by the async scanner instead of skipped.  The impact on the free
    scanner is known to be variable.  Overall the primary justification for
    this patch is that completing scanning of a pageblock is very important
    for later patches.
    
    [yuehaibing@huawei.com: fix unused variable warning]
    Link: http://lkml.kernel.org/r/20190118175136.31341-14-mgorman@techsingularity.netSigned-off-by: default avatarMel Gorman <mgorman@techsingularity.net>
    Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
    Cc: YueHaibing <yuehaibing@huawei.com>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Dan Carpenter <dan.carpenter@oracle.com>
    Cc: David Rientjes <rientjes@google.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    cb2dcaf0
compaction.c 70.8 KB