Cache allocation method and apparatus, and electronic device

By dynamically evaluating and managing the attribute information of candidate memory buffers, efficient cache allocation of system-level caches in electronic devices is achieved, solving the problem of low cache hit rate, and improving cache utilization efficiency and system performance.

WO2024198435A1PCT designated stage expired Publication Date: 2024-10-03SMARTER SILICON (SHANGHAI) TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2023/134622
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-03-24
Filing Date
2023-11-28
Publication Date
2024-10-03

AI Technical Summary

Technical Problem

The ping-pong effect of system-level caches in existing electronic devices results in low cache hit rates, which increases system latency and power consumption. Moreover, the existing OCM mode cannot effectively improve the cache hit rate when frequent usage scenarios change.

Method used

By dynamically evaluating the attribute information of candidate memory buffers, including usage frequency, update frequency and format, determining refresh parameters, and dynamically locking and releasing the cache area in the system-level cache area, the cache allocation method is implemented to improve the cache hit rate.

Benefits of technology

It effectively avoids the ping-pong effect of cache, improves the access hit rate of system-level cache, dynamically adapts to different usage scenarios, and maximizes the use of system-level cache resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023134622_03102024_PF_FP_ABST
    Figure CN2023134622_03102024_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in the embodiments of the present application are a cache allocation method and apparatus, and an electronic device. The cache allocation method comprises: determining a plurality of candidate memory buffer areas; determining a candidate memory buffer area, attribute information of which meets a preset requirement, among the plurality of candidate memory buffer areas to be a target memory buffer area, wherein the attribute information is related to a use frequency of the corresponding candidate memory buffer area; and locking a corresponding cache region in a cache area for the target memory buffer area, so as to cache data in the target memory buffer area.
Need to check novelty before this filing date? Find Prior Art

Description

Cache allocation method and device, and electronic equipment

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on March 24, 2023, with application number 202310301544.0 and invention name “Cache allocation method and device, electronic device”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The embodiments of the present application relate to electronic technology, and relate to but are not limited to a cache allocation method and device, and an electronic device. Background Art

[0003] Currently, electronic devices are increasingly used, and various types of storage modules exist in electronic devices, playing an important role in the normal operation of electronic devices. In particular, system-level cache in electronic devices plays an irreplaceable role in electronic devices.

[0004] Summary of the Invention

[0005] In view of this, embodiments of the present application provide a cache allocation method and device, and an electronic device.

[0006] The technical solution of the embodiment of the present application is implemented as follows:

[0007] In a first aspect, an embodiment of the present application provides a cache allocation method, the method comprising:

[0008] determining a plurality of candidate memory buffers;

[0009] Determine a candidate memory buffer whose attribute information meets preset requirements among the multiple candidate memory buffers as a target memory buffer; wherein the attribute information is related to the usage frequency of the corresponding candidate memory buffer;

[0010] A corresponding cache area is locked for the target memory buffer in the cache area to cache data in the target memory buffer.

[0011] In some embodiments, the method further includes: determining a candidate memory buffer in a first state; wherein, the first state corresponds to a candidate memory buffer having a corresponding locked cache area; if the attribute information of the candidate memory buffer in the first state no longer meets the preset requirements, releasing the cache area corresponding to the candidate memory buffer in the first state; correspondingly, determining multiple candidate memory buffers includes: determining multiple candidate memory buffers in a second state; wherein, the second state corresponds to a candidate memory buffer whose corresponding cache area is not locked.

[0012] In some embodiments, the method further includes: determining a screening condition based on the available size of the cache area; and determining a memory buffer area that meets the screening condition as a candidate memory buffer area.

[0013] In some embodiments, the filtering conditions include at least one of the following: the size of the memory buffer is less than or equal to a first preset size, the first preset size is the available size of the cache area; there is an update in the memory buffer; the size of the update area of ​​the memory buffer is greater than or equal to a second preset size; the memory buffer is used to store data to be displayed.

[0014] In some embodiments, determining a candidate memory buffer whose attribute information meets preset requirements among the multiple candidate memory buffers as a target memory buffer includes: determining the refresh parameters of each candidate memory buffer based on the attribute information of each candidate memory buffer among the multiple candidate memory buffers; and determining the candidate memory buffer whose refresh parameters meet the first requirement as the target memory buffer.

[0015] In some embodiments, determining the candidate memory buffer whose refresh parameters meet the first requirement as the target memory buffer includes: sorting the multiple candidate memory buffers according to the refresh parameters to obtain a sorting result; and based on the sorting result, determining the candidate memory buffer whose sorting position meets the second requirement as the target memory buffer.

[0016] In some embodiments, determining the candidate memory buffer whose refresh parameters meet the first requirement as the target memory buffer includes: determining a refresh parameter threshold based on the storage properties of the electronic device; and determining the candidate memory buffer whose refresh parameters are greater than or equal to the refresh parameter threshold as the target memory buffer.

[0017] In some embodiments, the attribute information includes at least: the update frequency of the memory buffer, the size of the update area of ​​the memory buffer, and at least one information of the pixel byte value of the format of the memory buffer; correspondingly, the refresh parameters of each candidate memory buffer are determined based on the attribute information of each candidate memory buffer in the multiple candidate memory buffers, including: the refresh parameters of each candidate memory buffer are determined based on the update frequency of each candidate memory buffer, the size of the update area of ​​each candidate memory buffer, and at least one information of the pixel byte value of the format of each candidate memory buffer.

[0018] In a second aspect, an embodiment of the present application provides a cache allocation device, the device comprising:

[0019] A management module is configured to determine a plurality of candidate memory buffers of the electronic device; and determine a candidate memory buffer whose attribute information meets preset requirements among the plurality of candidate memory buffers as a target memory buffer; wherein the attribute information is related to a usage frequency of the candidate memory buffer;

[0020] The driver module is used to lock a corresponding cache area for the target memory buffer in a system-level cache area of ​​the electronic device to cache data in the target memory buffer.

[0021] In a third aspect, an embodiment of the present application provides an electronic device, comprising:

[0022] Multiple candidate memory buffers;

[0023] Cache area;

