Frequency control methods, control devices, electronic devices, and storage media for memory

By analyzing the request queue and load status in the memory and dynamically adjusting the frequency, the problem of poor memory power consumption control accuracy is solved, and efficient power consumption management of electronic devices is achieved.

CN115268616BActive Publication Date: 2026-11-17VIVO MOBILE COMM CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210985753.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-17
Publication Date
2026-11-17
Estimated Expiration
2042-08-17

AI Technical Summary

Technical Problem

Existing technologies have poor power consumption control precision for memory, making it difficult to effectively reduce the power consumption of electronic devices.

Method used

By analyzing the number and type of requests in the request queue, the predicted scenario is determined, the initial frequency of the memory is dynamically adjusted, and the frequency is adjusted according to the load status when the working duration meets the polling cycle.

Benefits of technology

It improves the smoothness of electronic device operation, while reducing power consumption and avoiding problems such as excessively high or low memory frequency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115268616B_ABST
    Figure CN115268616B_ABST
Patent Text Reader

Abstract

This application discloses a frequency control method, control device, electronic device, and storage medium for a memory. The method includes: before the memory starts working, determining a predicted scenario based on the number and type of requests in the request queue; determining the initial frequency of the memory based on the predicted scenario; controlling the memory to start working at the initial frequency; and, when the memory's working duration meets the polling cycle, acquiring the memory's load state and adjusting the memory's frequency based on the load state.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of electronic technology, and specifically relates to a frequency control method, control device, electronic device and storage medium for a memory. Background Technology

[0002] To reduce the power consumption of electronic devices, the memory of electronic devices usually adopts a method of dynamically adjusting the firmware frequency. In related technologies, timers are usually used to disable gate circuits or timed sleep links. When the gate circuit or link is enabled, a timer is created. When the timer expires, the relevant mechanism is triggered to put the storage device into a sleep state. However, this adjustment method has extremely high requirements for the timing length, poor control precision, and its ability to reduce memory power consumption is not ideal. Summary of the Invention

[0003] The purpose of this application is to provide a frequency control method, control device, electronic device, and readable storage medium for a memory, which can effectively reduce the power consumption of the memory.

[0004] In a first aspect, embodiments of this application provide a frequency control method for a memory, including:

[0005] Before the memory is activated, the predicted scenario is determined based on the number and type of requests in the request queue.

[0006] Determine the initial frequency of the memory based on the predicted scenario;

[0007] The control memory starts operating at the initial frequency;

[0008] If the memory's operating time meets the polling cycle, obtain the memory's load status and adjust the memory's frequency accordingly.

[0009] Secondly, embodiments of this application provide a frequency control device for a memory, comprising:

[0010] The first determining module is used to determine the prediction scenario based on the number and type of requests in the request queue before the memory is started.

[0011] The second determining module is used to determine the initial frequency of the memory based on the predicted scenario;

[0012] The first control module is used to control the memory to start working at the initial frequency;

[0013] The first adjustment module is used to obtain the load status of the memory when the working duration of the memory meets the polling cycle, and adjust the frequency of the memory according to the load status.

[0014] Thirdly, embodiments of this application provide an electronic device, including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein when the program or instructions are executed by the processor, they implement the steps of the memory frequency control method provided in the first aspect.

[0015] Fourthly, embodiments of this application provide a readable storage medium storing a program or instructions that, when executed by a processor, implement the steps of the memory frequency control method provided in the first aspect.

[0016] Fifthly, embodiments of this application provide a chip including a processor and a communication interface coupled to the processor, the processor being used to run programs or instructions to implement the steps of the memory frequency control method provided in the first aspect.

[0017] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the steps of the memory frequency control method provided in the first aspect.

[0018] In this embodiment of the application, the frequency control method for the memory includes: before the memory starts working, analyzing the number and type of requests in the request queue, and determining a predicted scenario based on the number and type of requests in the request queue. The predicted scenario reflects the working pressure of the memory in the next period of time. Therefore, based on the predicted scenario, an initial frequency can be matched for the memory. The memory operates at the initial frequency in the next period of time, which can fully meet the tasks in the request queue, improve the smoothness of the electronic device operation, and help avoid the memory operating frequency being too high or far exceeding the frequency required to process requests, thus helping to reduce power consumption.

[0019] Furthermore, during the operation of the memory, if the memory's working duration meets the polling cycle, the load status of the memory within that polling cycle is obtained. The load status reflects the memory's working status and workload in the previous polling cycle, thereby adjusting the memory's frequency according to the load status. This achieves dynamic adjustment of the memory's frequency, which can improve the smoothness of electronic device operation and reduce the power consumption of electronic devices during use. Attached Figure Description

[0020] Figure 1 One of the flowcharts of a memory frequency control method according to an embodiment of this application is shown;

[0021] Figure 2 A second flowchart of a memory frequency control method according to an embodiment of this application is shown;

[0022] Figure 3 A schematic diagram of a memory frequency control method according to an embodiment of this application is shown;

[0023] Figure 4 A schematic diagram is shown of obtaining predicted scene state parameters in a memory frequency control method according to an embodiment of this application;

