harmony 鸿蒙Lightweight CPU Isolation

  • 2022-08-09
  • 浏览 (716)

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.

Category API Description
Control API enable Enables or disables the lightweight CPU isolation. The value 1 means enable, and 0 means disable.
min_cpus Sets the minimum number of active (not isolated) CPUs.
max_cpus Sets the maximum number of active (not isolated) CPUs. The maximum value is the number of CPUs in a CPU cluster.
Status API active_cpus Obtains the number of active (not isolated) CPUs.
need_cpus Obtains the number of CPUs to de-isolate.
global_state Records 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

0  赞