[0024] A processor is configured to determine the multiple candidate memory buffers; determine a candidate memory buffer whose attribute information meets preset requirements among the multiple candidate memory buffers as a target memory buffer; wherein the attribute information is related to the usage frequency of the corresponding candidate memory buffer; and lock a corresponding cache area for the target memory buffer in the cache area to cache data in the target memory buffer. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] FIG1 is a schematic diagram of a first implementation flow of a cache allocation method according to an embodiment of the present application;

[0026] FIG2 is a second schematic diagram of the implementation flow of the cache allocation method according to an embodiment of the present application;

[0027] FIG3A is a schematic diagram of the working mode of the OCM mode in the related art;

[0028] FIG3B is a schematic diagram of the working mode of the OCM mode according to an embodiment of the present application;

[0029] FIG4 is a schematic diagram of the structure of a cache allocation device according to an embodiment of the present application;

[0030] FIG5 is a schematic diagram of the structure of an electronic device according to an embodiment of the present application;

[0031] FIG6 is a schematic diagram of a hardware entity of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0032] The technical solution of the present application is further described in detail below with reference to the accompanying drawings and embodiments. It is apparent that the embodiments described are only a portion of the embodiments of the present application, and not all of them. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present application without inventive effort are intended to fall within the scope of protection of the present application.

[0033] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0034] In the subsequent description, suffixes such as "module," "component," or "unit" used to represent elements are only used to facilitate the description of the present application and have no specific meaning. Therefore, "module," "component," or "unit" may be used interchangeably.

[0035] It should be pointed out that the terms "first\second\third" involved in the embodiments of the present application are only used to distinguish similar objects and do not represent a specific order for the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.

[0036] Based on this, an embodiment of the present application provides a method for cache allocation. The functions implemented by this method can be implemented by calling program code by a processor in an electronic device. Of course, the program code can be stored in the storage medium of the electronic device. Figure 1 is a schematic diagram of the implementation flow of the cache allocation method of the embodiment of the present application. As shown in Figure 1, the method includes:

[0037] Step S101, determining multiple candidate memory buffers;

[0038] Here, the electronic device may be various types of devices with information processing capabilities, such as navigators, smart phones, tablet computers, wearable devices, laptop computers, all-in-one computers and desktop computers, server clusters, etc.

[0039] An electronic device may include multiple storage modules, such as cache, memory, external memory, etc. Among them, the memory buffer refers to a memory segment used in the system, which is used to place a complete system resource of the operating system, such as Frame Buffer. The memory can be DDR (Double Data Rate), SDRAM (Synchronous Dynamic Random Access Memory), DRAM (Dynamic Random-Access Memory), etc., and the candidate memory buffer can be a memory segment in DDR or a memory segment in DRAM. In the embodiment of the present application, there are multiple memory buffers, and the memory buffers that meet the preset conditions are used as candidate memory buffers; of course, there are multiple candidate memory buffers. Among them, the preset conditions include but are not limited to: there is no memory buffer whose corresponding cache area is locked.

[0040] Step S102: determining a candidate memory buffer whose attribute information meets a preset requirement among the plurality of candidate memory buffers as a target memory buffer; wherein the attribute information is related to a usage frequency of the corresponding candidate memory buffer;

[0041] In an embodiment of the present application, it is necessary to determine a target memory buffer from a plurality of candidate memory buffers, wherein the determination is based on attribute information of each candidate memory buffer, and the attribute information is related to the usage frequency of the corresponding candidate memory buffer.

[0042] In some embodiments, the attribute information includes but is not limited to: one or more of: the usage frequency of the memory buffer, the size of the update area of ​​the memory buffer, the update frequency of the memory buffer, and the pixel byte value of the format of the memory buffer.

[0043] The frequency of memory buffer usage can be comprehensively evaluated using multiple attribute information. For example, the score of a corresponding candidate memory buffer can be determined by multiplying the frequency of memory buffer usage, the size of the memory buffer's update area, and the pixel byte value of the memory buffer's format. A candidate memory buffer with a score greater than a preset threshold can be determined as a target memory buffer. For another example, the score of a corresponding candidate memory buffer can be determined by summing the frequency of memory buffer usage and the size of the memory buffer's update area. A candidate memory buffer with a score greater than a preset threshold can be determined as a target memory buffer.

[0044] In the embodiment of the present application, there is no restriction on the specific implementation method of the attribute information meeting the preset requirements. As long as the target memory buffer is determined from multiple candidate memory buffers based on the attribute information of the candidate memory buffer, it is within the protection scope of the present application.

[0045] Step S103: Lock a corresponding cache area for the target memory buffer in the cache area to cache the data in the target memory buffer.

[0046] In an embodiment of the present application, after determining the target memory buffer, a corresponding cache area can be locked for the target memory buffer in a cache area (such as a system-level cache SLC) to cache the data in the target memory buffer, so that the processor can directly obtain the corresponding data from the cache area without having to obtain the corresponding data from the main memory, thereby improving the processing efficiency of the processor.

[0047] For example, due to the influence of process and / or power consumption, the system-level cache is much smaller than the main memory (such as DDR). For example, the size of the system-level cache is generally several megabytes or tens of megabytes, while the DDR main memory is generally on the order of several or tens of gigabits. The cache allocation method provided in the embodiment of the present application can dynamically determine which DDR memory segment in the cache area SLC to lock the corresponding cache area based on the attribute information of different DDR memory segments (memory buffers) to cache the data in the DDR memory segment, so that the processor (such as a central processing unit, a graphics processing unit, etc.) can directly and quickly read the data. In other words, the buffer and the cache area belong to two different hardware entities, and locking refers to locking a cache area in the SLC, which is specifically used to store data originally in the target buffer of the DDR.

[0048] Here, through the methods in steps S101 to S103 above, the buffer area to which the cache area needs to be allocated can be dynamically specified and switched, thereby improving the data hit rate in the cache area from the system level (i.e., the probability that the processing unit can obtain the required data directly through the cache without obtaining the required data from the memory).

[0049] Based on the aforementioned embodiment, an embodiment of the present application further provides a cache allocation method, which is applied to an electronic device and includes:

[0050] Step S111: determining a screening condition based on the available size of the buffer area;