[0024] Figure 5 A schematic diagram illustrating the determination of an initial frequency in a memory frequency control method according to an embodiment of this application is shown;

[0025] Figure 6 A schematic diagram illustrating the determination of a desired frequency in a memory frequency control method according to an embodiment of this application is shown;

[0026] Figure 7 A schematic diagram of dynamically adjusting the memory frequency in a memory frequency control method according to an embodiment of this application is shown;

[0027] Figure 8 A structural block diagram of a memory frequency control device according to an embodiment of this application is shown;

[0028] Figure 9 A structural block diagram of an electronic device according to an embodiment of this application is shown;

[0029] Figure 10 A schematic diagram of the hardware structure of an electronic device implementing an embodiment of this application is shown. Detailed Implementation

[0030] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0031] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0032] The frequency control method, frequency control device, electronic device, and readable storage medium of the present application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.

[0033] In some embodiments of this application, a memory frequency control method is provided for electronic devices. Figure 1 One of the flowcharts of a memory frequency control method according to an embodiment of this application is shown, such as... Figure 1 As shown, the method includes:

[0034] Step 102: Before the memory starts working, determine the prediction scenario based on the number and type of requests in the request queue;

[0035] Step 104: Determine the initial frequency of the memory based on the predicted scenario;

[0036] Step 106: Control the memory to start operating at the initial frequency;

[0037] Step 108: If the memory's operating time meets the polling cycle, obtain the memory's load status and adjust the memory's frequency according to the load status.

[0038] In this embodiment of the application, the above-mentioned request is also called an input / output request (where input / output is Input / Output, abbreviated as IO). The frequency control method of the memory includes: before the memory starts working, analyzing the number and type of requests in the request queue, and determining a predicted scenario based on the number and type of requests in the request queue. The predicted scenario reflects the working pressure of the memory in the next period of time. Therefore, based on the predicted scenario, an initial frequency can be matched for the memory. The memory works at the initial frequency in the next period of time, which can fully meet the tasks in the request queue, improve the smoothness of the electronic device operation, and help avoid the memory working frequency being too high or far exceeding the frequency required to process the request, thus helping to reduce power consumption.

[0039] Furthermore, during the operation of the memory, if the memory's working duration meets the polling cycle, the load status of the memory within that polling cycle is obtained. The load status reflects the memory's working status and workload in the previous polling cycle, thereby adjusting the memory's frequency according to the load status. This achieves dynamic adjustment of the memory's frequency, which can improve the smoothness of electronic device operation and reduce the power consumption of electronic devices during use.

[0040] In the initial stage of electronic device startup, the I / O request type count is added to the I / O scheduler hardware dispatch queue in the block device layer to count the number of different types of I / O requests; then, a predicted scenario is determined based on the type and number of I / O requests; then, an initial frequency is matched to the memory for the corresponding scenario so that the memory's operating frequency meets the scenario requirements, ensuring both smooth operation and reduced power consumption.

[0041] Furthermore, during the operation of the memory, if the memory's working duration meets the polling cycle, the memory's load status within that polling cycle is obtained. The load status reflects the memory's workload in processing I / O requests in the previous polling cycle, similar to the memory's duty cycle for processing I / O requests. Thus, the memory's operating frequency is adjusted according to the load status, achieving dynamic adjustment of the memory's frequency. During the use of electronic devices, this can improve the smoothness of the electronic devices' operation while reducing their power consumption.

[0042] As one possible implementation, the prediction scenario is determined based on the number and type of requests in the request queue, including: obtaining the number and type of requests in the request queue; and determining the prediction scenario based on the time consumption weight and importance weight of different types of requests.

[0043] Specifically, analyzing the number and types of requests in the request queue and determining the prediction scenario includes: obtaining the number and types of requests in the request queue; since different types of requests have different levels of importance and time consumption, assigning weights to different types of requests; and then calculating the prediction scenario by combining the number of different types of requests. Here, the time consumption weight represents the weight of the time required for the memory to process the request, and the importance weight represents the weight of the importance of the request to the performance of the electronic device.

[0044] Among them, such as Figure 4As shown, when an I / O request is about to be dispatched from the request queue to the underlying memory, the current memory firmware status is first determined. If the memory firmware has not processed the I / O request, a firmware frequency preset process is performed, which sets the memory's operating frequency to the initial frequency. By traversing the I / O request dispatch queue, the I / O requests are categorized into: sync I / O, read I / O, write I / O, discard I / O, and flush I / O, and the number of each type of I / O request is counted. Among them, sync I / O has high synchronization requirements and is often related to the foreground process during the use of electronic devices, meaning that sync I / O is of high importance. Write I / O, discard I / O, and flush I / O have longer firmware processing times and may cause slow response and lag in electronic device systems; these are I / O types that require special attention, meaning that write I / O, discard I / O, and flush I / O are of high importance. To more accurately assess the current scenario, different time-consuming weight parameters T and importance weight parameters W are assigned to different I / O request types. The weighted average yields a result S, which represents the scenario state parameter of the current predicted scenario. This mathematically quantifies the time-consuming weight, importance weight, and predicted scenario state, facilitating processor processing and calculation. Specifically, the time-consuming weight parameter T represents the time-consuming weight state of the request, the importance weight parameter W represents the importance state of the request, and the scenario state parameter S represents the state of the predicted scenario. The time-consuming weight parameter T is determined by the memory read / write performance, and the importance weight parameter W is determined by the maximum number of different I / O request types that can be executed in the queue.

