Memory control method and device, electronic equipment, computer readable medium and product
By determining the minimum memory requirements of the phone and avoiding self-refresh operations in the target area, the problem of increased power consumption caused by memory self-refresh is solved, thus improving the phone's battery life.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
- Filing Date
- 2021-10-08
- Publication Date
- 2026-08-04
AI Technical Summary
Increased power consumption due to self-refreshing of mobile phone memory, especially when the memory capacity is large and some areas are not used, results in wasted power consumption that affects battery life.
By acquiring the status information of the electronic device, the minimum required memory space is determined, and the target area is identified from the memory system. This avoids the self-refresh operation of that area and only performs self-refresh on the area actually in use.
It reduces power consumption waste caused by overall memory self-refresh, thus improving the phone's battery life.
Smart Images

Figure CN115964156B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and more specifically, to a memory control method, apparatus, electronic device, computer-readable medium, and product. Background Technology
[0002] Currently, mobile phones have an increasing number of applications, and the capacity of their Dynamic Random Access Memory (DRAM) is also increasing. However, current mobile phones self-refresh their memory during use, resulting in significant power consumption. Summary of the Invention
[0003] This application proposes a memory control method, apparatus, electronic device, computer-readable medium, and product to improve the above-mentioned deficiencies.
[0004] In a first aspect, embodiments of this application provide a memory control method applied to an electronic device. The method includes: acquiring state information of the electronic device; determining the minimum current memory space requirement of the electronic device based on the state information; determining a target memory region from the memory system of the electronic device based on the minimum current memory space requirement; and not responding to the self-refresh operation of the target memory region.
[0005] Secondly, embodiments of this application also provide a memory control device applied to an electronic device. The device includes: an acquisition unit, a first determination unit, a second determination unit, and an execution unit. The acquisition unit is used to acquire state information of the electronic device; the first determination unit is used to determine the minimum current memory space requirement of the electronic device based on the state information of the electronic device; the second determination unit is used to determine a target memory region from the memory system of the electronic device based on the minimum current memory space requirement of the electronic device; and the execution unit is used to not respond to the self-refresh operation of the target memory region.
[0006] Thirdly, embodiments of this application also provide an electronic device, including: one or more processors; a memory; an application framework layer; and one or more application programs, wherein the application framework layer is stored in the memory, and the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more application programs are configured to perform the above-described method.
[0007] Fourthly, embodiments of this application also provide a computer-readable medium storing processor-executable program code, which, when executed by the processor, causes the processor to perform the above-described method.
[0008] Fifthly, embodiments of this application also provide a computer program product, including a computer program / instructions, characterized in that the computer program / instructions, when executed by a processor, implement the above-described method steps.
[0009] The memory control method, apparatus, electronic device, computer-readable medium, and product provided in this application determine the minimum current memory space requirement of the electronic device based on the device's state information, and then determine a target memory region within the electronic device's memory system, preventing the memory in the target memory region from responding to self-refresh. Therefore, the memory in the target region does not respond to self-refresh, avoiding the power consumption waste caused by overall memory self-refresh.
[0010] Other features and advantages of the embodiments of this application will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the embodiments of this application. The objects and other advantages of the embodiments of this application may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings. Attached Figure Description
[0011] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 A system framework diagram of a memory control method provided in an embodiment of this application is shown;
[0013] Figure 2 A schematic diagram of memory segmentation provided in an embodiment of this application is shown;
[0014] Figure 3 A flowchart of a memory control method provided in an embodiment of this application is shown;
[0015] Figure 4 A flowchart of a memory control method according to another embodiment of this application is shown;
[0016] Figure 5 A schematic diagram of memory migration provided in yet another embodiment of this application is shown;
[0017] Figure 6 A schematic diagram of memory migration provided in another embodiment of this application is shown;
[0018] Figure 7 A flowchart of a memory control method provided in another embodiment of this application is shown;
[0019] Figure 8 A flowchart of a memory control method according to another embodiment of this application is shown;
[0020] Figure 9 A supplementary flowchart of a memory control method provided in another embodiment of this application is shown;
[0021] Figure 10 A flowchart of a memory control method provided in another embodiment of this application is shown;
[0022] Figure 11 A framework diagram of a memory control method provided in another embodiment of this application is shown;
[0023] Figure 12 This paper shows a framework diagram of the application framework layer of the memory control method provided in another embodiment of the present application;
[0024] Figure 13 A block diagram of a memory control device provided in one embodiment of this application is shown;
[0025] Figure 14 A schematic diagram of an electronic device provided according to an embodiment of this application is shown;
[0026] Figure 15 This invention illustrates a structural block diagram of a computer-readable storage medium provided in an embodiment of the present application;
[0027] Figure 16 A structural block diagram of a computer program product provided in an embodiment of this application is shown. Detailed Implementation
[0028] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, and not all of them. The components of the embodiments of the present application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of the present application. All other embodiments obtained by those skilled in the art based on the embodiments of the present application without inventive effort are within the scope of protection of the present application.
[0029] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this application, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0030] With the development of the communications industry and the mobile internet environment, mobile phones are taking on more responsibilities in work and life. The application scenarios for mobile phones are increasing, and users' expectations for battery life and performance are also rising, leading to more and more applications being installed on their phones. Correspondingly, the capacity of mobile phone memory (Dynamic Random Access Memory, DRAM) is also increasing. Currently used memory self-refresh technology, however, sees increased power consumption due to the increased memory capacity.
[0031] Specifically, DRAM uses the amount of charge stored in a capacitor to represent whether a binary bit is 1 or 0. Due to leakage current in transistors, the amount of charge stored in the capacitor may not be sufficient to correctly identify the data, leading to data corruption. Therefore, DRAM requires periodic charging to maintain the capacitor's charge level; this method is called DRAM self-refresh.
[0032] However, the inventors discovered during their research that for some light mobile phone users, the number of Android application packages (APKs) installed on their phones may be relatively small. In this case, a portion of the memory is always unused during phone use. For example, on a phone with 12GB of RAM, only 4GB is typically used, while the other 8GB remains idle. However, during this period of use, the entire 12GB of DRAM is self-refreshed. Therefore, the power consumption of this self-refresh is the same as the power consumption of the entire DRAM, which increases the phone's power consumption during use and affects the user's battery life. (Note: 1GB = 10...) 3 MB = 10 6 KB=10 9 B, 1B = 8b, B is Byte, b is bit.
[0033] Therefore, in order to overcome the above-mentioned defects, embodiments of this application provide a memory control method, apparatus, electronic device, computer-readable medium, and product, which reduces memory self-refresh power consumption by making the target memory region not respond to self-refresh operations.
[0034] Please see Figure 1 , Figure 1This application illustrates a memory control system provided in an embodiment of the present application. The system is applied to an electronic device 100, which may be a smartphone, tablet computer, laptop computer, in-vehicle computer, or similar device. The electronic device 100 may include an application framework layer 110, a kernel layer 120, and memory 130. The application framework layer 110 and the kernel layer 120 are connected, and the kernel layer 120 is connected to both the application framework layer 110 and the memory 130.
[0035] In some embodiments, the application framework layer 120 can acquire the status information of the electronic device 100 and make a comprehensive judgment, and issue instructions that require operation on the memory 130 to the core layer 120 for execution. After receiving the instructions, the core layer 120 performs corresponding operations on the memory. Detailed steps can be found in subsequent embodiments.
[0036] The memory 130 can be Dynamic Random Access Memory (DRAM). In some embodiments, the memory 130 can be Single Data Rate Synchronous Dynamic Random Access Memory (SDRAM) or Double Data Rate Synchronous Dynamic Random Access Memory (DDR SDRAM). DDR memory 130 has evolved to the fifth generation, DDR5, which features lower voltage, larger chip capacity, and higher input / output speeds. Furthermore, to increase the bandwidth of the memory 130 and improve the read speed of the electronic device, a memory controller can be added. For example, two independently operating memory controllers can be used, each controlling one memory channel. Alternatively, there can be four independent memory controllers, allowing simultaneous control of four memory channels. In the embodiments of this application, the electronic device can use Double Data Rate Synchronous Dynamic Random Access Memory (DDR) 130, and two memory controllers can be used to control the memory 130.
[0037] In some implementations, the memory 130 of the electronic device 100 can have different sizes, such as 2GB, 4GB, 8GB, 16GB, etc. It is easy to understand that the memory 130 needs to be segmented to facilitate control and scheduling. Furthermore, a memory channel corresponding to a memory controller can typically be divided into eight segments, each of which can be independently controlled for self-refresh. It is easy to understand that if the memory 130 supports segmented individual control, different parts of the memory 130 can be operated independently.
[0038] Please see Figure 2 For example, in this embodiment, the electronic device 100 can use Double Data Rate (DMR) synchronous dynamic random access memory (DDR) as memory 130. The electronic device 100 can have two DDR memory controllers, which can independently control two channels of DDR memory 130, including memory channel 0 and memory channel 1. Each channel of DDR memory 130 can be divided into eight segments, including segment 0, segment 1, segment 2, segment 3, segment 4, segment 5, segment 6, segment 7, segment 8, segment 9, segment 10, segment 11, segment 12, segment 13, segment 14, and segment 15. These sixteen segments can be individually self-refreshed.
[0039] Please see Figure 3 , Figure 3 This application illustrates a memory control method provided by an embodiment of the present application, which is applied to an electronic device. As one implementation, the electronic device may include a processor connected to memory, and the processor may be the execution entity of the method. Specifically, the method includes steps S310 to S340.
[0040] S310: Obtain the status information of the electronic device.
[0041] In one implementation, the status information of the electronic device may include memory information, which may include the memory information installed in the electronic device, such as the installed memory size, installed memory type, and installed memory frequency. The electronic device can read the installed memory size, installed memory model, and installed memory frequency through the identification information built into the memory. For example, in this embodiment, the electronic device can directly read that the installed memory size is 12GB, the installed memory type is Low Power Double Data Rate (LPDDR), and the installed memory frequency is 5500Mbps. Here, Mbps stands for megabits per second.
[0042] As another implementation, memory information may also include the amount of memory currently used by the system and the amount of memory remaining in the system. The system can monitor the amount of memory used and the amount of memory remaining in the system in real time through monitoring devices; detailed steps can be found in subsequent embodiments. Memory information may also include the current operating voltage and operating temperature of the memory. Memory typically has built-in operating voltage and operating temperature sensors, and the system can directly read the data from these sensors.
[0043] As another implementation method, the status information of the electronic device may also include usage scenario information and user habit information. Analysis of the usage scenario information and user habit information can predict memory usage, enabling more rational memory scheduling and allocation. Detailed steps can be found in subsequent embodiments.
[0044] S320: Based on the status information of the electronic device, determine the minimum current memory space requirement of the electronic device.
[0045] As one implementation, the minimum memory space requirement of the electronic device can be the memory space currently used by the electronic device. By obtaining the currently used memory space in step S310, the minimum memory space requirement of the electronic device can be easily obtained.
[0046] As another implementation, the minimum memory space requirement of the electronic device can also be determined by comprehensively analyzing the memory space currently used by the electronic device, along with other state information. Specific steps can be found in subsequent embodiments.
[0047] S330: Based on the minimum current memory space requirements of the electronic device, determine the target memory region from within the memory system of the electronic device.
[0048] As one implementation method, the target memory region is denoted as R. D This can be done by subtracting the minimum current memory requirement of the electronic device from the installed memory size. For example, the installed memory size of the electronic device can be easily obtained from the previous step S310, denoted as R. T Furthermore, the minimum memory space requirement R1 of the electronic device can be obtained from the previous step S320, then R... D =R T -R1. For example, in one embodiment, the electronic device has 12GB of installed memory, then R T =12GB, the minimum memory requirement of this electronic device is R1=8GB, so it is easy to derive R D =R T -R1 = 12GB - 8GB = 4GB.
[0049] As another implementation method, the target memory region R is obtained. D A fixed correction parameter M can also be set. This parameter M can reserve a certain amount of memory space for the electronic device based on its current minimum memory space requirement R1, thus increasing the margin. For example, the size of the memory installed in the electronic device can be easily obtained from the previous step S310, denoted as R. TFurthermore, the minimum memory space requirement R1 of the electronic device can be obtained from the previous step S320, then R... D =R T -R1-M. For example, in one embodiment, the electronic device has 12GB of installed memory, then R T =12GB, the current minimum memory requirement of this electronic device is R1=8GB, and the correction parameter M=0.5GB, then it is easy to derive R D =R T -R1-M=12GB-8GB-0.5GB=3.5GB.
[0050] As another implementation method, the target memory region R is obtained. D A variable adjustment parameter M can also be set. This parameter M can reserve a certain amount of memory space for the electronic device based on its current minimum memory space requirement R1, increasing the margin. Furthermore, this adjustment parameter M can be determined based on the minimum memory space requirement R1 of the electronic device. For example, three steps can be set to differentiate the minimum memory space requirement R1 of the electronic device within the installed memory size R. T The proportion of M occupied by the program indicates the number of programs currently running. A larger proportion indicates more programs are running, making it less likely to open new programs, thus allowing for a reduction in the size of M. Conversely, a smaller proportion indicates fewer programs are running, making it more likely to open new programs, thus allowing for an increase in the size of M. Specifically, when... When, we can let M = 1GB, when At that time, we can let M = 0.5GB, when In this case, M can be set to 0GB. For example, in this embodiment, the electronic device has 12GB of installed memory, then R... T =12GB, the current minimum memory requirement of this electronic device is R1=8GB, then At this point, we can set M = 0.5GB, and then it is easy to derive R. D =R T -R1-M=12GB-8GB-0.5GB=3.5GB.
[0051] It is easy to understand that the above method for confirming the target area is only for illustration and is not intended to limit the embodiments of this application.
[0052] S340: Do not respond to the self-refresh operation of the target memory region.
[0053] As one implementation method, memory is typically volatile, meaning it cannot store data after power loss. Because leakage current always exists in memory, this current causes the charge on the memory's capacitors to decrease over time. When the charge level falls below a threshold, the memory cannot correctly read the stored data. To solve this problem, a memory self-refresh method was developed. During memory self-refresh, the original data is first read, the capacitor's voltage level is compared with a reference level, and the binary value of the data (1 or 0) is determined before the original data is written back. If the data is 1 during the write-back process, the capacitor is fully charged, i.e., a charging operation is performed. Memory self-refresh is performed periodically to replenish the charge lost over time.
[0054] The target memory region identified through steps S310 to S330 can be controlled independently. Therefore, when the entire memory undergoes a self-refresh, this target memory region may not be self-refreshed, thereby reducing memory power consumption. For example, in some embodiments, the electronic device has 12GB of installed memory, and the target memory region is 8GB. Conventional self-refresh methods refresh the entire 12GB of memory, resulting in wasted power. However, using the method of this application, the 8GB of target memory region is not self-refreshed, saving power.
[0055] The memory control method, apparatus, electronic device, computer-readable medium, and product provided in this application determine the minimum current memory space requirement of the electronic device based on the device's state information, and then determine a target memory region within the electronic device's memory system, preventing the memory in the target memory region from responding to self-refresh. Therefore, the memory in the target region does not respond to self-refresh, avoiding the power consumption waste caused by overall memory self-refresh.
[0056] Please see Figure 4 , Figure 4 This application illustrates a memory control method provided by an embodiment of the present application, which is applied to an electronic device. As one implementation, the electronic device may include a processor connected to memory, and the processor may be the execution entity of the method. Specifically, the method includes steps S410 to S440.
[0057] S410: Obtain the status information of the electronic device.
[0058] S420: Based on the status information of the electronic device, determine the minimum current memory space requirement of the electronic device.
[0059] S430: Based on the minimum current memory space requirements of the electronic device, determine the target memory region from within the memory system of the electronic device.
[0060] Steps S410 to S430 have been described in detail in the foregoing embodiments and will not be repeated here.
[0061] S440: Perform a hot-plug operation on the target memory region, wherein the hot-plugged memory region does not self-refresh.
[0062] In some embodiments, hot-swapping of memory can be divided into hot-swapping of physical memory and hot-swapping of logical memory. Both types of hot-swapping refer to increasing or decreasing the memory resources available to the system while the system is running. Specifically, hot-swapping of physical memory refers to connecting or removing the physical memory module from the circuit board, while hot-swapping of logical memory refers to adding or removing memory from the running system to allow more or less memory to participate in system operation. In one embodiment of this application, the electronic device employs hot-swapping of logical memory.
[0063] For further details, please refer to the following: Figure 5 and Figure 6 As can be seen from the foregoing embodiments, memory can be divided into multiple segments, and data is not distributed sequentially within these segments. For example, ... Figure 5 As shown, in some embodiments, the electronic device has two channels of memory, each channel with 8 segments, for a total of 16 segments, numbered from segment 0 to segment 15 from left to right. If the electronic device is currently using 9GB of memory, it can occupy as follows: Figure 5 The diagram shows segments 0, 1, 3, 5, 7, 9, 10, 12, and 15. Because hot-swapping memory will result in the loss of data stored in these segments, if hot-swapping of consecutive memory segments is required, some memory segments containing data must first be migrated. The migrated segments will occupy memory from 7 to 15. Then, the memory corresponding to the free segments 0 to 6 can be hot-swapped.
[0064] Furthermore, such as Figure 6 As shown, memory can be divided into a removable area and a storage area. Data in memory segments within the removable area can be migrated to the storage area for storage. The storage area is used to store the data migrated from the removable area. Because hot-plugging will cause the loss of this segment data, the memory in the removable area needs to be migrated to the normal area before hot-plugging, and then the memory in the free area after migration is hot-plugged. For example, as... Figure 6As shown, in one embodiment of this application, the movable area includes segments 0, 1, 2, 3, 4, 5, 6, and 7, while the normal area includes segments 8, 9, 10, 11, 12, 13, 14, and 15. Segments 6 and 7 can be migrated to the normal area, and then the migrated free memory can be hot-swapped.
[0065] The memory control method, apparatus, electronic device, computer-readable medium, and product provided in this application determine the minimum current memory space requirement of the electronic device based on the device's state information, and then determine a target memory region within the electronic device's memory system, preventing the memory in the target memory region from responding to self-refresh. Therefore, the memory in the target region does not respond to self-refresh, avoiding the power consumption waste caused by overall memory self-refresh.
[0066] Please see Figure 7 , Figure 7 This application illustrates a memory control method provided by an embodiment of the present application, which is applied to an electronic device. As one implementation, the electronic device may include a processor connected to memory, and the processor may be the execution entity of the method. Specifically, the method includes steps S710 to S740.
[0067] Step S710: Obtain the memory space currently used by the electronic device.
[0068] In some implementations, the currently used memory space can be viewed directly through the running system. This can be done by entering code or by using an application to directly read the used memory space through the application's interface.
[0069] In other implementations, the current memory space used by the electronic device can be calculated by examining the remaining memory space and the installed memory space. Specifically, the installed memory space can be set to R. T The remaining memory space is R. R The installed memory space can be viewed by running the system as R. T The remaining memory space is R. R Then, the used memory space R can be calculated using simple methods. U =R T -R R For example, in one embodiment of this application, the installed memory space R is determined by checking the running system. T =16GB, remaining memory space R R =8GB, then it is easy to derive R U =RT -R R =16GB-8GB=8GB.
[0070] Step S720: Use the currently used memory space as the minimum requirement for the memory space.
[0071] In some implementations, after obtaining the memory space currently used by the electronic device, this currently used memory space can be directly used as the minimum memory requirement. For example, let the minimum memory requirement be R1, and the currently used memory space be R... U After obtaining R through the aforementioned step S710 U Then, directly set R1 = R U Specifically, if R is obtained... U =8GB, then it is easy to calculate R1=R U =8GB.
[0072] Step S730: Based on the minimum current memory space requirement of the electronic device, determine the target memory region from the memory system of the electronic device.
[0073] Step S740: Do not respond to the self-refresh operation of the target memory region.
[0074] Steps S730 to S740 have been described in detail in the foregoing embodiments and will not be repeated here.
[0075] The memory control method, apparatus, electronic device, computer-readable medium, and product provided in this application determine the minimum current memory space requirement of the electronic device based on the device's state information, and then determine a target memory region within the electronic device's memory system, preventing the memory in the target memory region from responding to self-refresh. Therefore, the memory in the target region does not respond to self-refresh, avoiding the power consumption waste caused by overall memory self-refresh.
[0076] Please see Figure 8 , Figure 8 This application illustrates a memory control method provided by an embodiment of the present application, which is applied to an electronic device. As one implementation, the electronic device may include a processor connected to memory, and the processor may be the execution entity of the method. Specifically, the method includes steps S810 to S850.
[0077] Step S810: Obtain the currently used memory space, usage scenario information, and user habit information of the electronic device.
[0078] The current memory space and acquisition method of the electronic device have been described in detail in the above embodiments, and will not be repeated here.
[0079] In some embodiments, obtaining usage scenario information for the electronic device may include obtaining information about the currently running application in the foreground. As one implementation, the currently running application can be obtained through the running system.
[0080] In other embodiments, obtaining the usage scenario information of the electronic device may also include obtaining information about currently running background applications. It is easy to understand that background applications also occupy memory space, so it is necessary to obtain information about them. As one implementation, the currently running background applications can be obtained through the running system. As another implementation, a first time period t1 can be set, and applications that have run from the current time to t1 and have not been closed or are not running in the foreground can be detected as currently running background applications. For example, if the time period t1 is set to 5 minutes, and applications 1, 2, 3, and 4 have been detected running from the current time to t1, where application 1 has been closed and application 2 is currently running in the foreground, then the currently running background applications can be determined to be applications 3 and 4.
[0081] In some embodiments, obtaining user habit information for the electronic device can involve acquiring historical usage data of various applications. As one implementation, a second time period t2 can be set, and the total usage time of all applications within this second time period t can be calculated. These applications can then be sorted from highest to lowest usage time. For example, the second time period t2 can be set to 24 hours, and the applications used within 24 hours can be identified as Application 1, Application 2, Application 3, Application 4, and Application 5. Application 1 was used for 1 hour, Application 2 for 2 hours, Application 3 for 0.5 hours, Application 4 for 3 hours, and Application 5 for 4 hours, with the remaining time being standby time. Sorting these five applications by usage time from highest to lowest, since 4 hours is greater than 3 hours, greater than 2 hours, greater than 1 hour, and greater than 0.5 hours, the user habit information for the electronic device is: Application 5, Application 4, Application 2, Application 1, and Application 3.
[0082] In other embodiments, the application sorting obtained at the current second time t2 can be used to replace the application sorting obtained at the previous second time t2. For example, if the application sorting obtained at the previous second time t2 is application 5, application 4, application 2, application 1, and application 3, and the application sorting obtained at the current time t2 using the aforementioned method is application 4, application 5, application 2, application 1, and application 3, then the application sorting obtained at the current second time t2 can be used to replace the application sorting obtained at the previous second time t2. The final user habit information obtained for the electronic device will be application 4, application 5, application 2, application 1, and application 3.
[0083] In some embodiments, the application usage time obtained at the current second time t2 can be superimposed with the application usage time obtained at the previous second time t2, and then the new application usage time can be sorted to obtain the application sorting information corresponding to the current second time t2. For example, the second time t2 can be set to 24 hours. In the previous second time t2, all used applications are application 1, application 2, application 3, application 4, and application 5. Among them, application 1 used for 1 hour, application 2 used for 2 hours, application 3 used for 0.5 hours, application 4 used for 3 hours, application 5 used for 4 hours, and the remaining time is standby time. In the current second time t2, all used applications are application 1, application 2, application 3, and application 6. Among them, application 1 used for 1 hour, application 2 used for 2 hours, application 3 used for 0.5 hours, application 6 used for 1 hour, and the remaining time is standby time. Adding the application usage time obtained at the current second time t2 to the application usage time obtained at the previous second time t2, we can get the following information: application 1 used for 2 hours, application 2 used for 4 hours, application 3 used for 1 hour, application 4 used for 3 hours, application 5 used for 4 hours, and application 6 used for 1 hour. Therefore, the final user habit information obtained for this electronic device is: application 2, application 5, application 4, application 1, application 3, and application 6.
[0084] Step S820: Based on usage scenario information and user habit information, obtain the predicted memory space requirement.
[0085] Step S810 allows the acquisition of usage scenario information and user habit information for the electronic device. For further details, please refer to... Figure 9 Based on usage scenario information and user habit information, the predicted memory space requirement can be obtained, which can be further divided into steps S821 to S823.
[0086] Step S821: Predict the probability that each application will be run within a specified time period.
[0087] Step S822: Use applications with a probability greater than a specified value as the application for prediction.
[0088] In some implementations, based on the user habit information obtained in step S810, a certain number of applications can be specified. These applications, sorted from highest to lowest based on user information from these electronic devices, are assigned different probability values. These probability values are compared with a specified value, and the application with a probability value greater than the specified value is selected as the predicted application. For example, a certain number of applications (3) can be specified, assigned probability values of 90%, 70%, and 50% respectively from highest to lowest. If the obtained user habit information is application 2, application 5, application 4, application 1, application 3, and application 6, then application 2 is assigned a 90% probability value, application 5 a 70% probability value, and application 4 a 50% probability value. In this case, the specified value can be set to 40%, because 90% is greater than 40%, so application 2 can be selected as the predicted application; because 70% is greater than 40%, application 5 can be selected as the predicted application; and because 50% is greater than 40%, application 4 can be selected as the predicted application.
[0089] In other implementations, the user habit information obtained in step S810 can be updated for each different user habit information. For example, a certain number of applications ranked from high to low can be increased with a certain probability, while applications ranked lower can be decreased with a certain probability. For example, in this embodiment, the top three applications can be increased with a probability of 10%, 5%, and 3% respectively, the fourth and fifth applications can be decreased with a probability of 1% and 3% respectively, and applications ranked after fifth can be decreased with a probability of 5%, decreasing to 0% and then ceasing further decrease. If the previously obtained user habit information is application 2, application 5, application 4, application 1, application 3, and application 6, then the probability of application 2 is 10%, the probability of application 5 is 5%, the probability of application 4 is 3%, the probability of application 1 is 0%, the probability of application 3 is 0%, and the probability of application 6 is 0. The currently obtained user habit information includes applications 4, 5, 2, 1, and 3. The probabilities of application 2, 5, and 4 are 13%, 1, 3, and 6 respectively. We can then set a specified value of 10%. Since 13% is greater than 10%, applications 2 and 4 can both be considered as predicted applications. Since 10% is equal to 10%, and 0 is less than 10%, none of the other applications can be considered as predicted applications.
[0090] Step S823: Based on the prediction application, obtain the prediction memory space requirement for running the prediction application.
[0091] In some implementations, the predicted memory space requirement for running the predicted application can be obtained based on the predicted application obtained in step S822. Furthermore, before obtaining the predicted memory space requirement for running the predicted application, the memory space size corresponding to different applications can also be obtained. In some implementations, the memory space size corresponding to each application of the electronic device can be obtained. In other implementations, the memory space size corresponding to each application used as a predicted application can be obtained.
[0092] Furthermore, in some implementations, the memory space size corresponding to the obtained application can be directly used as the predicted memory space requirement for running the predicted application.
[0093] In other implementations, the obtained memory space size corresponding to the application can be weighted using an application-weighted algorithm. For example, application 1 can be used as a predicted usage application with a probability of 50%. If application 1 occupies 4GB of memory, then 4GB x 50% = 2GB, and 2GB is the predicted memory space requirement for running the predicted usage application.
[0094] Furthermore, if multiple applications can be used as predicted usage applications, the memory usage of these applications can be summed to obtain the predicted memory space requirement for running the predicted usage application. For example, in some embodiments, applications 1, 2, and 3 can all be used as predicted usage applications, where application 1 has a memory usage of 1GB, application 2 has a memory usage of 0.5GB, and application 3 has a memory usage of 1GB. Then, the predicted memory space requirement for the electronic device to run the predicted usage application is 1GB + 0.5GB + 1GB = 2.5GB.
[0095] Step S830: Based on the predicted memory space requirement and the currently used memory space, determine the minimum memory space requirement.
[0096] The above steps determine the predicted memory space requirement and the currently used memory space. In some implementations, the sum of the predicted memory space requirement and the currently used memory space can be used as the minimum memory space requirement. For example, if the predicted memory space requirement is 4GB and the currently used memory space is 4GB, then the minimum memory space requirement is easily obtained as 4GB + 4GB = 8GB.
[0097] In other implementations, a fixed margin parameter N can be set, which can adjust the sum of the predicted memory space requirement and the currently used memory space. For example, a fixed margin parameter N = 0.5GB can be set. If the predicted memory space requirement is determined to be 4GB and the currently used memory space is 4GB, then the minimum memory space requirement can be easily obtained as 4GB + 4GB + N = 8.5GB.
[0098] Step S840: Based on the minimum current memory space requirement of the electronic device, determine the target memory region from the memory system of the electronic device.
[0099] Step S850: Do not respond to the self-refresh operation of the target memory region.
[0100] Steps S840 and S850 have been described in detail in the foregoing embodiments and will not be repeated here.
[0101] The memory control method, apparatus, electronic device, computer-readable medium, and product provided in this application determine the minimum current memory space requirement of the electronic device based on the device's state information, and then determine a target memory region within the electronic device's memory system, preventing the memory in the target memory region from responding to self-refresh. Therefore, the memory in the target region does not respond to self-refresh, avoiding the power consumption waste caused by overall memory self-refresh.
[0102] Please see Figure 10 , Figure 10 This application illustrates a memory control method provided by an embodiment of the present application, which is applied to an electronic device. As one implementation, the electronic device may include a processor connected to memory, and the processor may be the execution entity of the method. Specifically, the method includes steps S1010 to S1070.
[0103] Step S1010: Obtain the status information of the electronic device.
[0104] Step S1020: Based on the status information of the electronic device, determine the minimum current memory space requirement of the electronic device.
[0105] Step S1030: Based on the minimum current memory space requirement of the electronic device, determine the target memory region from the memory system of the electronic device.
[0106] Step S1040: Perform a hot-plug operation on the target memory region, wherein the hot-plugged memory region will not self-refresh.
[0107] Steps S1010 to S1040 have been described in detail in the foregoing embodiments and will not be repeated here.
[0108] Step S1050: Detect the performance information of the electronic device.
[0109] Detecting the performance information of the electronic device mainly involves real-time monitoring of its performance. In some implementations, this performance information can be memory access latency information. Memory access latency refers to the delay caused by waiting for access to data stored in system memory to complete, and this latency information can be obtained by retrieving it from the running system. In some implementations, the memory access latency increases slowly as the currently used memory space accounts for a percentage of the available system memory; however, when this percentage exceeds a certain threshold, the memory access latency of the electronic device increases rapidly. For example, the threshold could be 0.875. If the available memory of the electronic device system is currently 8GB, and the currently used memory space slowly increases from 4GB to 7GB, the memory access latency can increase by 1% for every 0.5GB increase in the currently used memory space. This original base could be the memory access latency when the currently used memory space is 4GB. However, when the currently used memory space increases from 7GB to 7.5GB, since 7GB / 8GB = 0.875, the memory access latency will increase by 80% as the proportion of the currently used memory space to the available system memory exceeds the threshold.
[0110] In other implementations, this performance information can also be process scheduling information. The processes running on the electronic device are stored in memory; by using process scheduling information, the memory size occupied by each process can be obtained, allowing for flexible adjustment of the system's memory size.
[0111] Step S1060: If the performance information does not meet the preset conditions, then determine the calibration memory region from the target memory region.
[0112] In some implementations, this preset condition can be a memory access latency of less than a specified value. For example, if the memory access latency is less than 1 millisecond, then when the memory access latency of the electronic device is greater than or equal to 1 millisecond, a calibration memory region will be determined from the target memory region.
[0113] In other implementations, the preset condition can also be the percentage of system memory occupied by the process, for example, 80%. If the electronic device has 10GB of system memory, and the process scheduling information shows that the memory occupied by the process is 9GB, then 9GB / 10GB is greater than 80%, so it is necessary to determine the calibration memory region from the target memory region.
[0114] Furthermore, the calibration memory region can be a certain proportion of the target memory region, for example, 50%. In some implementations, if the target memory region is 4GB, it is easy to obtain that the calibration memory region is 4GB x 50% = 2GB.
[0115] Step S1070: Wake up the calibration memory region.
[0116] In some implementations, the wake-up process involves controlling the calibration memory region obtained from the aforementioned steps to come back online and add it to the memory space of the running system.
[0117] Please refer to the following: Figure 11 and Figure 12 , Figure 11 This diagram illustrates a framework diagram of a memory control method provided in an embodiment of this application. Figure 12 The diagram shows a framework layer of the application framework in a memory control method provided in an embodiment of this application.
[0118] like Figure 11 As shown, in some implementations, this memory control method can be applied to the application framework layer 1110, the core layer 1120, the memory control firmware 1130, and the memory channel 1140. The application framework layer 1110 is connected to the core layer 1120, the core layer 1120 is connected to both the application framework layer 1110 and the memory control firmware 1130, and the memory control firmware 1130 is connected to both the core layer 1120 and the memory channel 1140. Further, the application framework layer 1110 acquires the status information of the electronic device, determines the minimum current memory space requirement of the electronic device based on the status information, determines a target memory region within the memory system of the electronic device based on the minimum current memory space requirement, and notifies the core layer 1120 of the target memory region. The core layer 1120 performs step S1121 to migrate the memory in the target memory region, and then performs the hot-plugging step S1123 offline operation. The application framework layer 1110 is also used to detect the performance information of the electronic device; if the performance information does not meet preset conditions, a calibration memory region is determined from the target memory region; and the calibration memory region is notified to the core layer 1120. The core layer 1120 issues a step S1122 online command to the memory of the calibration memory region, and then performs step S1124 to expand the available memory. The core layer 1120 is also used to connect with the memory control firmware 1130 and report the memory status to the memory control firmware 1130. After receiving the memory status, the memory control firmware 1130 drives the memory channel 1140 to operate normally.
[0119] like Figure 12As shown, in some implementations, the application framework layer may include a currently used memory space module 1210, a usage scenario information module 1220, a user habit information module 1230, an arbitration module 1240, a performance information module 1250, and a command issuance module 1260. The arbitration module 1240 is connected to the currently used memory space module 1210, the usage scenario information module 1220, the user habit information module 1230, the performance information module 1250, and the command issuance module 1260, respectively. The arbitration module 1240 receives information from the currently used memory space module 1210, the usage scenario information module 1220, the user habit information module 1230, and the performance information module 1250, makes a comprehensive judgment, and sends the command to the command issuance module 1260 for command issuance.
[0120] Please see Figure 13 The diagram shows a structural block diagram of a memory control device 1300 provided in an embodiment of this application. The device may include: an acquisition unit 1310, a first determination unit 1320, a second determination unit 1330, and an execution unit 1340.
[0121] The acquisition unit 1310 is used to acquire the status information of the electronic device.
[0122] The first determining unit 1320 is used to determine the minimum current memory space requirement of the electronic device based on the status information of the electronic device.
[0123] The second determining unit 1330 is used to determine a target memory region from the memory system of the electronic device based on the minimum current memory space requirement of the electronic device.
[0124] The execution unit 1340 is configured not to respond to the self-refresh operation of the target memory region.
[0125] Furthermore, the execution unit 1340 is also used to perform a hot-plug operation on the target memory region, wherein the hot-plugged memory region does not self-refresh.
[0126] Furthermore, the first determining unit 1320 is also used to take the currently used memory space as the minimum requirement for the memory space.
[0127] Furthermore, the first determining unit 1320 is also used to obtain the predicted memory space requirement based on usage scenario information and user habit information; and to determine the minimum requirement of the memory space based on the predicted memory space requirement and the currently used memory space.
[0128] Furthermore, the first determining unit 1320 is also used to predict the probability of each application being run within a specified time period when the user is currently running applications in the foreground and background, by combining the usage scenario information and the user habit information; to identify applications with a probability greater than a specified value as predicted usage applications; and to obtain the predicted memory space requirement for running the predicted usage applications based on the predicted usage applications.
[0129] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described device and module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0130] In the several embodiments provided in this application, the coupling between modules can be electrical, mechanical, or other forms of coupling.
[0131] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.
[0132] Please refer to Figure 14 This document illustrates a structural block diagram of an electronic device according to an embodiment of this application. The electronic device 1400 can be a smartphone, tablet computer, e-reader, or other electronic device capable of running applications. The electronic device 1400 in this application may include one or more of the following components: a processor 1410, a memory 1420, and an application framework layer. The application framework layer may be stored in the memory 1420 and configured to be executed by one or more processors 1410. The application framework layer is configured to execute the methods described in the foregoing method embodiments.
[0133] Processor 1410 may include one or more processing cores. Processor 1410 connects to various parts within the electronic device 1400 using various interfaces and lines, and performs various functions and processes data of electronic device 100 by running or executing instructions, programs, code sets, or instruction sets stored in memory 1420, and by calling data stored in memory 1420. Optionally, processor 1410 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). Processor 1410 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the modem may also not be integrated into processor 1410 and may be implemented separately using a communication chip.
[0134] The memory 1420 may include random access memory (RAM) or read-only memory (ROM). The memory 1420 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 1420 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), and instructions for implementing the various method embodiments described below. The data storage area may also store data created by the terminal 1400 during use (such as phonebook data, audio and video data, chat log data, etc.).
[0135] Please refer to Figure 15 This diagram illustrates a structural block diagram of a computer-readable storage medium provided in an embodiment of this application. The computer-readable medium 1500 stores program code that can be called by a processor to execute the methods described in the above method embodiments.
[0136] The computer-readable storage medium 1500 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 1500 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 1500 has storage space for program code 1510 that performs any of the method steps described above. This program code can be read from or written to one or more computer program products. The program code 1510 may, for example, be compressed in a suitable form.
[0137] Please refer to Figure 16 The diagram illustrates a structural block diagram 1600 of a computer program product provided in an embodiment of this application. The computer program product 1600 includes a computer program / instructions 1610, which, when executed by a processor, implements the steps of the aforementioned method.
[0138] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A memory control method characterized by, Applied to electronic devices, the method includes: Obtain the status information of the electronic device, wherein the status information includes the memory space currently used by the electronic device, usage scenario information and user habit information, the usage scenario information is the applications currently running in the foreground and background, and the user habit information is the user's historical usage data for each application; Based on the usage scenario information and the user habit information, predict the probability that each application will be run within a specified time period, given that the user is currently running applications in the foreground and background. Applications with a probability greater than a specified value are used for prediction. Based on the predicted application, obtain the predicted memory space requirement for running the predicted application; Based on the predicted memory space requirements and the currently used memory space, determine the minimum memory space requirements; Based on the current minimum memory space requirements of the electronic device, a target memory region is determined from within the memory system of the electronic device; The self-refresh operation of the target memory region is not responded to.
2. The method of claim 1, wherein, The non-response to the self-refresh operation of the target memory region includes: A hot-plug operation is performed on the target memory region, wherein the hot-plugged memory region does not self-refresh.
3. The method of claim 1, wherein, After the statement that the self-refresh operation of the target memory region is not responded to, the following is also included: Detect the performance information of the electronic device; If the performance information does not meet the preset conditions, then a calibration memory region is determined from the target memory region; Respond to the self-refresh of the calibration memory region.
4. The method according to claim 3, characterized in that: The non-response to the self-refresh operation of the target memory region includes: A hot-plug operation is performed on the target memory region, wherein the hot-plugged memory region does not refresh itself; Responding to the automatic refresh of the calibration memory region includes: waking up the calibration memory region.
5. A memory control device, comprising: Applied to electronic devices, the device includes: The acquisition unit is used to acquire the status information of the electronic device, wherein the status information includes the memory space currently used by the electronic device, usage scenario information and user habit information, the usage scenario information is the applications currently running in the foreground and background, and the user habit information is the user's historical usage data for each application; The first determining unit is configured to combine the usage scenario information and the user habit information to predict the probability of each application being run within a specified time period, given that the user is currently running applications in the foreground and background; to designate applications with a probability greater than a specified value as predicted usage applications; to obtain the predicted memory space requirement for running the predicted usage applications based on the predicted usage applications; and to determine the minimum memory space requirement based on the predicted memory space requirement and the currently used memory space. The second determining unit is used to determine a target memory region from the memory system of the electronic device based on the minimum current memory space requirement of the electronic device. An execution unit is configured not to respond to the self-refresh operation of the target memory region.
6. An electronic device, comprising: include: One or more processors; Memory; Application framework layer; One or more applications, wherein an application framework layer is stored in the memory, the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications being configured to perform the method as described in any one of claims 1-4.
7. A computer readable storage medium characterized in that, The computer-readable storage medium stores program code that can be invoked by a processor to execute the method as described in any one of claims 1-4.
8. A computer program product comprising computer programs / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the method described in any one of claims 1-4.