Steady-state based multi-threshold on-demand device frequency modulation method

By using a steady-state-based multi-threshold on-demand device frequency modulation method, the device frequency is dynamically adjusted, solving the problem that existing technologies cannot simultaneously meet user performance and energy consumption requirements, and achieving reduced energy consumption in steady state and improved response speed in non-steady state.

CN121255370BActive Publication Date: 2026-03-03KYLIN CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511811752.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-04
Publication Date
2026-03-03
Estimated Expiration
2045-12-04

AI Technical Summary

Technical Problem

Existing operating systems cannot fully adapt to the energy efficiency optimization needs of complex application scenarios in device frequency regulation strategies, and cannot simultaneously meet the dual requirements of user performance and energy consumption.

Method used

A steady-state-based multi-threshold on-demand device frequency modulation method is adopted. By initialization, setting frequency increase and decrease thresholds, steady-state determination and status detection, the device frequency is dynamically adjusted to adapt to load changes, including different frequency modulation strategies under steady-state and non-steady-state conditions.

Benefits of technology

It reduces energy consumption in steady state and improves response speed in non-steady state, enabling flexible adjustment of device frequency to meet users' dual requirements for performance and energy consumption.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

The application relates to a steady-state-based multi-threshold on-demand equipment frequency modulation method, which comprises the following steps: acquiring the current actual frequency and actual load of equipment in a steady-state judgment period; updating a steady-state counter and a state identifier based on the actual frequency, the actual load, a steady-state tolerance coefficient and a steady-state period judgment threshold value to obtain equipment state; determining a target frequency increase threshold value and a target frequency decrease differential threshold value based on the equipment state; determining a target frequency based on the size relationship between the current actual load of the equipment and the target frequency increase threshold value and the target frequency decrease differential threshold value; and controlling the equipment based on the target frequency. The application can reduce the energy consumption of the equipment in a steady state and improve the response speed of the equipment in a non-steady state.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of steady-state technology, and more specifically to a steady-state-based multi-threshold on-demand frequency modulation method for equipment. Background Technology

[0002] In devices such as laptops, desktops, and servers, most external devices have widely adopted dynamic voltage and frequency regulation technology to effectively reduce energy consumption. However, the devices themselves generally do not have the ability to make autonomous frequency adjustment decisions; their frequency regulation relies on the frequency adjustment strategies provided by the operating system. As the manager of hardware resources, the operating system needs to dynamically generate and issue frequency adjustment commands based on real-time load, performance requirements, and energy efficiency targets. The devices then execute specific operations according to these frequency adjustment commands.

[0003] Currently, in order to meet the dual requirements of user performance and energy consumption, the existing operating system's device frequency regulation strategy mechanism is still lagging behind and cannot fully adapt to the energy efficiency optimization needs of complex application scenarios. Therefore, there is an urgent need for an advanced device frequency regulation strategy that meets the dual requirements of user performance and energy consumption.

[0004] Currently, Linux systems offer several common device frequency scaling strategies. Performance, Powersave, and Userspace all require user intervention to switch or configure them to meet user requirements. Simple Ondemand, on the other hand, relies on relevant thresholds or default settings provided by the device. For example, a larger threshold results in higher energy efficiency and lower response speed, while a smaller threshold results in lower energy efficiency and faster response. Clearly, this single static threshold cannot meet the dual performance and energy consumption requirements of users in various scenarios. Summary of the Invention

[0005] To address the shortcomings of existing technologies, this invention provides a steady-state-based multi-threshold on-demand device frequency modulation method, comprising the following steps:

[0006] Step S1: During initialization, register a steady-state-based multi-threshold on-demand device frequency tuner with the kernel;

[0007] Step S2: The user selects a steady-state-based multi-threshold on-demand device frequency modulator, and the frequency modulator performs device frequency modulation based on steps S3 to S8;

[0008] Step S3: Initialize the frequency modulator, setting the frequency ramp threshold and frequency down differential threshold in steady state, the frequency ramp threshold and frequency down differential threshold in non-steady state, the steady state tolerance coefficient, the steady state determination period, the device status identifier is_stable, the steady state counter stable_count, and the steady state period determination threshold;

[0009] Step S4: Within a steady-state determination period, obtain the current actual frequency and actual load of the device, update the steady-state counter stable_count based on the actual frequency, actual load and steady-state tolerance coefficient, and obtain the device status and status identifier is_stable based on the steady-state determination threshold and the steady-state counter stable_count.