[0045]

[0046] Where S represents the scene state parameters of the predicted scene, c s T represents the number of synchronous I / O operations. s W represents the time-weighting parameter for synchronous I / O. s The weight parameter representing the importance of synchronous I / O; c r T represents the number of read I / O operations. r W represents the time-weighting parameter for read I / O. r The weight parameter representing the importance of read I / O; c w T represents the number of write I / O operations. w W represents the time-weighting parameter for write IO. w The weight parameter representing the importance of write I / O; c d T represents the number of discard IOs. d W represents the time-weighting parameter for discard IO.d The weight parameter representing the importance of discard IO; c f T represents the number of flush IOs. f W represents the time-weighting parameter for flush IO. f The count parameter represents the importance weight of flush IO. all This indicates the total number of IO requests.

[0047] As shown above, by calculating the time-consuming weight parameter T and the importance weight parameter W for different types of IO requests and taking the average value, a scenario state parameter S is obtained. The predicted scenario is mathematically represented, which fully reflects the memory's subsequent processing of IO requests. Based on this, the initial frequency is determined so as to reduce the power consumption of electronic devices while satisfying the smoothness of electronic devices as much as possible.

[0048] As one possible implementation, determining the initial frequency of the memory based on the predicted scenario includes: acquiring scene state parameters of the predicted scenario; using a first frequency as the initial frequency when the scene state parameters are less than a first scene state parameter threshold; using a second frequency as the initial frequency when the scene state parameters are greater than a second scene state parameter threshold; and using a third frequency as the initial frequency when the scene state parameters are greater than or equal to the first scene state parameter threshold and less than or equal to the second scene state parameter threshold; wherein the first scene state parameter threshold is less than the second scene state parameter threshold; the first frequency is the lowest operating frequency of the memory, the second frequency is the highest operating frequency of the memory, and the third frequency is greater than the first frequency and less than the second frequency.

[0049] Specifically, the threshold S of the first scene state parameter is preset. limit_min Second scenario state parameter threshold S limit_max The threshold value of the first scene state parameter is less than the threshold value of the second scene state parameter. Based on the predicted scene, the initial frequency of the memory is determined, specifically including: first, obtaining the scene state parameter S of the predicted scene; then, comparing the scene state parameter S with the threshold value S of the first scene state parameter. limit_min Second scenario state parameter threshold S limit_max The size relationship.

[0050] like Figure 5 As shown, after obtaining the scene state parameter S, S is combined with two scene state parameter thresholds, namely the first scene state parameter threshold S. limit_min Second scenario state parameter threshold S limit_max Make a judgment; if the scene state parameter S is less than the first scene state parameter threshold S... limit_miThis indicates that the current I / O scenario is considered a low-load scenario, and the initial memory frequency Freq is set accordingly. target Set to the lowest operating frequency min_freq of the memory, which is the memory frequency Freq. target Equals the lowest frequency min_freq; if S is greater than the threshold S of the second scene state parameter. limit_max If the current I / O scenario is considered to be a high-load scenario, then the highest operating frequency of the memory, max_freq, is used as the initial frequency Freq. target That is, the initial frequency Freq of the memory. target Equal to the highest frequency max_freq; if the scene state parameter S is between the first scene state parameter threshold S limit_min Second scenario state parameter threshold S limit_max If the current I / O scenario falls within a balanced load scenario, then the third frequency between the highest frequency (max_freq) and the lowest frequency (min_freq) of the memory is used as the initial memory frequency (Freq). target .

[0051] Among them, the lowest frequency of the memory, min_freq, is the first frequency, the highest frequency of the memory, max_freq, is the second frequency, and the third frequency is greater than the first frequency but less than the second frequency.

[0052] Among them, S limit_min and S limit_max The value of will be determined by factors such as the IO scheduler strategy, the use case, and the dispatch queue depth.

[0053] In some embodiments of this application, a memory frequency control method is provided for electronic devices. Figure 2 A second flowchart of a memory frequency control method according to an embodiment of this application is shown, as follows: Figure 2 As shown, the method includes:

[0054] Step 202: Before the memory starts working, determine the prediction scenario based on the number and type of requests in the request queue;

[0055] Step 204: Determine the initial frequency of the memory based on the predicted scenario;

[0056] Step 206: Control the memory to start operating at the initial frequency;

[0057] Step 208: If the memory's operating time meets the polling cycle, obtain the memory's load status;

[0058] Step 210: Determine the desired frequency of the memory based on the load status;

[0059] Step 212: Iterate through the requests in the request queue that are in the foreground and count the number of requests in the foreground;

[0060] Step 214: Adjust the memory frequency based on the desired frequency, the number of requests in the foreground, and the predicted scenario.

