Cache partition configuration method and device and computer equipment

By mapping the group identifiers in the control group to the cached partition identifier and using the preset configuration cache partition to provide cache function for tasks, the problem of unreasonable allocation of cache resources caused by excessive tasks in the Android system is solved, and the problem of unreasonable allocation of cache resources is improved. Storage efficiency.

CN119415443APending Publication Date: 2025-02-11GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411080451.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-07
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

There are too many tasks in the Android system, exceeding the number of available partIDs, resulting in the failure to properly allocate cache resources and inefficient memory access.

Method used

By obtaining the group identifier from the structure data of the control group, mapping it to the cached partition identifier, the cache partition corresponding to the pre-configured partition identifier provides a cache function for the task to ensure that the group identifier corresponds one by one to the partition identifier.

Benefits of technology

It effectively improves the reasonable allocation of cache resources, improves the efficiency of memory access, and meets the reasonable allocation needs of each group of tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415443A_ABST
    Figure CN119415443A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a cache partition configuration method, which comprises the following steps: obtaining grouping identifiers from structural data of a control group, mapping the grouping identifiers to partition identifiers of a cache, and enabling the grouping identifiers and the partition identifiers to be in one-to-one correspondence, and utilizing a cache partition corresponding to a pre-configured partition identifier to provide a cache function for a task corresponding to the partition identifier, wherein the task of the partition identifier is a task corresponding to the grouping identifier corresponding to the partition identifier. The embodiment of the invention further provides a cache partition configuration device and computer equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to cache adjustment technology, and in particular to a cache partition configuration method, device and computer equipment. Background Art

[0002] At present, on the hardware platform of ARM (Advanced RISC Machine) architecture, the Level 3 Cache (L3) shared cache can use the Memory Partitioning and Monitoring (MPAM) technology to group the cache. Different groups are distinguished by partition identification (part ID), so that different cache blocks support the memory access behavior of different tasks to execute tasks.

[0003] However, the number of tasks in the current Android system may be hundreds or thousands, which far exceeds the number of available partIDs, resulting in unreasonable allocation of cache resources, thereby causing low memory access efficiency of the system. Summary of the invention

[0004] The embodiments of the present application provide a method, apparatus and computer device for configuring a cache partition, which can improve the reasonable allocation of cache resources to improve memory access efficiency.

[0005] The technical solution of this application is implemented as follows:

[0006] In a first aspect, an embodiment of the present application provides a method for configuring a cache partition, including:

[0007] Get the group identifier from the structure data of the control group;

[0008] Mapping the group identifier to a cached partition identifier; wherein the group identifier corresponds to the partition identifier one by one;

[0009] Using the pre-configured cache partition corresponding to the partition identifier to provide a cache function for the task corresponding to the partition identifier;

[0010] The task of the partition identifier is a task corresponding to the group identifier corresponding to the partition identifier.

[0011] In a second aspect, an embodiment of the present application provides a cache partition configuration device, including:

[0012] An acquisition module, used for acquiring a group identifier from the structural data of the control group;

[0013] A mapping module, used to map the group identifier to a cached partition identifier; wherein the group identifier corresponds to the partition identifier one by one;

[0014] Providing a module for providing a cache function for a task corresponding to the partition identifier by using a pre-configured cache partition corresponding to the partition identifier;

[0015] The task of the partition identifier is a task corresponding to the group identifier corresponding to the partition identifier.

[0016] In a third aspect, an embodiment of the present application provides a computer device, comprising: a processor and a storage medium storing instructions executable by the processor; the storage medium relies on the processor to perform operations through a communication bus, and when the instructions are executed by the processor, the cache partition configuration method described in one or more of the above embodiments is executed.

[0017] In a fourth aspect, an embodiment of the present application provides a computer storage medium storing executable instructions. When the executable instructions are executed by one or more processors, the processors execute the cache partition configuration method described in one or more of the above embodiments.

[0018] The embodiments of the present application provide a method, apparatus and computer device for configuring cache partitions, including: obtaining a group identifier from structural data of a control group, mapping the group identifier to a partition identifier of a cache, wherein the group identifier corresponds to the partition identifier one-to-one, and utilizing a cache partition corresponding to a pre-configured partition identifier to provide a cache function for a task corresponding to the partition identifier, wherein the task of the partition identifier is the task corresponding to the group identifier corresponding to the partition identifier; that is, in the embodiments of the present application, the group identifier in the control group is mapped to the partition identifier of the cache, so that the group identifier corresponds to the partition identifier one-to-one, and then utilizing a cache partition corresponding to the pre-configured partition identifier to provide a cache function for a task corresponding to the group identifier corresponding to the partition identifier, thus utilizing a cache partition to provide a cache function for the task of the group of the control group, and since the number of cache partitions is large and the number of groups of the control group is limited, it is possible to allocate a reasonably configured cache partition for each group of tasks, thereby improving memory access efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 This is a schematic diagram of partID obtained by grouping in MPAM in the related art;