[0010] Step S5: Determine the target up-frequency threshold and target down-frequency differential threshold based on the device status, the up-frequency threshold and down-frequency differential threshold under steady state, and the up-frequency threshold and down-frequency differential threshold under non-steady state;

[0011] Step S6: Determine the target frequency based on the relationship between the current actual load of the device and the target up-frequency threshold and the difference between the target up-frequency threshold and the target down-frequency differential threshold;

[0012] Step S7: Control the device based on the target frequency;

[0013] Step S8: Repeat steps S3 to S7.

[0014] The stable counter `stable_count` is initialized to 0, and the device status identifier `is_stable` is initialized to `false`, indicating that the device is in an unstable state.

[0015] Step S4 includes:

[0016] Step S41: Calculate the standard workload of the equipment:

[0017] T = load current_freq;

[0018] Where T is the standard workload of the device in the current steady-state determination period, load is the current actual load of the device, and current_freq is the current actual frequency of the device;

[0019] Step S42: Determine if there is a T_last collected in the previous steady-state determination period:

[0020] If it does not exist, it means that this steady-state determination period is the first steady-state determination period. The T value determined in step S41 is assigned to T_last. After waiting for the next steady-state determination period, step S41 is executed again.

[0021] If it exists, proceed to step S43;

[0022] Step S43: Calculate the absolute value of the difference between the standard workload T and T_last, diff_T: If diff_T is less than the current actual frequency of the device multiplied by the steady-state tolerance coefficient, the steady-state counter stable_count is incremented by 1;

[0023] Step S44: If the value of the steady-state counter stable_count is greater than the steady-state period determination threshold, the device is determined to have entered a stable state, and the state flag is_stable is set to true; otherwise, the device is determined to be in an unstable state, and the state flag is_stable is set to false.

[0024] Step S45: Assign the T value determined in step S41 to T_last.

[0025] In step S5, if the device is in a stable state, the up-frequency threshold and down-frequency differential threshold under the stable state are determined as the target up-frequency threshold and the target down-frequency differential threshold. If the device is in an unstable state, the up-frequency threshold and down-frequency differential threshold under the unstable state are determined as the target up-frequency threshold and the target down-frequency differential threshold.

[0026] In step S6,

[0027] If the current actual load of the device is greater than the target upsampling threshold, then the target frequency is set to the maximum value;

[0028] If the current actual load of the equipment is less than the target up / down threshold and greater than the difference between the target up frequency threshold and the target down frequency differential threshold, then no target frequency adjustment will be performed.

[0029] If the current actual load of the device is less than the difference between the target up-frequency threshold and the target down-frequency differential threshold, then the target frequency is set according to the current actual load and the current actual frequency of the device.

[0030] Specifically, when the actual load of the device is less than the difference between the target up-frequency threshold and the target down-frequency differential threshold, the target frequency is set based on the actual load and the current actual frequency of the device, including:

[0031] Step S61: Subtract half of the target down-frequency differential threshold from the target up-frequency threshold to obtain the target load;

[0032] Step S62: Subtract the current actual load of the device from the target load to obtain the difference e;

[0033] Step S63: Obtain the target frequency based on the difference e and the current actual frequency of the device.

[0034] The target frequency is obtained based on the difference e and the device's current actual frequency, including:

[0035] Step S631: Obtain the proportionality coefficient based on formula (1):

[0036] Kp = current_freq / target_load; (1)

[0037] Where Kp is the scaling factor, current_freq is the current actual frequency of the device, and target_load is the target load;

[0038] Step S632: Obtain the differential coefficients based on formula (2):

[0039] Kd = k Kp; (2)

[0040] Where Kd is the differential coefficient, and k is a fixed coefficient less than 1;

[0041] Step S633: Obtain the target frequency based on formula (3):

[0042] (3)

[0043] in, For the target frequency, It is the differential of the difference e.

[0044] In step S1, by creating the devfreq_governor structure data, the frequency tuner name in the structure is used to register a steady-state multi-threshold on-demand device frequency tuner with the kernel.

[0045] In step S1, the event handling callback function and the frequency setting callback function members in the structure are also implemented.

[0046] In step S2, the user selects a steady-state multi-threshold on-demand device frequency modulator in the corresponding interface of the device's sys file system. The kernel calls the event handling callback function registered by the frequency modulator. The event handling callback function receives the frequency modulator start signal and, based on the start signal, redirects to the frequency modulator initialization function, enabling the frequency modulator to complete subsequent steps S3 to S8.