[0061] In this embodiment of the application, the above-mentioned request is also referred to as an I / O request. The memory frequency control method includes: before the memory starts working, analyzing the number and type of requests in the request queue, and determining a predicted scenario based on the number and type of requests in the request queue. The predicted scenario reflects the working pressure of the memory in the next period of time. Therefore, based on the predicted scenario, an initial frequency can be matched for the memory. The memory works at the initial frequency in the next period of time, which can fully meet the tasks in the request queue, improve the smoothness of the electronic device operation, and help avoid the memory working frequency being too high and far exceeding the frequency required to process the request, thus helping to reduce power consumption.

[0062] Furthermore, during memory operation, if the memory's operating time meets the polling cycle, the memory's load status within that polling cycle is obtained. The load status reflects the memory's operating state and workload in the previous polling cycle. Based on this load status, the expected frequency of the memory for the next period can be determined—that is, the frequency at which requests can be processed more efficiently in the coming period. This expected frequency is recorded as the primary criterion. For example, under low load, the electronic device expects to operate the memory at a lower frequency, while under high load, the electronic device expects to operate the memory at a higher frequency.

[0063] Then, iterate through the request queue, obtain and count the number of requests in the foreground. Foreground requests need to be processed with priority to ensure the smoothness of the foreground process, and the number of foreground requests is recorded as the second criterion.

[0064] The memory's operating frequency is adjusted based on the desired frequency and the number of requests in the foreground. In other words, the memory's operating frequency is determined based on the first and second criteria, thereby achieving dynamic adjustment of the memory's operating frequency. Furthermore, adjusting the memory's operating frequency based on the desired frequency and the number of requests in the foreground greatly reduces the possibility of I / O request blocking when adjusting the memory firmware frequency.

[0065] Specifically, such as Figure 3As shown, a request, also known as an I / O request, is added to the I / O scheduler hardware dispatch queue in the block device layer during the initial operation of an electronic device. The count of different types of I / O requests is recorded. Then, based on the type and quantity of I / O requests, a predicted scenario is determined, reflecting the scenario state of the memory when executing I / O requests. An initial frequency is matched to the memory for the corresponding scenario. The expected frequency determined based on the memory load state within the polling cycle is used as the first criterion. The foreground I / O requests in the I / O scheduler hardware dispatch queue are traversed, and their count is used as the second criterion. Combining the first and second criteria enables the driver to perceive the I / O scenario at both the upper and lower layers, comprehensively providing a suitable operating frequency so that the memory's operating frequency meets the scenario requirements, ensuring both smooth operation and reduced power consumption.

[0066] The memory frequency control method can be divided into two parts. The first part is the request dispatch optimization part, in which the initial frequency is determined and the memory operation is controlled by the initial frequency. Then, the load feedback optimization part is entered. In this part, the desired frequency is determined by calculating the load state of the memory, and the memory frequency is dynamically adjusted in combination with the number of requests in the foreground.

[0067] As one possible implementation, the step of obtaining the memory load status when the memory's operating duration meets the polling cycle specifically includes: obtaining the memory's operating duration within the polling cycle when the memory's operating duration meets the polling cycle; and determining the load status based on the ratio of the operating duration to the duration of the polling cycle.

[0068] Specifically, when the memory's operating time meets the polling cycle, the steps for obtaining the memory's load status include: obtaining the memory's operating time within the polling cycle, calculating the proportion of the memory's operating time in the previous polling cycle to the previous polling cycle, and using this proportion as a basis to calculate the mathematical parameters of the load status. That is, by calculating the proportion of the memory's operating time in the previous polling cycle, the load status is determined. The longer the memory's operating time within the polling cycle, the higher the memory's load status; the shorter the memory's operating time within the polling cycle, the lower the memory's load status.

[0069] In this process, the operation is carried out in a cyclical manner, with each polling cycle t... Δ Within, the total duration t is counted. total The time it takes for the memory to execute I / O requests, also known as the working time t. busy The load state parameter load is the proportion of time spent executing I / O requests to the total time, which is used as the load state of the memory firmware in executing I / O requests. That is, load = t busy / ttotal Among them, the load status parameter load is a mathematical parameter of the load status, which can be represented numerically by the load status.

[0070] As one possible implementation, determining the desired frequency of the memory based on the load state includes: acquiring load state parameters of the load state; using a fourth frequency as the desired frequency when the load state parameters are less than a first load state parameter threshold; using a fifth frequency as the desired frequency when the load state parameters are greater than a second load state parameter threshold; and using a sixth frequency as the desired frequency when the load state parameters are greater than or equal to the first load state parameter threshold and less than or equal to the second load state parameter threshold; wherein the first load state parameter threshold is less than the second load state parameter threshold; the fourth frequency is determined based on the current frequency of the memory, the load state parameters, the first load state parameter threshold, and the second load state parameter threshold; the fifth frequency is the highest operating frequency of the memory; and the sixth frequency is the current frequency.