[0020] Figure 2 A schematic diagram of a cache block represented in a cache allocation in an MPAM in the related art;

[0021] Figure 3A schematic diagram of the relationship between tasks and partID of an Android system in the related art;

[0022] Figure 4 A schematic diagram of a flow chart of an optional cache partition configuration method provided in an embodiment of the present application;

[0023] Figure 5 A schematic flow chart of an example of an optional cache partition configuration method provided in an embodiment of the present application;

[0024] Figure 6 A schematic diagram of cache resources in related technologies;

[0025] Figure 7 A schematic diagram of an optional mapping of cgroup grouping to MPAM partID provided in an embodiment of the present application;

[0026] Figure 8a A schematic diagram of optional bandwidth data provided in an embodiment of the present application;

[0027] Figure 8b A schematic diagram of an optional cache capacity utilization provided in an embodiment of the present application;

[0028] Fig. 9 A schematic diagram of the structure of an optional cache partition configuration device provided in an embodiment of the present application;

[0029] Fig.10 A schematic diagram of the structure of an optional computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0030] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.

[0031] On the ARM hardware platform, the L3 shared cache can be grouped using MPAM technology, in which different groups are distinguished by partition identifiers (partID). During task scheduling and switching, the cache-portion bitmap (CPBM) or cache capacity partitioning (CCAP) technology can be used to set and limit the available cache blocks and cache partition capacity corresponding to the cache partition. At the same time, MPAM also supports two monitoring methods: cache-storage usage monitor (csu) and cache bandwidth monitor (mbwu), which respectively count the utilization of cache blocks (cachelines) and cache bandwidth corresponding to different partIDs.

[0032] Figure 1 Schematic diagram of partID obtained by grouping in MPAM in the related art, such as Figure 1 As shown, the cache is grouped to obtain two groups of partIDs, namely partition identifier 1 (partition1) and partition identifier 2 (partition2), wherein the portable bitmap (PBM) of partition1 = 0b0011, the cache blocks used by partition1 are: portions0 and portions1, and the cache blocks used by partition2 are: portions1 and portions2. It can be seen that for block allocation (Portion Allocation), portions0 is allocated to partID = 1, portions1 is shared by both partID = 1 and partID = 2, portions2 is allocated to partID = 2, and portions2 is unallocated.

[0033] Figure 2 Schematic diagram of cache blocks represented in cache allocation in MPAM in the related art, such as Figure 2As shown in the figure, the first line is the cache-portion bitmap, which represents the allocation of cache blocks (Representing cache portion in Cache Allocation). When the bitmap is 1, it means that the cache way (a block in the cache used to store cached data and instructions) corresponding to the bitmap is allocated (May allocate this portion). When the bitmap is 0, it means that the cache way corresponding to the bitmap will not be allocated (May not allocate this portion).

[0034] By default, the MPAM technology in ARM configures partID based on the task process or virtual machine (VM) as the adjustment object. This means that the corresponding partID can be configured for different task identifiers (pid) or virtual machine identifiers (vmid). However, the number of partIDs on the hardware is limited. For example, ARM is designed to have a maximum of 64, while the number of tasks in the current Android system may be hundreds or thousands. Figure 3 It is a schematic diagram of the relationship between the tasks and partID of the Android system in the related art, such as Figure 3 As shown in the figure, if there are 5500 tasks (task / process), this far exceeds the number of available partIDs, so it is difficult to make targeted adjustments for all tasks one by one. When actually allocating MPAM cache resources, a better strategy and method is needed to centrally manage the cache available to a large number of parallel tasks in the system.

[0035] In view of the technical problem of low memory access efficiency caused by unreasonable allocation of cache resources in computer devices, an embodiment of the present application provides a method for configuring cache partitions. Figure 4 A flow chart of an optional cache partition configuration method provided in an embodiment of the present application, such as Figure 4 As shown, the configuration method of the cache partition may include:

[0036] S401: Obtaining a group identifier from structural data of a control group;

[0037] In the Android environment, the Linux kernel uses cgroup by default to group all task processes in the system and manage and allocate computing resources based on the groups.

[0038] Among them, cgroup can be called a control group, which is a function of the Linux kernel and is used to limit, control and separate the resources of a process group; for example, the resource can be a central processing unit (CPU), memory, disk input and output, etc.