[0047] This also includes step S9: When a user switches a frequency modulator, the kernel calls the event handling callback function registered by the frequency modulator. The event handling callback function receives a stop signal from the frequency modulator. Based on the stop signal, the event handling callback function redirects to the frequency modulator's stop frequency modulator function to release memory, remove the created sys user interface, and call the kernel interface devfreq_monitor_stop() function to stop monitoring.

[0048] This invention can reduce the energy consumption of equipment when it is in a steady state: when the equipment is in a steady state, its load and workload will not change abruptly, and at this time, adjusting the frequency to a smaller value can achieve the purpose of saving energy.

[0049] This invention can improve the response speed of a device when it is in an unsteady state: when the system is in an unsteady state, its load and workload may change abruptly. At this time, adjusting the frequency to a higher level can improve the response speed. Detailed Implementation

[0050] To gain a better understanding of the technical solution and beneficial effects of the present invention, the technical solution of the present invention and its beneficial effects are described in detail below.

[0051] The steady-state-based multi-threshold on-demand device frequency modulation method provided by the present invention includes the following steps S1 to S9.

[0052] Step S1: During initialization, register a steady-state-based multi-threshold on-demand device frequency tuner with the kernel.

[0053] Create a `devfreq_governor` structure, and implement the event handling callback function member, frequency setting callback function member, and frequency modulator name in the structure. The event handling callback function is named `devfreq_stable_ondemand_func()`, the frequency setting callback function is named `devfreq_stable_ondemand_fun()`, and the kernel interface `devfreq_add_governor()` is called to register the frequency modulator to the system.

[0054] Step S2: The user selects a steady-state multi-threshold on-demand device frequency modulator in the corresponding interface of the device's sys file system. The kernel calls the event handling callback function registered by the frequency modulator, and the function passes in the frequency modulator start signal. The event handling callback function then redirects to the frequency modulator initialization function based on the start signal.

[0055] Step S3: Initialize the frequency modulator: Set the up-frequency threshold and down-frequency differential threshold for steady-state and non-steady-state conditions; set the steady-state tolerance coefficient and steady-state determination period; the up-frequency threshold and down-frequency differential threshold for non-steady-state conditions can use the thresholds provided by the device or the default values, while other parameters use the default values. Initialize internal variables: the steady-state state is_stable is false, and the steady-state calculator stable_count is 0.

[0056] A sys user interface is created, allowing users to set corresponding parameters. The frequency tuner calls the kernel interface devfreq_monitor_start() to begin device periodic monitoring.

[0057] The frequency setting callback function executes steps S4 to S8 below.

[0058] Step S4: Within a steady-state determination period, obtain the current actual frequency and actual load of the device. Update the steady-state counter `stable_count` and the status flag `is_stable` based on the actual frequency, actual load, and steady-state tolerance coefficient. Obtain the device status based on the steady-state determination threshold and the steady-state counter `stable_count`, including:

[0059] Step S41: Calculate the standard workload of the equipment:

[0060] T = load current_freq;

[0061] Where T is the standard workload of the device in the current steady-state determination period, load is the current actual load of the device, and current_freq is the current actual frequency of the device;

[0062] Step S42: Determine if there is a T_last collected in the previous steady-state determination period:

[0063] If it does not exist, it means that this steady-state determination period is the first steady-state determination period. The T value determined in step S41 is assigned to T_last. After waiting for the next steady-state determination period, step S41 is executed again.

[0064] If it exists, proceed to step S43;

[0065] Step S43: Calculate the absolute value of the difference between the standard workload T and T_last, diff_T: If diff_T is less than the current actual frequency of the device multiplied by the steady-state tolerance coefficient, the steady-state counter stable_count is incremented by 1;

[0066] Step S44: If the value of the steady-state counter stable_count is greater than the steady-state period determination threshold, the device is determined to have entered a stable state, and the state flag is_stable is set to true; otherwise, the device is determined to be in an unstable state, and the state flag is_stable is set to false.

[0067] Step S45: Assign the T value determined in step S41 to T_last.

[0068] Step S5: If the device is in a stable state, the up-frequency threshold and down-frequency differential threshold under the steady state are determined as the target up-frequency threshold and the target down-frequency differential threshold. If the device is in an unstable state, the up-frequency threshold and down-frequency differential threshold under the unstable state are determined as the target up-frequency threshold and the target down-frequency differential threshold.