[0071] Specifically, a first load state parameter threshold l1 and a second load state parameter threshold l2 are preset. Based on the load state, the desired frequency of the memory is determined, including: obtaining the load state parameter load; if the load state parameter load is less than the first load state parameter threshold l1, it indicates that the current load state of the memory is low. In this case, the desired frequency of the memory is determined based on the current frequency of the memory, the load state parameter load, the first load state parameter threshold l1, and the second load state parameter threshold l2; if the load state parameter load is greater than the second load state parameter threshold l2, it indicates that the current load state of the memory is high. In this case, the highest frequency of the memory's operating frequency is used as the desired frequency; if the load state parameter load is greater than or equal to the first load state parameter threshold l1 and less than or equal to the second load state parameter threshold l2, it indicates that the current load state of the memory is moderate. In this case, the current frequency of the memory is used as the desired frequency.

[0072] The fourth frequency is determined based on the current frequency of the memory, the load state parameter load, the first load state parameter threshold l1, and the second load state parameter threshold l2. The fifth frequency is the highest frequency of the memory's operation, and the sixth frequency is the current frequency of the memory.

[0073] Among them, such as Figure 6 As shown, the method for calculating the desired frequency based on the load status parameter is as follows:

[0074]

[0075] Among them, freq loadThe desired frequency is represented by `max_freq`, the maximum operating frequency of the memory is represented by `current_freq`, the current operating frequency of the memory is represented by `load`, the load state parameters are represented by `l1`, the first load state parameter threshold is represented by `l2`, and the second load state parameter threshold is represented by `C`. s This represents the bias coefficient. If the load state parameter load is greater than the second load state parameter threshold l2, then the desired frequency freq is... load The maximum frequency of the memory is set; if the load state parameter load is between the first load state parameter threshold l1 and the second load state parameter threshold l2, then the desired frequency freq is... load The current operating frequency of the memory is set; if the load status parameter load is less than the first load status parameter threshold l1, then the desired frequency freq is... load It needs to be calculated using a formula, based on the product of the current frequency, the load state parameter load, the ratio of the first load state parameter threshold l1 to the second load state parameter threshold l2, and the bias coefficient. Where C... s The value range is based on empirical values, such as [3, 4]. The smaller the value, the more it tends to be a low-frequency state.

[0076] And, obtain the desired frequency freq load Subsequently, by evaluating the current frequency change trend and the previous frequency change trend, the data is smoothed and filtered to reduce data jitter. The filtered frequency is then converted into the desired frequency (freq) for the memory firmware. load This will serve as the primary criterion for dynamic frequency adjustment of the memory.

[0077] As one possible implementation, adjusting the memory frequency based on the desired frequency, the number of foreground requests, and the predicted scenario includes: controlling the memory to operate at the desired frequency when the number of foreground requests is zero and the scenario state parameter is less than a first scenario state parameter threshold; and controlling the memory to maintain the current frequency when the number of foreground requests is not zero, or the scenario state parameter is greater than or equal to the first scenario state parameter threshold. Specifically, adjusting the memory frequency based on the desired frequency, the number of foreground requests, and the predicted scenario includes: determining whether the number of foreground requests in the current request queue is zero. If the number of foreground requests in the current request queue is zero, then the smoothness of the foreground process does not need to be considered at this time. Simultaneously, when the scenario state parameter of the load scenario is less than the first scenario state parameter threshold, that is, when the load scenario is under low load, the electronic device has no foreground requests and the load is low. Therefore, the memory can be controlled to operate at the desired frequency. Specifically, the memory can be adjusted to the lowest frequency of its operating frequency.

[0078] If the number of requests in the foreground is not zero, in order to ensure the smoothness of the foreground process, it is necessary to maintain the current operating frequency of the memory or increase the current operating frequency of the memory.

[0079] Similarly, if the scene state parameter is greater than or equal to the threshold of the first scene state parameter, it means that the current load state of the memory is not a low load state. Therefore, in order to ensure the normal operation of the electronic device, it is necessary to maintain the current operating frequency of the memory or increase the current operating frequency of the memory.

[0080] That is, such as Figure 7 As shown, based on the first and second criteria of the integrated dynamic frequency adjustment strategy, if the initial frequency of the memory is different from the desired frequency and there are no foreground IO requests in a waiting state, and the IO scenario is a low-load situation, then the dynamic setting of the memory firmware frequency is allowed, that is, the memory is controlled to run at the desired frequency; otherwise, the dynamic frequency adjustment operation will be exited.

[0081] This application enables the reduction of power consumption in electronic devices during use by dynamically adjusting the memory firmware frequency. Furthermore, by identifying the memory's scenario state, it can more accurately preset the memory firmware's operating frequency, ensuring it precisely meets the performance requirements of the corresponding scenario. Simultaneously, it can filter out frequency fluctuations in critical regions during load feedback and identify the foreground I / O request status, significantly reducing the possibility of I / O request blocking caused by adjusting the memory firmware frequency and mitigating frequent stuttering issues encountered by users.

[0082] The memory frequency control method provided in this application can be executed by a memory frequency control device. This application uses the memory frequency control device executing the memory frequency control method as an example to illustrate the memory frequency control device provided in this application.