[0051] Step S112: determining the memory buffers that meet the screening conditions as candidate memory buffers;

[0052] In an embodiment of the present application, the memory buffers in the unlocked cache area can be filtered, and the memory buffers in the unlocked cache area that meet the filtering conditions can be used as candidate memory buffers. The filtering conditions can be determined based on the available size of the cache area, and the memory buffers that meet the filtering conditions can be determined as candidate memory buffers.

[0053] For example, after determining the available size of the cache area, a memory buffer whose width and height are greater than 720×480 (bytes) and whose overall size is smaller than the available size may be determined as a candidate memory buffer.

[0054] For another example, after determining a memory buffer whose width and height are greater than 720×480 (bytes) and whose overall size is smaller than the available size as an initial candidate memory buffer, multiple initial candidate memory buffers can be screened to obtain a final candidate memory buffer. The screening conditions for the second screening include at least one of the following: the size of the memory buffer is less than or equal to a first preset size, which is the available size of the cache; there is an update in the memory buffer; the size of the update area of ​​the memory buffer is greater than or equal to a second preset size; and the memory buffer is used to store data to be displayed.

[0055] Step S113: determining a candidate memory buffer whose attribute information meets a preset requirement among the plurality of candidate memory buffers as a target memory buffer; wherein the attribute information is related to the usage frequency of the corresponding candidate memory buffer;

[0056] Step S114: Lock a corresponding cache area for the target memory buffer in the cache area to cache the data in the target memory buffer.

[0057] Here, through the cache allocation method in the above-mentioned steps S111 to S114, it is possible to dynamically specify and switch the buffers that need to allocate cache areas on the basis of excluding memory buffers that do not meet the conditions (such as excluding memory buffers that cannot be locked due to size reasons, and memory buffers that have not been updated and therefore do not need to be locked), thereby improving the data hit rate in the cache area from the system level while improving the allocation efficiency.

[0058] In some embodiments, the screening condition includes at least one of the following:

[0059] The first type is that the size of the memory buffer is less than or equal to a first preset size, and the first preset size is the available size of the cache area;

[0060] The second type is that there is an update in the memory buffer;

[0061] The third type is that the size of the update area of ​​the memory buffer is greater than or equal to the second preset size;

[0062] Here, the second preset size may be 720×480 (bytes).

[0063] Fourth, the memory buffer is used to store data to be displayed.

[0064] Here, the memory buffer used to store data to be displayed refers to a memory buffer used to store data to be displayed on the screen, such as display data, video data, etc. Because in some embodiments of the present application, attribute information needs to be obtained through the window manager, the candidate memory buffer needs to be a memory buffer used to store data to be displayed. Of course, if the attribute information of the memory buffer is obtained through other means, the corresponding screening conditions can be modified accordingly.

[0065] Based on the aforementioned embodiment, an embodiment of the present application further provides a cache allocation method, which is applied to an electronic device and includes:

[0066] Step S121, determining multiple candidate memory buffers;

[0067] Step S122: determining a refresh parameter of each candidate memory buffer zone based on the attribute information of each candidate memory buffer zone among the plurality of candidate memory buffer zones;

[0068] Step S123: Determine the candidate memory buffer whose refresh parameters meet the first requirement as the target memory buffer; wherein the attribute information is related to the usage frequency of the corresponding candidate memory buffer;

[0069] Here, the refresh parameters of the candidate memory buffers may be determined based on attribute information such as the refresh frequency and usage frequency of the candidate memory buffers, and then the candidate memory buffers whose refresh parameters meet the first requirement may be determined as the target memory buffers.

[0070] For example, a candidate memory buffer whose refresh parameter is greater than a preset threshold may be determined as the target memory buffer.

[0071] Step S124: Lock a corresponding cache area for the target memory buffer in the cache area to cache the data in the target memory buffer.

[0072] Here, through the cache allocation method in the above-mentioned steps S121 to S124, the buffer that needs to allocate the cache area can be dynamically specified and switched based on the refresh parameters of the buffer, so that the buffer with high frequency of update is locked and the buffer with low frequency of use is flushed out, thereby improving the data hit rate in the cache area from the system level.

[0073] In some embodiments, the attribute information includes at least one of: an update frequency of the memory buffer, a size of an update region of the memory buffer, and a pixel byte value of a format of the memory buffer;

[0074] Correspondingly, the step S122 of determining the refresh parameters of each candidate memory buffer in the plurality of candidate memory buffers based on the attribute information of each candidate memory buffer includes:

[0075] A refresh parameter of each candidate memory buffer is determined based on at least one of an update frequency of each candidate memory buffer, a size of an update region of each candidate memory buffer, and a pixel byte value of a format of each candidate memory buffer.

[0076] Here, the candidate memory buffer is mainly used to store displayable data, and the pixel byte value of the memory buffer format refers to the Byte Per Pixel value of the memory buffer format, such as 4 for the RGBA format and 1.5 for the NV12 format. Furthermore, the refresh parameter can be determined based on one or more information among the update frequency of the buffer, the size of the update area of ​​the buffer and the pixel byte value of the buffer format. For example, the refresh parameter of the first candidate memory buffer can be the product of the update frequency of the first candidate memory buffer, the size of the update area of ​​the first candidate memory buffer and the pixel byte value of the format of the first candidate memory buffer. Furthermore, the first requirement can be that the refresh parameter is greater than a preset threshold Th, and the preset threshold Th can be calculated by the following formula: Th = Width_Min*Height_Min*Fromat_BPP*VSYNC_Freq*Refresh_Ratio;

[0077] Among them, VSYNC_Freq is the current refresh rate of the display in the system, such as 30Hz (Hertz), 60Hz, 120Hz, etc.; Width_Min and Height_Min are defined constants. For example, during use, the width and height of the update area of ​​the buffer must be greater than 720×480 (bytes), then Width_Min=720, Height_Min=480; Format_BPP is the Byte Per Pixel value of the buffer format, such as 4 for RGBA format and 1.5 for NV12 format; Refresh_Ratio is a system-defined constant, which represents the refresh rate threshold, usually using a floating-point number between 0 and 0.4. The specific value can be determined based on the actual usage scenario. For example, Refresh_Ratio=0.1 means that SLC can be used if the refresh frequency is displayed once every ten frames; * is the product symbol.

[0078] Based on the aforementioned embodiment, an embodiment of the present application further provides a cache allocation method, which is applied to an electronic device and includes:

[0079] Step S131, determining multiple candidate memory buffers;

[0080] Step S132: determining a refresh parameter of each candidate memory buffer based on attribute information of each candidate memory buffer among the plurality of candidate memory buffers; wherein the attribute information is related to a usage frequency of the corresponding candidate memory buffer;

[0081] Step S133: sorting the multiple candidate memory buffers according to the refresh parameter to obtain a sorting result;

[0082] Step S134: Based on the sorting result, determine the candidate memory buffer whose sorting position meets the second requirement as the target memory buffer;

[0083] Here, multiple candidate memory buffers can be sorted based on the refresh parameters, and the top N candidate memory buffers in the sorting result are determined as target memory buffers; wherein N can be dynamically determined according to actual needs and the current state of the electronic device.

[0084] Step S135: Lock a corresponding cache area for the target memory buffer in the cache area to cache the data in the target memory buffer.

[0085] Based on the aforementioned embodiment, an embodiment of the present application further provides a cache allocation method, which is applied to an electronic device and includes:

[0086] Step S141, determining multiple candidate memory buffers;

[0087] Step S142: determining a refresh parameter of each candidate memory buffer based on attribute information of each candidate memory buffer among the plurality of candidate memory buffers; wherein the attribute information is related to a usage frequency of the corresponding candidate memory buffer;

[0088] Step S143: Determine a refresh parameter threshold according to the storage properties of the electronic device;

[0089] Here, the storage attributes include but are not limited to: the current refresh rate of the display in the system, the Byte Per Pixel value of the buffer format, and system-defined constants (such as the standard size of the buffer and the standard frequency of the refresh rate).

[0090] Step S144: determining the candidate memory buffer whose refresh parameter is greater than or equal to the refresh parameter threshold as the target memory buffer;

[0091] Step S145: Lock a corresponding cache area for the target memory buffer in the cache area to cache the data in the target memory buffer.

[0092] Here, if the cache allocation method in steps S131 to S135 in the above embodiment is adopted, the candidate memory buffers are pre-sorted in the sequence, so the target memory buffer can be quickly determined according to the order of the buffers in the sequence; and, for buffers with different position requirements, they can also be screened in the sorted sequence, meeting diverse task requirements. If the cache allocation method in steps S141 to S145 in the above embodiment is adopted, there is no need for sorting, and only the refresh parameters of each candidate memory buffer need to be compared with a threshold. The calculation difficulty is low, and a general judge can be implemented, which has low requirements for the equipment and reduces the equipment cost; and, there is no need to perform sorting calculations, the amount of calculation is small, and the calculation cost is saved. Therefore, those skilled in the art can choose a suitable solution to implement according to different needs in actual use, and the embodiments of the present application do not limit this.

[0093] Based on the above embodiments, the present application further provides a cache allocation method, which is applied to an electronic device. FIG2 is a second schematic diagram of an implementation flow of the cache allocation method according to the present application embodiment. As shown in FIG2 , the method includes:

[0094] Step S201: Determine a plurality of candidate memory buffers in a second state; wherein the second state corresponds to a cache area corresponding to the candidate memory buffer not being locked;

[0095] Here, the candidate memory buffer in the second state refers to the candidate memory buffer of the unlocked cache area; wherein, the candidate memory buffer of the unlocked cache area can be a candidate memory buffer of the cache area that has never been locked, or it can be a candidate memory buffer that previously had a corresponding locked cache area but is currently released. The embodiment of the present application does not impose any restrictions on this.

[0096] Step S202: determining a candidate memory buffer whose attribute information meets a preset requirement among the plurality of candidate memory buffers as a target memory buffer; wherein the attribute information is related to a usage frequency of the corresponding candidate memory buffer;

[0097] Step S203: Locking a corresponding cache area for the target memory buffer in the cache area to cache data in the target memory buffer;

[0098] Step S204: determining a candidate memory buffer in a first state; wherein the first state corresponds to the candidate memory buffer having a corresponding locked cache area;

[0099] Here, a flag bit can be set for each candidate memory buffer. For example, a flag bit of 1 indicates that the candidate memory buffer is in the first state and has a corresponding locked cache area. A flag bit of 0 indicates that the candidate memory buffer is in the second state and has not currently locked the corresponding cache area.

[0100] Of course, the first state and the second state of the candidate memory buffer may also be represented in other ways, and the embodiment of the present application does not limit this.

[0101] Step S205: If the attribute information of the candidate memory buffer in the first state no longer meets the preset requirement, release the cache area corresponding to the candidate memory buffer in the first state.

[0102] In this embodiment of the present application, if a corresponding cache area is locked for a candidate memory buffer within the cache area, the cache area corresponding to the candidate memory buffer can be dynamically reconfirmed at predetermined intervals to determine whether the candidate memory buffer still meets the locking criteria. If not, the cache area corresponding to the candidate memory buffer is released. Furthermore, buffers that previously did not meet the criteria but whose current attribute information meets the predetermined requirements are locked, thereby implementing a dynamic on-chip storage mode and significantly improving the data hit rate of the cache area.

[0103] Here, the cache allocation method in steps S201 to S205 can avoid the ping-pong effect of the cache and dynamically adapt to the scenario, so that the on-chip storage mode portion in the cache can be maximized.

[0104] In some embodiments, the method further comprises:

[0105] Step S21: determining a screening condition based on the available size of the buffer area;

[0106] Step S22: Determine the memory buffers that meet the screening condition as candidate memory buffers.

[0107] Here, there are multiple memory buffers in the electronic device. The method in the above steps S21 to S22 can be used to determine a candidate memory buffer that meets the screening conditions from the multiple memory buffers, and then the cache allocation method in the above steps S201 to S205 can be executed on the candidate memory buffer that meets the screening conditions.

[0108] In some embodiments, the step S202 of determining a candidate memory buffer whose attribute information meets preset requirements among the multiple candidate memory buffers as a target memory buffer includes:

[0109] Step S2021: determining a refresh parameter of each candidate memory buffer zone based on the attribute information of each candidate memory buffer zone among the plurality of candidate memory buffer zones;

[0110] Step S2022: Determine the candidate memory buffer whose refresh parameter meets the first requirement as the target memory buffer.

[0111] Based on the aforementioned embodiment, an embodiment of the present application further provides a cache allocation method, which is a solution for using system-level cache according to the refresh frequency of the display buffer.

[0112] Currently, System Level Cache (SLC) is a module designed to share data between multiple DMA (Direct Memory Access) masters in a SOC (System on Chip). For example, after the GPU (Graphics Processing Unit) completes rendering, it hands the data to the DPU (Display Unit) to complete the display. After the ISP (Image Signal Processing) completes the video and photo shooting, it shares the data with the NPU (Embedded Neural Network Processor) for neural network processing.

[0113] Among them, the problem faced by SLC is that due to factors such as process and power consumption, the system-level cache is often much smaller than DDR main memory. For example, the size of the system-level cache is generally several megabits or tens of megabits. DDR main memory is generally on the order of several gigabits or tens of gigabits. The system-level cache has a strategy determined by the RTL (Register Transfer Level) to determine which data will be cached (locked) in the SLC (that is, the corresponding cache area in the SLC is locked for certain data to cache the data) and which data will be released (flushed) to the DDR. The optimized energy efficiency of the system-level cache is determined by the cache hit rate: the higher the cache hit rate, the greater the contribution of the system-level cache to performance and power consumption, and vice versa.

[0114] When data is accessed in parallel and the total size of the data accessed in parallel is larger than the size of the SLC, a cache ping-pong effect often occurs. That is, data is frequently released to the DDR and read into the SLC, resulting in a low cache hit rate and affecting the system's power consumption and performance.

[0115] In the following description, Buffer represents a memory segment used in the system, which is used to place a complete system resource of the operating system, such as Frame Buffer.

[0116] For example, the system-level cache size is 8M. A user is playing a 1080P (pixel) 60FPS (frames per second) game. The rendering engine and operating system typically allocate three frame data caches (Triple Buffers) for rendering and displaying the game. This ensures system smoothness and allows the GPU to render while the DPU displays the rendered results. The following timing sequence causes a ping-pong effect in the system-level cache:

[0117] 1) GPU rendering completes the first frame FrameBuffer, the buffer size is 1920x1080*4 (RGBA format) = 8M bytes (megabits), at this time the 8M SLC is completely occupied by the frame data.

[0118] 2) The GPU starts rendering the header of the second frame. Since the FrameBuffer of the second frame is newly generated data, the SLC is completely full at this time, causing the corresponding header data of the first frame to be released to the DDR.

[0119] 3) The DPU starts to display the first frame of data and reads from the head. At this time, the data has been released to the DDR, and the DPU needs to read this part of the data from the DDR.

[0120] It can be seen that when the cache ping-pong effect occurs, all data reading and writing will go through the SLC, but at this time the SLC data will not have a data hit, which fails to achieve its designed purpose and instead increases the system's latency and power consumption.

[0121] Therefore, in order to avoid the cache ping-pong effect of SLC, software can intervene to decide which buffer can be locked into SLC and let SLC always lock the memory to avoid the ping-pong effect. This mode is called SLC On-Chip Memory mode (OCM mode).

[0122] FIG3A is a schematic diagram illustrating the operation of the OCM mode in the related art. As shown in FIG3A , the OCM mode in the related art is a static mapping mode, comprising an OCM usage module 31 and an OCM driver module 32. Specifically, the OCM usage module 31 is used to determine which candidate memory buffers (i.e., buffers) to lock or release, and the OCM driver module 32 is used to determine the available size of the cache area and perform operations such as locking and releasing candidate memory buffers. FIG3A shows that there are multiple candidate memory buffers in the DDR 33. In the system-level cache 34, the OCM mode can be used to statically lock the corresponding cache area for a candidate memory buffer to cache the data within the candidate memory buffer. Specifically, to avoid a ping-pong effect in the SLC, software can be used to determine which candidate memory buffer in the SLC to lock the corresponding cache area, and to ensure that the SLC always locks the cache area, thereby avoiding the ping-pong effect in the SLC. This mode is the static OCM mode of the SLC.

[0123] For example, OCM can specify SLC to lock the first Framebuffer, and the 8M cache is completely occupied by this frame. The data of the remaining two frames are directly placed in the DDR memory through SLC. In this way, when the three data frames are rendered in turn, the cache hit rate is 1 / 3=33.3%. The situation is much better when the above sound ping-pong effect is produced.

[0124] However, the OCM mode has the following problems: the memory (Buffer) locked by the OCM mode is often statically specified by the OCM usage module (such as other driver modules in Linux). If the memory (Buffer) is not frequently used and needs to be read and written by each Master (main processing module), the OCM mode cannot improve the cache hit rate of the SLC. On the contrary, because it occupies the system-level cache, it may cause the cache hit rate to decrease.

[0125] Furthermore, in desktop operating systems (such as Linux, Android, and Windows), the buffers that need to be read and written frequently are not fixed but constantly change based on the applications and scenarios used by the user. Therefore, embodiments of the present application provide a mechanism to determine when to use the OCM mode and determine the memory locked in the OCM mode, thereby improving the access hit rate of the system-level cache.

[0126] That is, the embodiment of the present application proposes a cache allocation method, which can dynamically determine the use of the OCM mode, specify and switch the buffer used by the OCM mode, thereby improving the cache hit rate of the SLC from the system level.

