Re: [PATCH 11/22] mm, compaction: Use free lists to quickly locate a migration target
From: Vlastimil Babka
Date: Thu Jan 31 2019 - 09:52:15 EST
On 1/18/19 6:51 PM, Mel Gorman wrote:
> Similar to the migration scanner, this patch uses the free lists to quickly
> locate a migration target. The search is different in that lower orders
> will be searched for a suitable high PFN if necessary but the search
> is still bound. This is justified on the grounds that the free scanner
> typically scans linearly much more than the migration scanner.
>
> If a free page is found, it is isolated and compaction continues if enough
> pages were isolated. For SYNC* scanning, the full pageblock is scanned
> for any remaining free pages so that is can be marked for skipping in
> the near future.
>
> 1-socket thpfioscale
> 5.0.0-rc1 5.0.0-rc1
> isolmig-v3r15 findfree-v3r16
> Amean fault-both-3 3024.41 ( 0.00%) 3200.68 ( -5.83%)
> Amean fault-both-5 4749.30 ( 0.00%) 4847.75 ( -2.07%)
> Amean fault-both-7 6454.95 ( 0.00%) 6658.92 ( -3.16%)
> Amean fault-both-12 10324.83 ( 0.00%) 11077.62 ( -7.29%)
> Amean fault-both-18 12896.82 ( 0.00%) 12403.97 ( 3.82%)
> Amean fault-both-24 13470.60 ( 0.00%) 15607.10 * -15.86%*
> Amean fault-both-30 17143.99 ( 0.00%) 18752.27 ( -9.38%)
> Amean fault-both-32 17743.91 ( 0.00%) 21207.54 * -19.52%*
>
> The impact on latency is variable but the search is optimistic and
> sensitive to the exact system state. Success rates are similar but
> the major impact is to the rate of scanning
>
> 5.0.0-rc1 5.0.0-rc1
> isolmig-v3r15 findfree-v3r16
> Compaction migrate scanned 25646769 29507205
> Compaction free scanned 201558184 100359571
>
> The free scan rates are reduced by 50%. The 2-socket reductions for the
> free scanner are more dramatic which is a likely reflection that the
> machine has more memory.
>
> [dan.carpenter@xxxxxxxxxx: Fix static checker warning]
> [vbabka@xxxxxxx: Correct number of pages scanned for lower orders]
> Signed-off-by: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx>
Acked-by: Vlastimil Babka <vbabka@xxxxxxx>
Small fix below:
> -/* Reorder the free list to reduce repeated future searches */
> +/*
> + * Used when scanning for a suitable migration target which scans freelists
> + * in reverse. Reorders the list such as the unscanned pages are scanned
> + * first on the next iteration of the free scanner
> + */
> +static void
> +move_freelist_head(struct list_head *freelist, struct page *freepage)
> +{
> + LIST_HEAD(sublist);
> +
> + if (!list_is_last(freelist, &freepage->lru)) {
Shouldn't there be list_is_first() for symmetry?
> + list_cut_before(&sublist, freelist, &freepage->lru);
> + if (!list_empty(&sublist))
> + list_splice_tail(&sublist, freelist);
> + }
> +}
> +
> +/*
> + * Similar to move_freelist_head except used by the migration scanner
> + * when scanning forward. It's possible for these list operations to
> + * move against each other if they search the free list exactly in
> + * lockstep.
> + */
> static void
> move_freelist_tail(struct list_head *freelist, struct page *freepage)
> {