[0039] In the embodiment of the present application, the grouping in the cgroup is borrowed, specifically, the group identifier is obtained from the structural data of the cgroup. In order to obtain the group identifier from the structural data of the cgroup, in the cgroup_subsys_state data structure of the kernel, different groups have different group identifiers (css->id), for example, including: three group identifiers.

[0040] It should be noted that, for the group identifiers obtained from the cgroup structure data, each group identifier corresponds to a task. For example, when the group identifiers include three, each group identifier corresponds to a task, and then there are three groups of tasks for the three group identifiers.

[0041] S402: Map the group identifier to the cached partition identifier;

[0042] After obtaining the group identifier in the cgroup through S401, the group identifier is mapped to the cached partID. Generally, the number of group identifiers of the cgroup is less than the number of available partIDs in the cache. For example, the number of group identifiers of the cgroup is 20, and the number of available partIDs is 64. Then, in order to map the group identifier to the cached partID, the 20 group identifiers can be mapped to the first 20 of the available partIDs respectively. For example, group identifier = 1 is mapped to partID = 1, group identifier = 2 is mapped to partID = 2, group identifier = 3 is mapped to partID = 3, and so on, until the group identifiers and partIDs correspond one to one.

[0043] In this way, a mapping between the group identifier and the partID in the cache is established, and the task of the partID is the task corresponding to the group identifier corresponding to the partID. That is to say, after the group identifier = 1 is mapped to partID = 1, the task corresponding to partID = 1 is the task corresponding to the group identifier = 1, after the group identifier = 2 is mapped to partID = 2, the task corresponding to partID = 2 is the task corresponding to the group identifier = 2, after the group identifier = 3 is mapped to partID = 3, the task corresponding to partID = 3 is the task corresponding to the group identifier = 3, and so on, completing the mapping of each group identifier to partID.

[0044] S403: Using the cache partition corresponding to the pre-configured partition identifier to provide a cache function for the task corresponding to the partition identifier.

[0045] After obtaining the partID and the task corresponding to the partID through S401 and S402, the pre-configured cache partition corresponding to the partID can be used to provide a cache function for the task corresponding to the partID.

[0046] The configuration information of the cache partition corresponding to the above partID is pre-configured, and the configuration information may include: the cache block used by the partID and the capacity of the cache partition.

[0047] That is, after determining the partID and the task corresponding to the partID, the cache block used by the partID and the capacity of the cache partition are used to provide a cache function for the task corresponding to the partID.

[0048] It should be noted that the tasks corresponding to the above partID have priority, and this priority is inherited from the cgroup. For example, if the above grouping identifier includes three, then it includes tasks corresponding to three groups of grouping identifiers. Three partIDs and tasks corresponding to the three partIDs are obtained through mapping. Then, the priority information of the tasks corresponding to the three partIDs is the priority information of the tasks corresponding to the three grouping identifiers. The CPU of the computer device chooses which task to run first based on the priority information.

[0049] Furthermore, the group identifier obtained from the cgroup structure data may be one, or may be two or more. Then, for the case of one group identifier, in an optional embodiment, when the group identifier is one, the method may further include:

[0050] Get the bandwidth data of the cache partition corresponding to partID;

[0051] When the bandwidth data of the cache partition corresponding to the partID is greater than the bandwidth threshold configured for the cache partition corresponding to the partID, reconfigure the cache partition corresponding to the partID;

[0052] The cache partition corresponding to the partID is used to provide a cache function for the task corresponding to the partID.

[0053] It can be understood that if a group identifier is obtained from the cgroup structure data, it is mapped to a partID. In order to ensure that the task corresponding to this partID can have reasonable cache resources, the bandwidth data of the cache partition corresponding to the part is obtained here, and then the relationship between the bandwidth data of the cache partition corresponding to the partID and the bandwidth threshold configured for the cache partition corresponding to the partID is determined. If it is greater than, it means that the cache resources owned by the task corresponding to the partID are unreasonable, which will affect the memory access efficiency. Therefore, at this time, the cache partition corresponding to the partID needs to be reconfigured.

[0054] If it is less than or equal to, it means that the cache resources owned by the task corresponding to partID are relatively reasonable and do not affect the memory access efficiency. Therefore, there is no need to configure the cache partition corresponding to partID.

[0055] In addition, after the cache partition corresponding to the partID is reconfigured, the cache partition corresponding to the reconfigured partID is used to provide a cache function for the task corresponding to the partID.

