Unverified Commit 7fbca9a8 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!8642 v9 Memory access profiler(SPE) driven NUMA balancing

Merge Pull Request from: @ci-robot 
 
PR sync from: Ze Zuo <zuoze1@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/PZI4KS7UGRNWTA27BZDOGMVXX26RDGCD/ 
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.

Change since v8:
-- add mem_sampling to file and directory name in patch 10.
-- some clean code on patch 2.

Changes since v7:
-- rename CONFIG_ARM_SPE to CONFIG_ARM_SPE_MEM_SAMPLING.
-- clean code on patch 8.

Changes since v6:
-- clean code on spe.c, arm_spe_pmu.c.

Changes since v5:
-- Modify perf and mem_sampling compatibility logic.
-- Introduce cmdline mem_sampling_on to use mem_sampling.

Changes since v4:
-- some patch check warning fixs, no functional change.

Changes since v3:
-- some clean code, no functional change.

Changes since v2:
-- clean code and commit fixs, no functional change.

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

Ze Zuo (11):
  drivers/arm/spe: In-kernel SPE driver for page access profiling
  mm: Add PMU based memory sampling abstract layer
  mm/mem_sampling.c: Add controlling interface for mem_sampling
  sched: Enable per-process mem_sampling from sched switch path
  mm/mem_sampling.c: Drive NUMA balancing via mem_sampling access data
  mm/mem_sampling.c: Add controlling interface for mem_sampling on numa
    balance
  tracing, numa balance: add trace events for numa data caused by
    mem_sampling
  driver/arm/spe: making mem_sampling and perf mutually exclusive with
    spe driver
  tracing, mem-sampling-sample: Adding tracking events to
    hardware-sampled page access
  samples/bpf: Add program for memory access by spe
  config: Enable memory sampling based pmu for numa balance by default


-- 
2.33.0
 
https://gitee.com/openeuler/kernel/issues/I9GZAQ 
 
Link:https://gitee.com/openeuler/kernel/pulls/8642

 

Reviewed-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: default avatarLiu Chao <liuchao173@huawei.com>
Reviewed-by: default avatarWeilong Chen <chenweilong@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents b96205ed b08b2deb
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1176,6 +1176,8 @@ CONFIG_PID_RESERVE=y
CONFIG_MEMORY_RELIABLE=y
# CONFIG_CLEAR_FREELIST_PAGE is not set
CONFIG_EXTEND_HUGEPAGE_MAPPING=y
CONFIG_MEM_SAMPLING=y
CONFIG_NUMABALANCING_MEM_SAMPLING=y

#
# Data Access Monitoring
@@ -6299,6 +6301,7 @@ CONFIG_UB_UDMA_HNS3=m
CONFIG_CPU_INSPECT=m
CONFIG_CPU_INSPECTOR_ATF=m
# end of CPU Inspect
CONFIG_ARM_SPE_MEM_SAMPLING=y
# end of Device Drivers

#
+2 −0
Original line number Diff line number Diff line
@@ -244,4 +244,6 @@ source "drivers/ub/Kconfig"

source "drivers/cpuinspect/Kconfig"

source "drivers/arm/Kconfig"

endmenu
+1 −0
Original line number Diff line number Diff line
@@ -195,3 +195,4 @@ obj-$(CONFIG_COUNTER) += counter/
obj-$(CONFIG_MOST)		+= most/
obj-$(CONFIG_ROH)		+= roh/
obj-$(CONFIG_UB)      += ub/
obj-$(CONFIG_ARM_SPE_MEM_SAMPLING)		+= arm/spe/

drivers/arm/Kconfig

0 → 100644
+2 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only
source "drivers/arm/spe/Kconfig"
+10 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only
#
# arm spe dirver
#
config ARM_SPE_MEM_SAMPLING
	bool "In-kernel SPE for driver for page access profiling"
	depends on ARM64
        help
	  Enable support for the ARMv8.2 Statistical Profiling Extension, which
	  provides periodic sampling of operations in the CPU pipeline.
Loading