[0083] like Figure 8 As shown, in some embodiments of this application, a memory frequency control device 800 is provided, including: a first determining module 802, used to determine a predicted scenario based on the number and type of requests in the request queue before the memory starts working; a second determining module 804, used to determine the initial frequency of the memory based on the predicted scenario; a first controlling module 806, used to control the memory to start working at the initial frequency; and a first adjusting module 808, used to obtain the load state of the memory when the working duration of the memory meets the polling cycle, and adjust the frequency of the memory based on the load state.

[0084] As one possible implementation, the first determining module includes: a first obtaining submodule, used to obtain the number and type of requests in the request queue; and a first determining submodule, used to determine the prediction scenario based on the time consumption weight and importance weight of different types of requests.

[0085] In one possible implementation, the second determining module includes: a second acquiring submodule, used to acquire scene state parameters of the predicted scene; a second determining submodule, used to use a first frequency as an initial frequency when the scene state parameters are less than a first scene state parameter threshold; a third determining submodule, used to use a second frequency as an initial frequency when the scene state parameters are greater than a second scene state parameter threshold; and a fourth determining submodule, used to use a third frequency as an initial frequency when the scene state parameters are greater than or equal to the first scene state parameter threshold and less than or equal to the second scene state parameter threshold; wherein, the first scene state parameter threshold is less than the second scene state parameter threshold; the first frequency is the lowest frequency of the memory's operating frequency, the second frequency is the highest frequency of the memory's operating frequency, and the third frequency is greater than the first frequency and less than the second frequency.

[0086] As one possible implementation, the first adjustment module includes: a third acquisition submodule, used to acquire the load status of the memory when the working duration of the memory meets the polling cycle; a fifth determination submodule, used to determine the desired frequency of the memory based on the load status; a first statistics submodule, used to traverse the requests in the foreground in the request queue and count the number of requests in the foreground; and a first adjustment submodule, used to adjust the frequency of the memory based on the desired frequency, the number of requests in the foreground, and the predicted scenario.

[0087] As one possible implementation, the third acquisition submodule includes: a fourth acquisition submodule, used to acquire the working duration of the memory within the polling cycle when the working duration of the memory meets the polling cycle; and a sixth determination submodule, used to determine the load state based on the ratio of the working duration to the duration of the polling cycle.

[0088] As one possible implementation, the fifth determining submodule includes: a fifth acquiring submodule, used to acquire load state parameters of the load state; a seventh determining submodule, used to use a fourth frequency as the desired frequency when the load state parameters are less than a first load state parameter threshold; an eighth determining submodule, used to use a fifth frequency as the desired frequency when the load state parameters are greater than a second load state parameter threshold; and a ninth determining submodule, used to use a sixth frequency as the desired frequency when the load state parameters are greater than or equal to the first load state parameter threshold and less than or equal to the second load state parameter threshold; wherein, the first load state parameter threshold is less than the second load state parameter threshold; the fourth frequency is determined based on the current frequency of the memory, the load state parameters, the first load state parameter threshold, and the second load state parameter threshold; the fifth frequency is the highest frequency of the memory's operating frequency; and the sixth frequency is the current frequency.

[0089] As one possible implementation, the first adjustment submodule includes: a first control submodule, used to control the memory to operate at a desired frequency when the number of requests in the foreground is zero and the scene state parameter is less than a first scene state parameter threshold; and a second control submodule, used to control the memory to maintain the current frequency when the number of requests in the foreground is not zero, or the scene state parameter is greater than or equal to the first scene state parameter threshold.

[0090] The frequency control device for the memory in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the specific type of device.

[0091] The memory frequency control device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit it.

[0092] The frequency control device for the memory provided in this application embodiment can implement the various processes implemented in the above method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.

[0093] This application also provides an electronic device. Figure 9 A structural block diagram of an electronic device according to an embodiment of this application is shown, such as... Figure 9 As shown, the electronic device 900 includes a processor 902 and a memory 904. The program or instructions stored in the memory 904 and executable on the processor 902 implement the various processes of the above method embodiments when executed by the processor 902, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0094] It should be noted that the electronic devices in the embodiments of this application include the aforementioned mobile electronic devices and non-mobile electronic devices.

[0095] Figure 10 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.

[0096] The electronic device 1000 includes, but is not limited to, components such as: radio frequency unit 1001, network module 1002, audio output unit 1003, input unit 1004, sensor 1005, display unit 1006, user input unit 1007, interface unit 1008, memory 1009, and processor 1010.

[0097] Those skilled in the art will understand that the electronic device 1000 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 1010 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 10 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0098] The processor 1010 is used to determine the prediction scenario based on the number and type of requests in the request queue before the memory is accessed.

[0099] The processor 1010 is used to determine the initial frequency of the memory based on the predicted scenario.

[0100] The processor 1010 is used to control the memory to start operating at an initial frequency.

[0101] The processor 1010 is used to obtain the load status of the memory when the memory's operating time meets the polling cycle, and adjust the memory frequency according to the load status.

[0102] Processor 1010 is used to obtain the number and type of requests in the request queue.

[0103] Processor 1010 is used to determine the prediction scenario based on the time consumption weight and importance weight of different types of requests.

[0104] The processor 1010 is used to obtain scene state parameters of the predicted scene.