[0056] In this way, through real-time monitoring of bandwidth data in MPAM technology, the actual situation of the cache partition corresponding to partID can be known, and if the cache partition is not configured reasonably, it can be deployed in time to meet the needs of the current task.

[0057] In addition, for the case where the number of group identifiers is at least two, in an optional embodiment, when the number of group identifiers is at least two, the method may further include:

[0058] Get the bandwidth data of the cache partition corresponding to each partID in partID;

[0059] When the proportion of bandwidth data of the cache partition corresponding to the first partID does not fall into the pre-configured proportion range of the cache partition of the first partID, reconfigure the cache partition corresponding to the partID;

[0060] The cache partition corresponding to the partID is used to provide a cache function for the task corresponding to the partID.

[0061] It can be understood that if two or more group identifiers are obtained from the structural data of the cgroup, then the two or more group identifiers are respectively mapped to the partIDs to obtain two or more partIDs.

[0062] In order to ensure that the task corresponding to each partID in two or more partIDs can have reasonable cache resources, it is necessary to obtain the bandwidth data of the cache partition corresponding to each partID. Here, at least one of the two monitoring methods mentioned above, csu / mbwu, can be used to determine whether the proportion of the bandwidth data of the cache partition corresponding to each partID falls within the proportion range of the cache partition corresponding to each partID. If the proportion of the bandwidth data of at least one cache partition corresponding to a partID does not fall within the proportion range of the cache partition corresponding to the partID, it means that at this time, there is at least one partID corresponding to the task. The cache resources owned by the unreasonable, which will affect the memory access efficiency, so at this time, it is necessary to reconfigure the cache partition corresponding to the partID. Here, the CPBM / CCAP mentioned above can be used to reconfigure the cache partition corresponding to the partID.

[0063] If the proportion of bandwidth data of the cache partition corresponding to each partID falls within the proportion range of the cache partition corresponding to each partID, it means that the cache resources owned by the task corresponding to the partID are reasonable and there is no need to reconfigure the cache partition corresponding to the partID.

[0064] Among them, the first partID is at least one partID among the partIDs; the proportion range of the cache partition corresponding to the first partID is: the preset proportion is floating up and down based on the capacity proportion of the first partID; that is to say, the proportion range of the cache partition corresponding to each partID is determined by: the preset proportion is floating up and down based on the capacity proportion of each partID, for example, the capacity proportion of the cache partition corresponding to the first partID is 30%, the preset proportion is 5%, and the proportion range of the cache partition corresponding to the first partID is: 25%-35%.

[0065] In addition, after the cache partition corresponding to the partID is reconfigured, the cache partition corresponding to the reconfigured partID is used to provide a cache function for the task corresponding to the partID.

[0066] In this way, through real-time monitoring of the bandwidth data of each partID in the MPAM technology, the proportion of the bandwidth data of the cache partition corresponding to each partID can be known. When the proportion of the cache partition is different from the proportion of the cache partition capacity, it can be allocated in time to adapt to the needs of the current task.

[0067] Regardless of whether it is a case of one group identifier or a case of two or more group identifiers, in an optional embodiment, obtaining bandwidth data of a cache partition corresponding to a partID includes:

[0068] The bandwidth data of the cache partition corresponding to the partID is collected at a preset time interval.

[0069] It can be understood that the bandwidth data of the cache partition corresponding to the partID can be collected in real time or at a preset time interval. Here, the sampling rate of the bandwidth data of the cache partition corresponding to the partID can be adjusted by setting the preset time interval. In this way, the bandwidth data of the cache partition corresponding to the partID can be collected at different sampling rates.

[0070] In this way, by setting different preset time intervals, different sampling rates are set to collect the bandwidth data of the cache partition corresponding to partID, so that the sampling rate can be set according to actual needs, thereby controlling the adjustment frequency of the cache partition corresponding to partID, thereby improving the flexibility of adjusting the cache partition corresponding to partID.

[0071] Regardless of whether it is a case of one group identifier or a case of two or more group identifiers, in addition to determining whether to reconfigure the cache partition corresponding to the partID each time the bandwidth data of the cache partition corresponding to the partID is collected, the adjustment frequency of the cache partition corresponding to the partID may also be set in other ways. In an optional embodiment, the bandwidth data of the cache partition corresponding to the partID is obtained, including:

[0072] When bandwidth data of cache partitions corresponding to a preset number of partIDs are collected, the collected bandwidth data of cache partitions corresponding to the preset number of partIDs are processed to obtain bandwidth data of cache partitions corresponding to the partIDs.

