openharmony 鸿蒙 kernel-standard-sched-cpuisolation

2022-08-09 浏览 (891)

Lightweight CPU Isolation

Basic Concepts

Lightweight CPU isolation enables dynamic CPU isolation based on the system load and user configuration. The kernel migrates the tasks and interrupts from the isolated CPU to other CPUs for execution. The isolated CPU enters the idle state, which reduces the power consumption. In addition, user-mode configuration and query APIs are provided for better system optimization.

Configuration

Enabling Lightweight CPU Isolation

Enable related configuration items and dependencies.

To enable lightweight CPU isolation, you need to enable the corresponding configuration items and dependencies during kernel compilation. The related configuration items are as follows:

CONFIG_CPU_ISOLATION_OPT=y
CONFIG_SCHED_CORE_CTRL=y

Enable the following dependencies:

CONFIG_SMP=y
CONFIG_SCHED_WALT=y

Available APIs

APIs are provided to set the number of isolated CPU cores and record the current status. Configurations can be performed based on CPU clusters. These APIs are located in the first CPU device directory of each CPU cluster, for example, /sys/devices/system/cpu/cpu0/core_ctl.

CategoryAPIDescription
Control APIenableEnables or disables the lightweight CPU isolation. The value 1 means enable, and 0 means disable.
min_cpusSets the minimum number of active (not isolated) CPUs.
max_cpusSets the maximum number of active (not isolated) CPUs. The maximum value is the number of CPUs in a CPU cluster.
Status APIactive_cpusObtains the number of active (not isolated) CPUs.
need_cpusObtains the number of CPUs to de-isolate.
global_stateRecords the status of all CPU clusters in the system, including the CPU isolation status, online status, and load information.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Kernel

harmony 鸿蒙Kernel Coding Specification

harmony 鸿蒙Standard Libraries

harmony 鸿蒙Interrupt Management

harmony 鸿蒙Event

harmony 鸿蒙Mutex

harmony 鸿蒙Queue

harmony 鸿蒙Semaphore

harmony 鸿蒙Doubly Linked List

harmony 鸿蒙Memory Management

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/a5633114fa8040d8b3056a2dc2c79a79