[0105] The processor 1010 is configured to use a first frequency as the initial frequency when the scene state parameter is less than a first scene state parameter threshold; use a second frequency as the initial frequency when the scene state parameter is greater than a second scene state parameter threshold; and use a third frequency as the initial frequency when the scene state parameter is greater than or equal to the first scene state parameter threshold and less than or equal to the second scene state parameter threshold. The first scene state parameter threshold is less than the second scene state parameter threshold. The first frequency is the lowest operating frequency of the memory, the second frequency is the highest operating frequency of the memory, and the third frequency is greater than the first frequency and less than the second frequency.

[0106] The processor 1010 is used to obtain the load status of the memory when the memory's operating duration meets the polling cycle.

[0107] The processor 1010 is used to determine the desired frequency of the memory based on the load status.

[0108] Processor 1010 is used to traverse the requests in the request queue that are in the foreground and count the number of requests in the foreground.

[0109] The processor 1010 is used to adjust the memory frequency based on the desired frequency, the number of requests in the foreground, and the predicted scenario.

[0110] The processor 1010 is used to obtain the memory's operating time within the polling period, provided that the memory's operating time satisfies the polling period.

[0111] Processor 1010 is used to determine the load status based on the ratio of working time to polling cycle duration.

[0112] Processor 1010 is used to obtain load status parameters of the load status.

[0113] The processor 1010 is configured to use a fourth frequency as the desired frequency when the load state parameter is less than a first load state parameter threshold; a fifth frequency as the desired frequency when the load state parameter is greater than a second load state parameter threshold; and a sixth frequency as the desired frequency when the load state parameter is greater than or equal to the first load state parameter threshold and less than or equal to the second load state parameter threshold. The first load state parameter threshold is less than the second load state parameter threshold. The fourth frequency is determined based on the current frequency of the memory, the load state parameter, the first load state parameter threshold, and the second load state parameter threshold. The fifth frequency is the highest operating frequency of the memory, and the sixth frequency is the current frequency.

[0114] The processor 1010 controls the memory to operate at a desired frequency when the number of requests in the foreground is zero and the scene state parameter is less than the first scene state parameter threshold; and controls the memory to maintain the current frequency when the number of requests in the foreground is not zero, or the scene state parameter is greater than or equal to the first scene state parameter threshold.

[0115] Specifically, in electronic devices, before the memory starts working, the number and types of requests in the request queue are analyzed, and a predicted scenario is determined based on the number and types of requests in the request queue. The predicted scenario reflects the memory's workload in the coming period. Therefore, based on the predicted scenario, an initial frequency can be matched to the memory. The memory operates at the initial frequency in the coming period, which can fully meet the tasks in the request queue, improve the smoothness of the electronic device's operation, and help avoid the memory's operating frequency being too high and far exceeding the frequency required to process the requests, thus helping to reduce power consumption.

[0116] Furthermore, during the operation of the memory, if the memory's working duration meets the polling cycle, the load status of the memory within that polling cycle is obtained. The load status reflects the memory's working status and workload in the previous polling cycle, thereby adjusting the memory's frequency according to the load status. This achieves dynamic adjustment of the memory's frequency, which can improve the smoothness of electronic device operation and reduce the power consumption of electronic devices during use.

[0117] In the initial stage of electronic device startup, the I / O request type count is added to the I / O scheduler hardware dispatch queue in the block device layer to count the number of different types of I / O requests; then, a predicted scenario is determined based on the type and number of I / O requests; then, an initial frequency is matched to the memory for the corresponding scenario so that the memory's operating frequency meets the scenario requirements, ensuring both smooth operation and reduced power consumption.

[0118] Furthermore, during the operation of the memory, if the memory's working duration meets the polling cycle, the memory's load status within that polling cycle is obtained. The load status reflects the memory's workload in processing I / O requests in the previous polling cycle, similar to the memory's duty cycle for processing I / O requests. Thus, the memory's operating frequency is adjusted according to the load status, achieving dynamic adjustment of the memory's frequency. During the use of electronic devices, this can improve the smoothness of the electronic devices' operation while reducing their power consumption.

[0119] It should be understood that, in this embodiment, the input unit 1004 may include a graphics processing unit (GPU) 10041 and a microphone 10042. The GPU 10041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 1006 may include a display panel 10061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 1007 includes a touch panel 10071 and at least one of other input devices 10072. The touch panel 10071 is also called a touch screen. The touch panel 10071 may include a touch detection device and a touch controller. Other input devices 10072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.

[0120] The memory 1009 can be used to store software programs and various data. The memory 1009 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 1009 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 1009 in this embodiment includes, but is not limited to, these and any other suitable types of memory.

[0121] The processor 1010 may include one or more processing units; optionally, the processor 1010 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into the processor 1010.

[0122] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0123] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0124] This application also provides a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled. The processor is used to run programs or instructions to implement the various processes of the above-described memory frequency control method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0125] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0126] This application provides a computer program product stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the memory frequency control method embodiment described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0127] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0128] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.