[0127] FIG3B is a schematic diagram of the working mode of the OCM mode in an embodiment of the present application. As shown in FIG3B , the OCM mode in an embodiment of the present application is a dynamic mapping mode, comprising: an information update module 301, an OCM management module 302, and an OCM driver module 303; wherein, the information update module 301 is used to report the information and time of candidate memory buffer usage. The OCM management module 302 is used to determine the usage policy based on buffer information such as the size, format, and frequency of use of the candidate memory buffer, that is, to determine whether to use and which candidate memory buffer to use the OCM mode. The OCM driver module 303 is used to execute specific instructions issued by the user state, and perform operations such as reserving the size, locking the candidate memory buffer, and releasing the candidate memory buffer. The information update module 301 is embedded in the system window compositor, which is the module in the operating system that performs desktop composition and display. It corresponds to Surfaceflinger in Android (SurfaceFlinger is a special process primarily responsible for compositing all Surfaces into Framebuffers, which are then read by the screen and displayed to the user), Desktop Manager in Windows (a terminal management system), and X11 in Linux (a graphical window management system). As can be seen in FIG3B , there are multiple candidate memory buffers with different numbers in DDR 304, such as candidate memory buffer 0 and candidate memory buffer 1. The use of OCM mode can be dynamically determined, and the buffer used by OCM mode can be specified and switched. Thus, in the system-level cache 305, the OCM mode can be used to dynamically lock the corresponding cache area for a candidate memory buffer to cache the data in the candidate memory buffer. That is, based on the status of the candidate memory buffer, a candidate memory buffer that can be locked by the SLC OCM is dynamically selected. The selected candidate memory buffer typically has an appropriate size and the highest refresh rate in the system, meaning that the GPU / NPU uses this memory at high speed, thereby ensuring that the SLC cache hit rate is improved.

[0128] This method contains the following modules:

[0129] (1) System Buffer usage information update module: This module, embedded in the system window compositor, is used to report the information and time of Buffer usage.

[0130] (2) OCM management module: determines whether to use and which buffer to use OCM mode based on information such as the size, format, and frequency of use of the memory block (Buffer).

[0131] (3) OCM kernel driver: executes specific instructions issued by user mode, performs operations such as reserving size, locking memory, and releasing memory.

[0132] In summary, the solution in the embodiment of the present application can dynamically select the OCM involved in the SLC according to the display buffer situation. The locked buffer and the selected buffer usually have a suitable size and the highest refresh frequency in the system, that is, the GPU and / or NPU use this block of memory at high speed, thereby ensuring that the cache hit rate of the SLC is improved.

[0133] That is to say, the existing method of using cache is that RTL (Register Transfer Level) determines which data enters and exits the SLC based on the order of time, MPAM and other information, without much involvement of software. However, this method may cause some frequently used data to be frequently flushed in and out of the SLC, resulting in a ping-pong effect. The OCM mode in the related art is determined by the software to allocate an area in the SLC and lock and map a certain buffer. After the buffer occupies the SLC, it will not be automatically flushed out by the hardware and requires active triggering by the software. However, the buffer statically specified according to a certain scenario may not be used frequently after the scenario changes, thereby reducing the SLC utilization rate. The OCM mode in the embodiment of the present application is that the display management module of the Framework counts the update rate of each display buffer, and the buffer that is updated as frequently as possible uses the OCM, and the buffer that is used less frequently is flushed out of the OCM. In this way, while reducing the ping-pong effect, it can dynamically adapt to the scene and maximize the utilization of the OCM part in the SLC.

[0134] The OCM mode in the embodiment of the present application is described in detail below. The OCM mode in the embodiment of the present application includes the following steps:

[0135] The first step is to initialize the SLC and load the OCM driver module so that the OCM management module can obtain the SLC size and the available size (OCM_A_Size) of the OCM from the OCM driver module.

[0136] In the second step, the OCM management module sets the filtering conditions used by the information update module based on the available size of the OCM. The minimum size (Size_min) is an initial threshold condition. For example, the width and height of the buffer update area must be larger than the minimum size, such as 720×480 (bytes). The overall size of the buffer is smaller than the available size of the OCM.

[0137] In the third step, the system passes the buffer information that needs to be sent to the system window compositor. The buffer information includes size, format, resource flag (file descriptor in Linux), whether there is an update, the size of the update area, and display-related information (such as whether to display, display location, display transformation, etc.).

[0138] Step 4: Before the window compositor synthesizes and displays the buffer information, the information update module filters the buffer information and submits the appropriate buffer information to the OCM management module via IPC (Inter-Process Communication). The filtering conditions include at least one of the following:

[0139] A: The total size of the buffer is less than or equal to the available size of the OCM;

[0140] B: The buffer is updated and the size of the update area is larger than the minimum size;

[0141] C: This Buffer is used to store visual data (i.e., the Buffer visible to the user).

[0142] Step 5: The OCM management module updates the buffer information frequency table, which contains buffer information and buffer usage frequency. Buffer information is directly reported by the buffer usage information update module. The buffer usage frequency is the statistical frequency of buffer usage for this block and can be calculated using the following formula:

[0143] Peroid_Current_ns=(Current_ns–Last_ns) <System_VSYNC_ns?System_VYNC_ns:(Current_ns–Last_ns);

[0144] If the buffer is updated, Buffer_Freq_Ins=10^9 / (Peroid_Current_ns);

[0145] If the Buffer is not updated and Current_System_ns – Last_ns > 2 * System_VSYNC_ns, then Buffer_Freq_Ins = 0;

[0146] where Buffer_Freq = Ratio * Buffer_Freq + (1.0 - Ratio) * Buffer_Freq_Ins;

[0147] The physical meanings of the above parameters are as follows: System_VSYNC_ns is the time for the system display refresh on the current day (VYNC cycle), Current_ns is the current time when the OCM management module receives the Buffer update information, Last_ns is the time when the OCM management module last received the Buffer information, Ratio is the threshold set by the system, a number between 0 and 1; Buffer_Freq is the calculated Buffer usage frequency, with an initial value of 0.

[0148] Step 6: The OCM management module sorts the items in the Buffer information frequency table in descending order according to the scores; where the calculation method of the score is Score = Buffer_Update_Size * Format_Bpp * Buffer_Freq.

[0149] Step 7: The OCM management module traverses the Buffer information frequency table to make a usage decision (the policy of locking / releasing the cache area corresponding to the Buffer); the implementation method of the usage decision is as follows:

[0150] First, traverse the Buffers that have been locked by the OCM (i.e., the Buffers with the flag bit set to 1 in the table). If Score < Width_Min * Height_Min * Fromat_BPP * VSYNC_Freq * Refresh_Ratio, then the Buffer is released through the OCM driver module, that is, the Buffer is released to the DDR memory, the cache area corresponding to the OCM is released, and at the same time, the available size of the OCM is increased by the released size.