[0073] It can be understood that when the bandwidth data of the cache partitions corresponding to the preset number of partIDs are collected, the collected bandwidth data of the cache partitions corresponding to the preset number of partIDs need to be processed so as to obtain the bandwidth data of the cache partitions corresponding to the partIDs.

[0074] For the above processing, the bandwidth data of the cache partitions corresponding to a preset number of partIDs may be first screened and then the average value may be calculated, or the bandwidth data of the cache partitions corresponding to the partID may be obtained by weighted summation according to the time window. Here, the embodiment of the present application does not make any specific limitation on this.

[0075] In this way, by setting different preset numbers, the preset number can be set according to actual needs, so as to control the adjustment frequency of the cache partition corresponding to the partID, thereby improving the flexibility of adjusting the cache partition corresponding to the partID.

[0076] For a case where there are two or more group identifiers, in order to reconfigure the cache partition corresponding to the partID, in an optional embodiment, reconfiguring the cache partition corresponding to the partID includes:

[0077] Re-determine the capacity ratio of the cache partition of each partID according to the bandwidth data ratio of the cache partition corresponding to each partID in partID;

[0078] According to the proportion of the capacity of the cache partition of each partID, the capacity of the cache partition corresponding to each partID is re-determined.

[0079] It can be understood that after obtaining the bandwidth data of the cache partition corresponding to the partID, and if the proportion of the bandwidth data of at least one cache partition corresponding to the partID is different from the proportion of the capacity of the pre-configured cache partition of the partID, the cache partition corresponding to the partID needs to be reconfigured.

[0080] Specifically, after obtaining the bandwidth data of the cache partition corresponding to each partID through csu / mbwu, the proportion of the bandwidth data of the cache partition corresponding to each partID is calculated. When the proportion of the bandwidth data of the cache partition corresponding to at least one partID is different from the proportion of the capacity of the pre-configured cache partition of the partID, the proportion of the capacity of the cache partition of each partID is re-determined according to the proportion of the bandwidth data of the cache partition corresponding to each partID.

[0081] In re-determining the proportion of the capacity of the cache partition of each partID based on the proportion of the bandwidth data of the cache partition corresponding to each partID, the proportion of the capacity of the cache partition corresponding to each partID can be adjusted to be close to the proportion of the bandwidth data of the cache partition corresponding to each partID based on the proportion of the bandwidth data of the cache partition corresponding to each partID. The proportion of the capacity of the cache partition corresponding to each partID can also be equal to the proportion of the bandwidth data of the cache partition corresponding to each partID. In other words, the proportion of the bandwidth data of the cache partition corresponding to each partID is taken as the proportion of the capacity of the cache partition corresponding to each partID, so as to calculate the capacity of the cache partition corresponding to each partID.

[0082] In this way, the proportion of the capacity of the cache partition corresponding to each partID is determined by the proportion of the bandwidth data of the cache partition corresponding to each partID, and then the capacity of the cache partition corresponding to each partID is reconfigured through CPBM / CCAP, which can more reasonably allocate cache resources to improve memory access efficiency.

[0083] It should be noted that, for a group identifier, when the bandwidth data of the cache partition corresponding to partID is greater than the bandwidth threshold configured for the cache partition corresponding to partID, the capacity of the cache partition corresponding to partID can be adjusted to expand the bandwidth threshold configured for the cache partition corresponding to partID, so as to allocate reasonable cache resources to the running tasks to improve memory access efficiency.

[0084] The following example is used to illustrate the method for configuring the cache partitions described in one or more of the above embodiments.

[0085] This example proposes a new group management method, which uses the cgroup id in the relevant technology to map to the MPAM partID, so that the L3 cache resources in the system can be mapped to the MPAM partition according to the cgroup grouping for adjustment and dynamic allocation. Since the number of cgroup groups is limited, for example, 20, which is much smaller than the number of tasks in the system, they can be mapped to the limited MPAM partID respectively, and group-based cache resource management can be performed.

[0086] Figure 5 A flowchart of an example of an optional cache partition configuration method provided in an embodiment of the present application is shown as follows: Figure 5 As shown, the configuration method of the cache partition may include:

[0087] S501: Obtaining a group identifier of a control group;

[0088] S502: Map the group identifier to a cache partition and a monitored partition identifier;

[0089] S503: configuring cache partitions corresponding to each partition identifier;

[0090] Here, CCAP / CPBM can be used to configure the cache partition corresponding to each partID.

[0091] S504: Collect bandwidth data of the cache partitions corresponding to each partition identifier;

[0092] S505: Calculate the proportion of bandwidth data of the cache partition corresponding to each partition identifier;

[0093] S506: Determine whether the proportion of bandwidth data of the cache partitions corresponding to each partition identifier has changed compared with the proportion of bandwidth data of the cache partitions corresponding to each partition identifier collected last time. If yes, execute S507; if not, return to execute S504.

[0094] S507: configuring the capacity of the cache partition corresponding to each partition identifier according to the proportion of bandwidth data of the cache partition corresponding to each partition identifier; returning to execute S504.

[0095] Here, CCAP / CPBM may be used to configure the cache partition corresponding to each partID according to the determined capacity of the cache partition corresponding to each partID.

[0096] Specifically, at startup, the css-id (that is, the id of the corresponding group) in the cgroup_subsys_state data structure is obtained from the cgroup group data structure, and the cgroup id is mapped to the PartID of the MPAM register in the MPAM driver. Subsequently, the corresponding CPBM or CCAP is set through the PartID to configure the cache capacity or proportion that the group can use.

[0097] During the running process, the grouping task samples the mbwu of the PartID partition in real time, and calculates the sum of all group bandwidth data to obtain the proportion of each PartID in the overall cache bandwidth. Based on this proportion, CCAP / CPBM is used to set the capacity proportion of each PartID.

[0098] In addition, the mbwu of partID may change during the process, so a loop needs to be maintained and its changes need to be continuously monitored. If the mbwu changes significantly, it means that the cache bandwidth demand needs to be readjusted. Therefore, the capacity of each PartID needs to be dynamically adjusted in the loop according to the latest mbwu ratio.

[0099] It is necessary and practical to group caches by cgroup in actual cache allocation. The starting point of MPAM technology is to manage caches by partitions to avoid low-priority tasks occupying more cache resources. Figure 6 A schematic diagram of cache resources in related technologies, such as Figure 6As shown in the figure, the highest-level application tasks (top-app) and foreground tasks (foreground) in the Android system, compared with background tasks (background), top-app and foreground belong to high-priority applications (High Pri Apps), while background belongs to low-priority applications (Low Pri Apps). In theory, they should obtain more cache capacity during runtime. However, in related technologies, the cache obtained by background may be more than that of top-app and foreground, that is, low-priority applications may obtain more cache (Low Pri Apps may get more cache), which will have a negative impact on the performance of the system's foreground applications.

[0100] Figure 7 A schematic diagram of an optional mapping of cgroup grouping to MPAM partID provided in an embodiment of the present application, such as Figure 7 As shown, the css-id of the grouped task is directly obtained from the cgroup_subsys_state and mapped to the partID. Among them, the foreground group corresponds to partition0 (corresponding to 30% of the available cache capacity), the top-app group corresponds to partition1 (corresponding to 65% of the available cache capacity), and the background group corresponds to partition2 (corresponding to 5% of the available cache capacity).

[0101] It should be noted that the sampling rate of the bandwidth data of the group can be set. A higher sampling rate can reflect the bandwidth demand status of the current group in a more real-time manner. It can also change the dynamic adjustment frequency of the MPAM cache capacity. A faster adjustment frequency can allow the system cache to be adjusted faster and meet the dynamic cache bandwidth requirements of the cgroup task group in a timely manner, but it may also cause cache bandwidth fluctuations.

[0102] In this example, the main innovation is to reuse the existing cgroup grouping mechanism, and allocate and manage the system's available cache resources by mapping the cgroup ID to the MPAM's partID. This solves the problem of a large number of concurrent tasks in the system, insufficient MPAM partIDs, and difficulty in management.

[0103] Based on the cgroup grouping method, it is possible to reuse and match the existing priorities of the groups. By collecting the bandwidth data corresponding to the cgroup groups, it can be used to evaluate the cache bandwidth / quantity required by different groups, and dynamically allocate and use cache resources in a closed loop, reduce the mismatch between cache capacity and priority, and improve system memory access efficiency.

[0104] The MPAM cache adjustment technology based on cgroup grouping can meet the memory access requirements of different groups in terms of cacheline resource allocation and use. Figure 8a A schematic diagram of an optional bandwidth data provided in an embodiment of the present application, Figure 8b A schematic diagram of an optional cache capacity utilization provided in an embodiment of the present application, such as Figure 8a and Figure 8b As shown in the figure, the bandwidth data of top-app accounts for about 65%, forground accounts for about 30%, and system-server accounts for about 5%. The cache capacity corresponding to different partIDs can be dynamically allocated according to this proportion (that is, 65% of the cache capacity is allocated to the top-app group, 30% of the cache capacity is allocated to the forground, and 5% of the cache capacity is allocated to the system-server). Figure 8b A similar proportion is also reflected in the allocation of cachelines in .

