Commit 6a008918 authored by Yipeng Zou's avatar Yipeng Zou
Browse files

smart_grid: cpufreq: introduce smart_grid cpufreq control

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I7ZBSR


CVE: NA

----------------------------------------

In smart_grid zone, the system is divided into multiple zones.
The typical configuration is one hot zone and the other warm zone.

This commit can configure an independent cpufreq governor for each zone.
After the zone range in the system changes dynamically, it can
Automatically configure the corresponding cpufreq governor.

The default configuration of hot zone is performance governor, and the
default configuration of warm zone is powersave governor.

    --------        --------        --------
   | group0 |      | group1 |      | group2 |
    --------        --------        --------
       |                |              |
       v                v              v
  ---------------------------     -----------------
 |                           |   |                 |
 |          hot zone         |   |   warm zone     |
 |                           |   |                 |
  ---------------------------     -----------------
         ^                                  ^
         |                                  |
  -------------                          ----------
 | performance | <- cpufreq governor -> |powersave |
  ------------                           ----------

Introduce two attributes in /sys/devices/system/cpu/cpufreq:

1. smart_grid_governor_enable

For smart_grid governor, set 1 for enable, 0 for disable, read to get
current status.

For Notice, if smart_grid governor is enabled the governor of cpu may
auto switch by smart_grid, so if user wants to config governor by itself
smart_grid_governor shoudle be disabled.

2. smart_grid_governor

Only can set when smart_grid_governor has been enabled.

Set {level}-{governor name} formate to change each zone's governor:

0-performance will set all hot zone cpu's governor to performance.
1-powersave will set all warm zone cpu's governor to powersave.

Signed-off-by: default avatarYipeng Zou <zouyipeng@huawei.com>
parent 62468d81
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment