PR sync from: Ze Zuo zuoze1@huawei.com
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/VRAQCOYO4DTUFRY6Q77XYJSLJRNWKCFI/
Hi,

In Arm processors, there is a hardware PMU (Performance Monitoring
Unit) facility called Statistical Profiling Extension (SPE) that can
gather memory access metrics.

In this patchset, SPE is exploited as an access information sampling
approach to drive NUMA balancing. This sampling approach is
introducedto replace the method based on address space scanning and
hint faults with the access information provided by the hardware.
With this, it is no longer necessary for NUMA balancing to scan over
the address space periodically and rely on task-to-page association
built by NUMA hint faults. Instead, the access samples obtained from
hardware PMU are fed to NUMA balancing as equivalents to page fault.
Except for the replaced sampling approach, the rest of the NUMA
balancing policy is retained to do pages and tasks migrations
according to the samples.

Profiling based on SPE is an valid alternative sampling approach in
NUMA balancing for the optimal page and task placement. This can be
also extended to other architectures as long as there is a hardware
PMU that supports memory access profiling.

An abstract layer mem_sampling is introduced to reserve support for
other kernel features and different types of hardware PMU.

To help evaluate performance of this approach in system, syctl
interfaces are added to enable/disable hardware mem sampling. NUMA
balancing sampling approach can be also switched back to hint-faults-
based approach dynamically.

TODOs
Currently, SPE for NUMA balance does not support PMD-level page
migration, but it will be supported in later version.

Changes since v1:
-- clean code, no functional change.

Ze Zuo (11):
drivers/arm/spe: In-kernel SPE driver for page access profiling
Add hardware PMU (mem_sampling) abstract layer
mm/mem_sampling.c: Add controlling interface for mem_sampling
Enable per-process mem_sampling from sched switch path
Drive NUMA balancing via mem_sampling access data
Add controlling interface for mem_sampling numa_balance
tracing, numa balance: add trace events for numa data caused by
mem_sampling
driver/arm/spe: make mem_sampling and perf reuse arm spe driver
tracing, mem-sampling-sample: add trace events for page access
spe record ring buffer just for ctx origin flaw
config: Enable MEM_SAMPLING for Numa balance by default

--
2.33.0

#I9GZAQ:[openEuler-22.03-LTS-SP4] 鲲鹏920支持自适应NUMA需求