[0129] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A frequency control method of a memory, characterized by, include: Before the memory is activated, the predicted scenario is determined based on the number and type of requests in the request queue. Based on the predicted scenario, determine the initial frequency of the memory; Control the memory to start operating at the initial frequency; If the working duration of the memory meets the polling cycle, the load status of the memory is obtained, and the frequency of the memory is adjusted according to the load status, wherein the load status reflects the working status and working pressure of the memory in the previous polling cycle. When the operating duration of the memory meets the polling cycle, obtaining the load status of the memory and adjusting the frequency of the memory according to the load status includes: If the operating duration of the memory meets the polling cycle, obtain the load status of the memory; Based on the load status, determine the desired frequency of the memory; Iterate through the requests in the request queue that are in the foreground, and count the number of requests in the foreground; The frequency of the memory is adjusted based on the expected frequency, the number of requests from the foreground, and the predicted scenario. The step of determining the desired frequency of the memory based on the load state includes: determining the frequency of the memory based on the load state; after obtaining the frequency, performing a smoothing filter on the frequency by evaluating the current frequency change trend and the previous frequency change trend, and using the filtered frequency as the desired frequency.

2. The frequency control method of memory according to claim 1, wherein, The step of determining the prediction scenario based on the number and type of requests in the request queue includes: Obtain the number and type of the requests in the request queue; The prediction scenario is determined based on the time consumption weight and importance weight of the different types of requests.

3. The frequency control method of memory according to claim 1 or 2, wherein, Determining the initial frequency of the memory based on the predicted scenario includes: Obtain the scene state parameters of the predicted scene; If the scene state parameter is less than the first scene state parameter threshold, the first frequency is used as the initial frequency; If the scene state parameter is greater than the second scene state parameter threshold, the second frequency is used as the initial frequency; If the scene state parameter is greater than or equal to the first scene state parameter threshold and less than or equal to the second scene state parameter threshold, the third frequency is used as the initial frequency. Wherein, the first scene state parameter threshold is less than the second scene state parameter threshold; the first frequency is the lowest operating frequency of the memory, the second frequency is the highest operating frequency of the memory, and the third frequency is greater than the first frequency and less than the second frequency.

4. The frequency control method of memory according to claim 1, wherein, The step of obtaining the load status of the memory when the working duration of the memory meets the polling cycle specifically includes: If the operating duration of the memory satisfies the polling cycle, obtain the operating duration of the memory within the polling cycle; The load status is determined based on the ratio of the working duration to the polling cycle duration.

5. The frequency control method of memory according to claim 1, wherein, Determining the desired frequency of the memory based on the load state includes: Obtain the load status parameters of the load status; If the load state parameter is less than the first load state parameter threshold, the fourth frequency is used as the desired frequency. If the load state parameter is greater than the second load state parameter threshold, the fifth frequency is used as the desired frequency; If the load state parameter is greater than or equal to the first load state parameter threshold and less than or equal to the second load state parameter threshold, the sixth frequency shall be used as the desired frequency. Wherein, the first load state parameter threshold is less than the second load state parameter threshold; the fourth frequency is determined based on the current frequency of the memory, the load state parameter, the first load state parameter threshold, and the second load state parameter threshold; the fifth frequency is the highest operating frequency of the memory; and the sixth frequency is the current frequency.

6. The frequency control method of memory according to claim 3, wherein, Adjusting the frequency of the memory based on the desired frequency, the number of requests from the foreground, and the predicted scenario includes: If the number of requests in the foreground is zero and the scene state parameter is less than the first scene state parameter threshold, control the memory to run at the desired frequency; If the number of requests in the foreground is not zero, or if the scene state parameter is greater than or equal to the first scene state parameter threshold, the memory is controlled to maintain the current frequency.

7. A frequency control apparatus for a memory, characterized by comprising: include: The first determining module is used to determine the prediction scenario based on the number and type of requests in the request queue before the memory is started. The second determining module is used to determine the initial frequency of the memory based on the predicted scenario; The first control module is used to control the memory to start working at the initial frequency; The first adjustment module is used to obtain the load status of the memory when the working duration of the memory meets the polling cycle, and adjust the frequency of the memory according to the load status, wherein the load status reflects the working status and working pressure of the memory in the previous polling cycle. The first adjustment module includes: a third acquisition submodule, used to acquire the load status of the memory when the working duration of the memory meets the polling cycle; a fifth determination submodule, used to determine the expected frequency of the memory based on the load status; a first statistics submodule, used to traverse the requests in the foreground in the request queue and count the number of requests in the foreground; and a first adjustment submodule, used to adjust the frequency of the memory based on the expected frequency, the number of requests in the foreground, and the predicted scenario. The step of determining the desired frequency of the memory based on the load state includes: determining the frequency of the memory based on the load state; after obtaining the frequency, performing a smoothing filter on the frequency by evaluating the current frequency change trend and the previous frequency change trend, and using the filtered frequency as the desired frequency.

8. An electronic device, comprising: It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the memory frequency control method as described in any one of claims 1 to 6.

9. A readable storage medium, characterized by, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the memory frequency control method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • CPU frequency modulation method and system based on optimal feedback time and storage medium

    CN114675738A

  • Dynamic frequency adjustment method for internal memory, and electronic apparatus

    WO2020077508A1

  • Processing apparatus, processing method, and related device

    WO2022141735A1