[0151] The second pass traverses the buffer that is not locked by OCM. If Score>=Width_Min*Height_Min*Fromat_BPP*VSYNC_Freq*Refresh_Ratio, and Buffer_Size<=OCM_A_Size, the buffer is locked through the OCM driver, that is, the DDR memory corresponding to the buffer block is moved into the OCM cache, and OCM_A_SIZE is subtracted from Buffer_Size.

[0152] Among them, during the calculation process, VSYNC_Freq is the current refresh rate (HZ) of the display in the system, such as 30, 60, 120, etc.; Width_Min and Height_Min are defined constants, such as Width_Min = 720, Height_Min = 480; Format_BPP is the Byte Per Pixel value of the buffer format, such as 4 for RGBA format and 1.5 for NV12 format; Refresh_Ratio is a system-defined constant, usually a number between 0 and 0.4.

[0153] The above is the process of the OCM management module dynamically performing OCM lock / flush operations on the buffer according to the buffer refresh rate information. This process can ensure that the buffer with a high refresh rate uses OCM and the buffer with a low refresh rate is cleared out of OCM, thereby maximizing the utilization of the SLC.

[0154] For example, suppose an Android user starts playing a game and then switches to the camera preview function, pausing the game in the background. The OCM mode in related art is a static OCM solution, where the game FB does not automatically refresh the OCM after using OCM. However, the OCM mode in the embodiment of the present application is a dynamic OCM solution, where the OCM is released to the foreground application after the game switches to the background.

[0155] Based on the foregoing embodiments, an embodiment of the present application provides a cache allocation device, which includes the modules included, the units included in the modules, and the components included in the units, and can be implemented by a processor in an electronic device; of course, it can also be implemented by a specific logic circuit; in the implementation process, the processor can be a CPU (Central Processing Unit), an MPU (Microprocessor Unit), a DSP (Digital Signal Processing) or an FPGA (Field Programmable Gate Array), etc.

[0156] FIG4 is a schematic diagram of the composition structure of a cache allocation device according to an embodiment of the present application. As shown in FIG4 , the device 400 includes:

[0157] The management module 401 is configured to determine a plurality of candidate memory buffers of the electronic device; and determine a candidate memory buffer whose attribute information meets a preset requirement among the plurality of candidate memory buffers as a target memory buffer; wherein the attribute information is related to a usage frequency of the candidate memory buffer;

[0158] The driver module 402 is configured to lock a corresponding cache area for the target memory buffer in a system-level cache area of ​​the electronic device to cache data in the target memory buffer.

[0159] In some embodiments, the apparatus further comprises:

[0160] A first determining module is configured to determine a candidate memory buffer in a first state; wherein the first state corresponds to the candidate memory buffer having a corresponding locked cache area;

[0161] a release module, configured to release a cache area corresponding to the candidate memory buffer in the first state if the attribute information of the candidate memory buffer in the first state no longer meets the preset requirement;

[0162] Correspondingly, the management module 401 includes:

[0163] The management submodule is configured to determine a plurality of candidate memory buffers in a second state; wherein the second state corresponds to a cache area corresponding to the candidate memory buffer not being locked.

[0164] In some embodiments, the apparatus further comprises:

[0165] A second determining module is used to determine a screening condition according to the available size of the buffer area;

[0166] The third determining module is configured to determine the memory buffers that meet the screening condition as candidate memory buffers.

[0167] In some embodiments, the screening condition includes at least one of the following:

[0168] The size of the memory buffer is less than or equal to a first preset size, where the first preset size is the available size of the cache;

[0169] There is an update in the memory buffer;

[0170] The size of the update area of ​​the memory buffer is greater than or equal to a second preset size;

[0171] The memory buffer is used to store data to be displayed.

[0172] In some embodiments, the management module 401 includes:

[0173] a first determining unit, configured to determine a refresh parameter of each candidate memory buffer zone based on attribute information of each candidate memory buffer zone among the plurality of candidate memory buffer zones;

[0174] The second determining unit is configured to determine the candidate memory buffer whose refresh parameter meets the first requirement as the target memory buffer.

[0175] In some embodiments, the second determining unit includes:

[0176] a sorting component, configured to sort the plurality of candidate memory buffers according to the refresh parameter to obtain a sorting result;

[0177] The first determining component is configured to determine, based on the sorting result, a candidate memory buffer whose sorting position meets the second requirement as the target memory buffer.

[0178] In some embodiments, the second determining unit includes:

[0179] A second determining component, configured to determine a refresh parameter threshold value according to a storage attribute of the electronic device;

[0180] The third determining component is configured to determine a candidate memory buffer having a refresh parameter greater than or equal to the refresh parameter threshold as the target memory buffer.

[0181] In some embodiments, the attribute information includes at least one of: an update frequency of the memory buffer, a size of an update region of the memory buffer, and a pixel byte value of a format of the memory buffer;

[0182] Correspondingly, the first determining unit includes:

[0183] The first determining subunit is used to determine the refresh parameter of each candidate memory buffer based on at least one of the update frequency of each candidate memory buffer, the size of the update area of ​​each candidate memory buffer, and the pixel byte value of the format of each candidate memory buffer.

[0184] Based on the above embodiments, an embodiment of the present application provides an electronic device. FIG5 is a schematic diagram of the composition structure of the electronic device according to the embodiment of the present application. As shown in FIG5 , the electronic device 500 includes:

[0185] Multiple candidate memory buffers 501;

[0186] Cache 502;

[0187] The processor 503 is used to determine the multiple candidate memory buffers 501; determine the candidate memory buffer whose attribute information meets the preset requirements among the multiple candidate memory buffers 501 as the target memory buffer; wherein the attribute information is related to the usage frequency of the corresponding candidate memory buffer; and lock the corresponding cache area for the target memory buffer in the cache area 502 to cache the data in the target memory buffer.

[0188] The descriptions of the above device embodiments and equipment embodiments are similar to the descriptions of the above method embodiments and have similar beneficial effects as the method embodiments. For technical details not disclosed in the device embodiments and equipment embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.

