Re: [RFC 2/5] mm, page_alloc: calculate pageset high and batch once per zone

From: David Hildenbrand
Date: Thu Sep 10 2020 - 06:58:54 EST


On 07.09.20 18:36, Vlastimil Babka wrote:
> We currently call pageset_set_high_and_batch() for each possible cpu,
> which repeats the same calculations of high and batch values.
>
> Instead call it once per zone, and it applies the calculated values
> to all per-cpu pagesets of the zone.
>
> This also allows removing zone_pageset_init() and __zone_pcp_update() wrappers.
>
> No functional change.
>
> Signed-off-by: Vlastimil Babka <vbabka@xxxxxxx>
> ---
> mm/page_alloc.c | 40 +++++++++++++++++-----------------------
> 1 file changed, 17 insertions(+), 23 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 0b516208afda..f669a251f654 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -6236,12 +6236,13 @@ static void setup_pageset(struct per_cpu_pageset *p)
> pageset_update(&p->pcp, 0, 1);
> }
>
> -static void pageset_set_high_and_batch(struct zone *zone,
> - struct per_cpu_pageset *p)
> +static void zone_set_pageset_high_and_batch(struct zone *zone)
> {
> unsigned long new_high;
> unsigned long new_batch;
> int fraction = READ_ONCE(percpu_pagelist_fraction);
> + int cpu;
> + struct per_cpu_pageset *p;

I would use reverse Christmas tree layout. (same applies to patch #1,
you could put both unsigned long variables into a single line)

[...]

LGTM

Reviewed-by: David Hildenbrand <david@xxxxxxxxxx>

--
Thanks,

David / dhildenb