[0069] Step S6: Based on the relationship between the current actual load of the device and the target up-frequency threshold and the target down-frequency differential threshold, determine the target frequency, specifically as follows:

[0070] If the current actual load of the device is greater than the target upsampling threshold, then the target frequency is set to the maximum value;

[0071] If the current actual load of the equipment is less than the target up / down threshold and greater than the difference between the target up frequency threshold and the target down frequency differential threshold, then no target frequency adjustment will be performed;

[0072] If the current actual load of the device is less than the difference between the target up-frequency threshold and the target down-frequency differential threshold, then the target frequency is set according to the current actual load and the current actual frequency of the device, including:

[0073] Step S61: Subtract half of the target down-frequency differential threshold from the target up-frequency threshold to obtain the target load;

[0074] Step S62: Subtract the current actual load of the device from the target load to obtain the difference e. Input the difference e into the frequency modulator. The frequency modulator outputs the target frequency and sends it to the device according to the following formula:

[0075] Kp = current_freq / target_load;

[0076] Where Kp is the scaling factor, current_freq is the current actual frequency of the device, and target_load is the target load;

[0077] Kd = k Kp;

[0078] Where Kd is the differential coefficient, and k is a fixed coefficient less than 1;

[0079] ;

[0080] in, For the target frequency, It is the differential of the difference e.

[0081] In this invention, the target frequency is a control variable. Within the current cycle, the driver sets the frequency according to the target frequency. Limited by the OPP table, the driver selects a frequency close to the target frequency for setting. The actual frequency / final frequency of the device is always the target frequency or a close value after multiple iterations of control. The device's load changes due to frequency control, ultimately making the actual load close to the target load.

[0082] Step S8: Repeat steps S3 to S7 to make the actual frequency output by the device gradually approach the target frequency during multiple iterations of control.

[0083] Step S9: When a user switches frequency modulators, the kernel calls the event handling callback function registered by the frequency modulator, passing in the frequency modulator stop signal. Based on the stop signal, the event handling callback function redirects to the frequency modulator's stop function. Memory is released, the created sys user interface is removed, and the kernel interface devfreq_monitor_stop() function is called to stop monitoring.

[0084] This invention can reduce the energy consumption of equipment when it is in a steady state: when the equipment is in a steady state, its load and workload will not change abruptly, and at this time, adjusting the frequency to a smaller value can achieve the purpose of saving energy.

[0085] This invention can improve the response speed of a device when it is in an unsteady state: when the system is in an unsteady state, its load and workload may change abruptly. At this time, adjusting the frequency to a higher level can improve the response speed.

[0086] Although the present invention has been described using the above preferred embodiments, it is not intended to limit the scope of protection of the present invention. Any changes and modifications made by those skilled in the art to the above embodiments without departing from the spirit and scope of the present invention shall still fall within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be defined by the claims.

Claims

1. A steady-state based multi-threshold on-demand device frequency modulation method, characterized in that, The method comprises the following steps: Step S1: registering a steady-state-based multi-threshold on-demand device frequency tuner to a kernel during initialization; Step S2: a user selects the steady-state-based multi-threshold on-demand device frequency tuner, and the tuner performs device frequency tuning based on steps S3 to S8; Step S3: the tuner is initialized, and a frequency increase threshold and a frequency decrease differential threshold in a steady state, a frequency increase threshold and a frequency decrease differential threshold in a non-steady state, a steady-state tolerance coefficient, a steady-state determination period, a device state identifier is_stable, a steady-state counter stable_count, and a steady-state period determination threshold are set; Step S4: the current actual frequency and actual load of the device are obtained within a steady-state determination period, the steady-state counter stable_count is updated based on the actual frequency, actual load, and steady-state tolerance coefficient, and the device state and state identifier is_stable are obtained based on the steady-state period determination threshold and the steady-state counter stable_count; Step S5: target frequency increase threshold and target frequency decrease differential threshold are determined based on the device state, the frequency increase threshold and the frequency decrease differential threshold in the steady state, and the frequency increase threshold and the frequency decrease differential threshold in the non-steady state; Step S6: a target frequency is determined based on the size relationship between the current actual load of the device and the difference between the target frequency increase threshold and the target frequency increase threshold minus the target frequency decrease differential threshold; if the current actual load of the device is greater than the target frequency increase threshold, the target frequency is determined as a maximum value; if the current actual load of the device is less than the target frequency increase threshold minus the target frequency decrease differential threshold, the target frequency is not adjusted; if the current actual load of the device is less than the target frequency increase threshold minus the target frequency decrease differential threshold, the target frequency is set according to the current actual load of the device and the current actual frequency: Step S61: the target frequency increase threshold minus one-half of the target frequency decrease differential threshold is obtained as a target load; Step S62: the target load minus the current actual load of the device is obtained as a difference value e; Step S63: the target frequency is obtained based on the difference value e and the current actual frequency of the device: Step S631: a proportional coefficient is obtained based on formula (1): Kp = current_freq / target_load; (1) wherein Kp is the proportional coefficient, current_freq is the current actual frequency of the device, and target_load is the target load; Step S632: a differential coefficient is obtained based on formula (2): Kd = k * Kp; (2) wherein Kd is the differential coefficient, and k is a fixed coefficient less than 1; Step S633: Obtain the target frequency based on formula (3): (3) wherein is the target frequency, is the differential of the difference e; Step S7: the device is controlled based on the target frequency; Step S8: steps S3 to S7 are repeated.

