Re: [RFC 1/2] mm: add framework for PCP high auto-tuning

From: Michal Hocko
Date: Tue Jul 11 2023 - 07:07:24 EST


On Mon 10-07-23 14:53:24, Huang Ying wrote:
> The page allocation performance requirements of different workloads
> are usually different. So, we often need to tune PCP (per-CPU
> pageset) high to optimize the workload page allocation performance.
> Now, we have a system wide sysctl knob (percpu_pagelist_high_fraction)
> to tune PCP high by hand. But, it's hard to find out the best value
> by hand. And one global configuration may not work best for the
> different workloads that run on the same system. One solution to
> these issues is to tune PCP high of each CPU automatically.
>
> This patch adds the framework for PCP high auto-tuning. With it,
> pcp->high will be changed automatically by tuning algorithm at
> runtime. Its default value (pcp->high_def) is the original PCP high
> value calculated based on low watermark pages or
> percpu_pagelist_high_fraction sysctl knob. To avoid putting too many
> pages in PCP, the original limit of percpu_pagelist_high_fraction
> sysctl knob, MIN_PERCPU_PAGELIST_HIGH_FRACTION, is used to calculate
> the max PCP high value (pcp->high_max).

It would have been very helpful to describe the basic entry points to
the auto-tuning. AFAICS the central place of the tuning is tune_pcp_high
which is called from the freeing path. Why? Is this really a good place
considering this is a hot path? What about the allocation path? Isn't
that a good spot to watch for the allocation demand?

Also this framework seems to be enabled by default. Is this really
desirable? What about workloads tuning the pcp batch size manually?
Shouldn't they override any auto-tuning?

--
Michal Hocko
SUSE Labs