Re: [PATCH 6/6] mm/page_alloc: Introduce vm.percpu_pagelist_high_fraction

From: Vlastimil Babka
Date: Fri May 28 2021 - 07:59:41 EST


On 5/25/21 10:01 AM, Mel Gorman wrote:
> This introduces a new sysctl vm.percpu_pagelist_high_fraction. It is
> similar to the old vm.percpu_pagelist_fraction. The old sysctl increased
> both pcp->batch and pcp->high with the higher pcp->high potentially
> reducing zone->lock contention. However, the higher pcp->batch value also
> potentially increased allocation latency while the PCP was refilled.
> This sysctl only adjusts pcp->high so that zone->lock contention is
> potentially reduced but allocation latency during a PCP refill remains
> the same.
>
> # grep -E "high:|batch" /proc/zoneinfo | tail -2
> high: 649
> batch: 63
>
> # sysctl vm.percpu_pagelist_high_fraction=8
> # grep -E "high:|batch" /proc/zoneinfo | tail -2
> high: 35071
> batch: 63
>
> # sysctl vm.percpu_pagelist_high_fraction=64
> high: 4383
> batch: 63
>
> # sysctl vm.percpu_pagelist_high_fraction=0
> high: 649
> batch: 63
>
> Signed-off-by: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx>
> Acked-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>

Acked-by: Vlastimil Babka <vbabka@xxxxxxx>

Documentation nit below:

> @@ -789,6 +790,25 @@ panic_on_oom=2+kdump gives you very strong tool to investigate
> why oom happens. You can get snapshot.
>
>
> +percpu_pagelist_high_fraction
> +=============================
> +
> +This is the fraction of pages in each zone that are allocated for each
> +per cpu page list. The min value for this is 8. It means that we do
> +not allow more than 1/8th of pages in each zone to be allocated in any
> +single per_cpu_pagelist.

This, while technically correct (as an upper limit) is somewhat misleading as
the limit for a single per_cpu_pagelist also considers the number of local cpus.

> This entry only changes the value of hot per
> +cpu pagelists. User can specify a number like 100 to allocate 1/100th
> +of each zone to each per cpu page list.

This is worse. Anyone trying to reproduce this example on a system with multiple
cpus per node and checking the result will be puzzled.
So I think the part about number of local cpus should be mentioned to avoid
confusion.

> +The batch value of each per cpu pagelist remains the same regardless of the
> +value of the high fraction so allocation latencies are unaffected.
> +
> +The initial value is zero. Kernel uses this value to set the high pcp->high
> +mark based on the low watermark for the zone and the number of local
> +online CPUs. If the user writes '0' to this sysctl, it will revert to
> +this default behavior.
> +
> +