[0189] It should be noted that, in the embodiment of the present application, if the above-mentioned cache allocation method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling an electronic device (which can be a personal computer, server, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a U disk, a mobile hard disk, a ROM (Read Only Memory), a magnetic disk or an optical disk. In this way, the embodiment of the present application is not limited to any specific combination of hardware and software.

[0190] Correspondingly, an embodiment of the present application further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the program, the steps in the cache allocation method provided in the above embodiment are implemented.

[0191] Correspondingly, an embodiment of the present application provides a readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned cache allocation method are implemented.

[0192] It should be noted that the description of the above storage medium and device embodiments is similar to the description of the above method embodiments and has similar beneficial effects as the method embodiments. For technical details not disclosed in the storage medium and device embodiments of this application, please refer to the description of the method embodiments of this application for understanding.

[0193] It should be noted that FIG6 is a schematic diagram of a hardware entity of an electronic device according to an embodiment of the present application. As shown in FIG6 , the hardware entity of the electronic device 600 includes: a processor 601, a communication interface 602 and a memory 603, wherein

[0194] The processor 601 generally controls the overall operations of the electronic device 600 .

[0195] The communication interface 602 may enable the electronic device 600 to communicate with other electronic devices, servers, or platforms via a network.

[0196] The memory 603 is configured to store instructions and applications executable by the processor 601, and can also cache data to be processed or processed by the processor 601 and various modules in the electronic device 600 (for example, image data, audio data, voice communication data and video communication data), which can be implemented through FLASH (flash memory) or RAM (Random Access Memory).

[0197] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0198] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0199] In addition, the functional units in the embodiments of the present application can all be integrated into one processing module, or each unit can be a separate unit, or two or more units can be integrated into one unit; the above-mentioned integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional units. It can be understood by those skilled in the art that all or part of the steps of the above-mentioned method embodiments can be completed by hardware related to program instructions, and the above-mentioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiments; and the above-mentioned storage medium includes various media that can store program codes, such as mobile storage devices, ROM, RAM, disks or optical disks.

[0200] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.

[0201] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.

[0202] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.

[0203] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A cache allocation method, the method include: determining a plurality of candidate memory buffers; Determine a candidate memory buffer whose attribute information meets preset requirements among the multiple candidate memory buffers as a target memory buffer; wherein the attribute information is related to the usage frequency of the corresponding candidate memory buffer; A corresponding cache area is locked for the target memory buffer in the cache area to cache data in the target memory buffer.

2. The method according to claim 1, further comprising: include: Determine a candidate memory buffer in a first state; wherein the first state corresponds to the candidate memory buffer having a corresponding locked cache area; If the attribute information of the candidate memory buffer in the first state no longer meets the preset requirement, releasing the cache area corresponding to the candidate memory buffer in the first state; Correspondingly, the determining of a plurality of candidate memory buffers includes: Determine a plurality of candidate memory buffers in a second state; wherein the second state corresponds to a cache area corresponding to the candidate memory buffer not being locked.

3. The method according to claim 1 or 2, further comprising: include: Determining a screening condition according to the available size of the buffer area; The memory buffers satisfying the screening condition are determined as candidate memory buffers.

4. The method according to claim 3, wherein the screening condition comprises at least one of the following: The size of the memory buffer is less than or equal to a first preset size, where the first preset size is the available size of the cache area; There is an update in the memory buffer; The size of the update area of ​​the memory buffer is greater than or equal to a second preset size; The memory buffer is used to store data to be displayed.

5. The method according to claim 1 or 2, wherein the candidate memory buffer whose attribute information meets the preset requirements among the multiple candidate memory buffers is determined as the target memory buffer, include: Determining a refresh parameter of each candidate memory buffer based on the attribute information of each candidate memory buffer among the plurality of candidate memory buffers; The candidate memory buffer whose refresh parameter meets the first requirement is determined as the target memory buffer.

6. The method according to claim 5, wherein the candidate memory buffer whose refresh parameter meets the first requirement is determined as the target memory buffer, include: sorting the plurality of candidate memory buffers according to the refresh parameter to obtain a sorting result; Based on the sorting result, a candidate memory buffer whose sorting position meets the second requirement is determined as the target memory buffer.

7. The method according to claim 5, wherein the candidate memory buffer whose refresh parameter meets the first requirement is determined as the target memory buffer, include: Determining a refresh parameter threshold according to a storage attribute of the electronic device; A candidate memory buffer whose refresh parameter is greater than or equal to the refresh parameter threshold is determined as the target memory buffer.

8. The method according to claim 5, wherein the attribute information is at least include: at least one of an update frequency of the memory buffer, a size of an update region of the memory buffer, and a pixel byte value of a format of the memory buffer; Correspondingly, determining the refresh parameter of each candidate memory buffer in the plurality of candidate memory buffers based on the attribute information of each candidate memory buffer includes: A refresh parameter of each candidate memory buffer is determined based on at least one of an update frequency of each candidate memory buffer, a size of an update region of each candidate memory buffer, and a pixel byte value of a format of each candidate memory buffer.

9. A cache allocation device, the device include: A management module, configured to determine a plurality of candidate memory buffers of the electronic device; Determine a candidate memory buffer whose attribute information meets preset requirements among the multiple candidate memory buffers as a target memory buffer; wherein the attribute information is related to the usage frequency of the candidate memory buffer; The driver module is used to lock a corresponding cache area for the target memory buffer in a system-level cache area of ​​the electronic device to cache data in the target memory buffer.

10. An electronic device, wherein the electronic device include: Multiple candidate memory buffers; Cache area; A processor, configured to determine the plurality of candidate memory buffers; A candidate memory buffer whose attribute information meets preset requirements among the multiple candidate memory buffers is determined as a target memory buffer; wherein the attribute information is related to the usage frequency of the corresponding candidate memory buffer; and a corresponding cache area is locked for the target memory buffer in the cache area to cache the data in the target memory buffer.

Citation Information

Patent Citations

  • Audio playing method and system of IP network

    CN113556292A

  • Cache allocation method and device and electronic equipment

    CN116401049A

  • Reward based cache management

    US6378043B1

  • Memory management method and apparatus, and computer device

    WO2023010879A1