2. The steady state based multi-threshold on-demand device frequency modulation method of claim 1, wherein: The initial value of the steady-state counter stable_count is 0, and the initial value of the device state identifier is_stable is false, representing that the device is in a non-steady state.

3. The steady state based multi-threshold on-demand device frequency modulation method of claim 2, wherein, The step S4 comprises: Step S41: calculating the standard work of the device: T = load * current_freq; Wherein, T is the standard workload of the device in the current steady state determination period, load is the actual load of the device at present, and current_freq is the actual frequency of the device at present. Step S42: judging whether T_last collected in the last steady state determination period exists: If not, it represents that the current steady state determination period is the first steady state determination period, and the T value determined in step S41 is assigned to T_last, and after waiting for the next steady state determination period, step S41 is executed again; If yes, step S43 is executed. Step S43: calculating the absolute value diff_T of the difference between the standard workload T and T_last: if diff_T is less than the actual frequency of the device at present multiplied by the steady state tolerance coefficient, the steady state counter stable_count is added by 1. Step S44: if the value of the steady state counter stable_count is greater than the steady state period determination threshold, it is determined that the device enters the steady state, and the state identifier is_stable is set to true, otherwise it is determined that the device is in the non-steady state, and the state identifier is_stable is set to false. Step S45: the T value determined in step S41 is assigned to T_last.

4. The steady state based multi-threshold on-demand device frequency modulation method of claim 2, wherein: In step S5, if the device state is the steady state, the frequency increasing threshold and the frequency decreasing difference threshold in the steady state are determined as the target frequency increasing threshold and the target frequency decreasing difference threshold, and if the device state is the non-steady state, the frequency increasing threshold and the frequency decreasing difference threshold in the non-steady state are determined as the target frequency increasing threshold and the target frequency decreasing difference threshold.

5. The steady state based multi-threshold on-demand device frequency modulation method of claim 1, wherein: In step S1, the structure body data of devfreq_governor is created, the governor name in the structure body is realized to complete the kernel registration of the steady state based multi-threshold on-demand device governor.

6. The steady state based multi-threshold on-demand device frequency modulation method of claim 5, wherein: In step S1, the event processing callback function and the frequency setting callback function members in the structure body are also realized. In step S2, the user selects the steady state based multi-threshold on-demand device governor in the corresponding interface of the device sys file system, the kernel calls the event processing callback function registered by the governor, the event processing callback function inputs the governor start signal, and the event processing callback function is turned to the governor initialization function according to the start signal, so that the governor completes the subsequent steps S3 to S8.

7. The steady state based multi-threshold on-demand device frequency modulation method of claim 1, wherein Step S9: the user switches the governor, the kernel calls the event processing callback function registered by the governor, the event processing callback function inputs the governor stop signal, and the event processing callback function is turned to the stop governor function of the governor according to the stop signal to release the memory, remove the created sys user interface, and call the kernel interface devfreq_monitor_stop() function to stop the monitoring.

Citation Information

Patent Citations

  • Control method, device, storage medium and system for steady-state operation of equipment

    CN110500831A

  • Frequency control method, circuit and chip based on adaptive clock

    CN114706449A