[0105] An embodiment of the present application provides a method for configuring a cache partition, including: obtaining a group identifier from the structural data of a cgroup, mapping the group identifier to a cache partID, wherein the group identifier corresponds to the partID one-to-one, and utilizing a cache partition corresponding to a pre-configured partID to provide a cache function for a task corresponding to the partID, wherein the task of the partID is the task corresponding to the group identifier corresponding to the partID; that is, in an embodiment of the present application, the group identifier in the cgroup is mapped to the cache partID, so that the group identifier corresponds to the partID one-to-one, and then utilizing a cache partition corresponding to the preset partID to provide a cache function for a task corresponding to the group identifier corresponding to the partID. In this way, a cache partition is utilized to provide a cache function for the grouped tasks of the cgroup. Since the number of cache partitions is large and the number of groups of the cgroup is limited, it is possible to allocate a reasonably configured cache partition for each group of tasks, thereby improving memory access efficiency.

[0106] Based on the same inventive concept as the above-mentioned embodiment, the embodiment of the present application provides a cache partition configuration device, Fig. 9 A schematic diagram of a structure of an optional cache partition configuration device provided in an embodiment of the present application, such as Fig. 9As shown, the cache partition configuration device includes: an acquisition module 91, a mapping module 92 and a providing module 93; wherein,

[0107] An acquisition module 91 is used to acquire a group identifier from the structure data of the control group;

[0108] A mapping module 92, used to map the group identifier to the cached partition identifier; wherein the group identifier corresponds to the partition identifier one by one;

[0109] Providing module 93, used to use the cache partition corresponding to the pre-configured partition identifier to provide a cache function for the task corresponding to the partition identifier;

[0110] The task of the partition identifier is the task corresponding to the group identifier corresponding to the partition identifier.

[0111] In an optional embodiment, when the group identifier is one, the device is further configured to:

[0112] Obtain bandwidth data of the cache partition corresponding to the partition identifier;

[0113] When the bandwidth data of the cache partition corresponding to the partition identifier is greater than the bandwidth threshold configured for the cache partition corresponding to the partition identifier, reconfigure the cache partition corresponding to the partition identifier;

[0114] The cache partition corresponding to the partition identifier is used to provide a cache function for the task corresponding to the partition identifier.

[0115] In an optional embodiment, when the number of group identifiers is at least two, the device is further configured to:

[0116] Obtain bandwidth data of the cache partition corresponding to each partition identifier in the partition identifier;

[0117] When the proportion of bandwidth data of the cache partition corresponding to the first partition identifier does not fall into the proportion range of the cache partition of the pre-configured first partition identifier, the cache partition corresponding to the partition identifier is reconfigured; wherein the proportion range of the cache partition corresponding to the first partition identifier is: the preset proportion is floating up and down based on the capacity proportion of the first partition identifier;

[0118] Using the cache partition corresponding to the partition identifier to provide a cache function for the task corresponding to the partition identifier;

[0119] The first partition identifier is at least one partition identifier among the partition identifiers.

[0120] In an optional embodiment, the device obtains bandwidth data of the cache partition corresponding to the partition identifier, including:

[0121] The bandwidth data of the cache partition corresponding to the partition identifier is collected at a preset time interval.

[0122] In an optional embodiment, the device obtains bandwidth data of the cache partition corresponding to the partition identifier, including:

[0123] When bandwidth data of cache partitions corresponding to a preset number of partition identifiers are collected, the collected bandwidth data of cache partitions corresponding to the preset number of partition identifiers are processed to obtain bandwidth data of cache partitions corresponding to the partition identifiers.

[0124] In an optional embodiment, the device reconfigures the cache partition corresponding to the partition identifier, including:

[0125] Re-determine the proportion of the capacity of the cache partition of each partition identifier according to the proportion of the bandwidth data of the cache partition corresponding to each partition identifier in the partition identifier;

[0126] According to the proportion of the capacity of the cache partition of each partition identifier, the capacity of the cache partition corresponding to each partition identifier is re-determined.

[0127] In an optional embodiment, the proportion of the capacity of the cache partition corresponding to each partition identifier is equal to the proportion of bandwidth data of the cache partition corresponding to each partition identifier.

[0128] In practical applications, the acquisition module 91, mapping module 92 and providing module 93 can be implemented by a processor located on a configuration device of a cache partition, specifically a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP) or a field programmable gate array (FPGA).

[0129] Fig.10 A schematic diagram of the structure of an optional computer device provided in an embodiment of the present application, such as Fig.10 As shown, an embodiment of the present application provides a computer device 1000, including:

[0130] A processor 101 and a storage medium 102 storing instructions executable by the processor; the storage medium 102 relies on the processor 101 to perform operations through a communication bus 103, and when the instructions are executed by the processor, the cache partition configuration method executed by the processor side in one or more of the above embodiments is executed.

[0131] It should be noted that, in actual application, the various components in the computer device are coupled together via the communication bus 103. It is understandable that the communication bus 103 is used to realize the connection and communication between these components. In addition to the data bus, the communication bus 103 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Fig.10 Various buses are labeled as communication buses 103.

[0132] An embodiment of the present application provides a computer storage medium storing executable instructions. When the executable instructions are executed by one or more processors, the processors execute the cache partition configuration method described in one or more of the above embodiments.

[0133] Among them, the computer-readable storage medium can be a ferromagnetic random access memory (FRAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM) and other memories.

[0134] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of hardware embodiments, software embodiments, or embodiments in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) that contain computer-usable program code.

[0135] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0136] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0137] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0138] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application.

Claims

1. A method for configuring a cache partition, characterized in that: include: Get the group identifier from the structure data of the control group; Mapping the group identifier to a cached partition identifier; wherein the group identifier corresponds to the partition identifier one by one; Using the pre-configured cache partition corresponding to the partition identifier to provide a cache function for the task corresponding to the partition identifier; The task of the partition identifier is a task corresponding to the group identifier corresponding to the partition identifier.

2. The method according to claim 1, characterized in that When the group identifier is one, the method further includes: Obtaining bandwidth data of the cache partition corresponding to the partition identifier; When the bandwidth data of the cache partition corresponding to the partition identifier is greater than the bandwidth threshold configured for the cache partition corresponding to the partition identifier, reconfigure the cache partition corresponding to the partition identifier; The cache partition corresponding to the partition identifier is used to provide a cache function for the task corresponding to the partition identifier.

3. The method according to claim 1, characterized in that: When the number of group identifiers is at least two, the method further includes: Obtain bandwidth data of the cache partition corresponding to each partition identifier in the partition identifiers; When the proportion of bandwidth data of the cache partition corresponding to the first partition identifier does not fall within the pre-configured proportion range of the cache partition of the first partition identifier, reconfigure the cache partition corresponding to the partition identifier; wherein the proportion range of the cache partition corresponding to the first partition identifier is: a preset proportion floating up and down based on the capacity proportion of the first partition identifier; Using the cache partition corresponding to the partition identifier to provide a cache function for the task corresponding to the partition identifier; The first partition identifier is at least one partition identifier among the partition identifiers.

4. The method according to claim 2 or 3, characterized in that: The obtaining bandwidth data of the cache partition corresponding to the partition identifier includes: The bandwidth data of the cache partition corresponding to the partition identifier is collected at a preset time interval.

5. The method according to claim 2 or 3, characterized in that: The obtaining bandwidth data of the cache partition corresponding to the partition identifier includes: When bandwidth data of cache partitions corresponding to a preset number of partition identifiers are collected, the collected bandwidth data of cache partitions corresponding to the preset number of partition identifiers are processed to obtain bandwidth data of cache partitions corresponding to the partition identifiers.

6. The method according to claim 3, characterized in that The reconfiguring the cache partition corresponding to the partition identifier includes: Re-determining the proportion of the capacity of the cache partition of each partition identifier according to the proportion of the bandwidth data of the cache partition corresponding to each partition identifier in the partition identifier; The capacity of the cache partition corresponding to each partition identifier is re-determined according to the proportion of the capacity of the cache partition of each partition identifier.

7. The method according to claim 6, characterized in that The proportion of the capacity of the cache partition corresponding to each partition identifier is equal to the proportion of bandwidth data of the cache partition corresponding to each partition identifier.

8. A cache partition configuration device, characterized in that: include: An acquisition module, used for acquiring a group identifier from the structural data of the control group; A mapping module, used to map the group identifier to a cached partition identifier; wherein the group identifier corresponds to the partition identifier one by one; Providing a module for providing a cache function for a task corresponding to the partition identifier by using a pre-configured cache partition corresponding to the partition identifier; The task of the partition identifier is a task corresponding to the group identifier corresponding to the partition identifier.

9. An electronic device, characterized in that: include: A processor and a storage medium storing instructions executable by the processor; The storage medium relies on the processor to perform operations through a communication bus, and when the instruction is executed by the processor, the cache partition configuration method described in any one of claims 1 to 7 is executed.

10. A computer storage medium, characterized in that: Executable instructions are stored, and when the executable instructions are executed by one or more processors, the processors execute the cache partition configuration method described in any one of claims 1 to 7.