Cache resource use control method and electronic equipment

By employing a method that considers both object and memory space identifiers for cache resource allocation, the solution addresses inefficiencies in existing cache management, enhancing utilization and efficiency.

CN119201775AActive Publication Date: 2024-12-27SMARTER SILICON (SHANGHAI) TECH CO LTD

Patent Information

Application Number
CN202411708748.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-26
Publication Date
2024-12-27
Estimated Expiration
2044-11-26

AI Technical Summary

Technical Problem

Existing cache resource management methods fail to efficiently allocate resources due to blind partitioning by hardware module or process type, leading to ineffective use and reduced efficiency.

Method used

A method that determines a resource allocation strategy based on both a first partition identifier of a target object and a second partition identifier related to a memory space address, allowing for fine-grained management of cache resources by considering different access requirements of the same object at different times.

Benefits of technology

Enhances cache resource utilization by providing tailored allocation strategies for varying access scenarios, reducing waste and improving efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201775A_ABST
    Figure CN119201775A_ABST
Patent Text Reader

Abstract

The invention discloses a cache resource use control method and electronic equipment, and relates to the technical field of resource control, and the method comprises the steps: obtaining an access request initiated by a target object in the electronic equipment; in response to the access request meeting a first condition, determining a first partition identifier of the target object and a second partition identifier corresponding to a physical address to be accessed by the access request, the second partition identifier being related to memory space addresses including the physical address; determining a resource allocation strategy based on the first partition identifier and the second partition identifier; according to a resource allocation strategy, allocating a corresponding cache space to the target object; and caching associated data required for processing the access request in the cache space.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of resource control, and in particular to a method and electronic device for controlling the use of cache resources. Background Art

[0002] Hardware modules and processes such as processors and embedded controllers in electronic devices need to share various cache resources including cache devices such as memory in electronic devices. Based on this, various hardware modules and processes will compete for cache resources, which will affect the bandwidth and performance of hardware modules and processes accessing cache space, and affect cache access efficiency.

[0003] In order to reduce the problems of reduced cache access efficiency caused by blind resource competition, cache resources can be managed by partition according to the type of hardware module or process. However, even the same hardware module or the same process may have different requirements for cache resources at different times, so partition management by hardware module or process type still cannot reasonably use cache resources, resulting in ineffective use of cache resources. Summary of the invention

[0004] On the one hand, the present application provides a method for controlling the use of cache resources, including:

[0005] Obtaining an access request initiated by a target object in an electronic device;

[0006] In response to the access request satisfying the first condition, determining a first partition identifier of the target object and a second partition identifier corresponding to a physical address to be accessed by the access request, wherein the second partition identifier is related to a memory space address including the physical address;

[0007] Determine a resource allocation strategy based on the first partition identifier and the second partition identifier;

[0008] Allocate corresponding cache space for the target object according to the resource allocation strategy;

[0009] The associated data required for processing the access request is cached in the cache space.

[0010] In a possible implementation manner, determining a resource allocation strategy based on the first partition identifier and the second partition identifier includes:

[0011] Integrate the first partition identifier and the second partition identifier into a third partition identifier;

[0012] Determine a resource allocation strategy corresponding to the third partition identifier.

[0013] In yet another possible implementation, the access request includes a target virtual address of the storage space to be accessed;

[0014] The determining the first partition identifier of the target object and the second partition identifier corresponding to the physical address to be accessed by the access request includes:

[0015] Determine, according to the partition identifiers corresponding to different objects, a first partition identifier corresponding to the target object;

[0016] Based on the target virtual address, an address mapping relationship group is obtained to obtain a second partition identifier recorded in the address mapping relationship group, wherein the address mapping relationship group includes at least a mapping relationship between the target virtual address and the physical address, and the second partition identifier is used to identify a section of memory space represented by each physical address in the address mapping relationship group.

[0017] In yet another possible implementation, determining a resource allocation strategy based on the first partition identifier and the second partition identifier includes:

[0018] Determining a first resource allocation strategy corresponding to the first cache memory based on the first partition identifier and the second partition identifier;

[0019] The allocating corresponding cache space to the target object according to the resource allocation strategy includes:

[0020] Allocating corresponding cache space for the target object in a first cache memory according to the first resource allocation strategy;

[0021] The caching of the associated data required for processing the access request in the cache space includes:

[0022] The address mapping relationship group is cached in the cache space.

[0023] In yet another possible implementation, the access request satisfies the first condition including: according to the target virtual address, the associated data required for processing the access request cannot be found in the first cache memory;

[0024] The method for controlling the use of cache resources also includes: in response to the access request satisfying the second condition, obtaining the associated data required to process the access request from the cache space corresponding to the target object, and the cache space is allocated based on the resource allocation strategy corresponding to the first partition identifier and the second partition identifier of the target object.

[0025] In yet another possible implementation, determining a resource allocation strategy based on the first partition identifier and the second partition identifier includes:

[0026] Determine a second resource allocation strategy corresponding to the second cache memory based on the first partition identifier and the second partition identifier;

[0027] The allocating corresponding cache space to the target object according to the resource allocation strategy includes:

[0028] Allocating corresponding cache space for the target object in the second cache memory according to the second resource allocation strategy;

[0029] The caching of the associated data required for processing the access request in the cache space includes:

[0030] The data content to be operated on by the access request is cached in the cache space.

[0031] In yet another possible implementation, determining the first partition identifier of the target object and the second partition identifier corresponding to the physical address to be accessed by the access request includes:

[0032] Obtain a first partition identifier and a second partition identifier of the target object carried in the access request, wherein the first partition identifier and the second partition identifier are determined by a memory management unit, and the second partition identifier is determined by the memory management unit based on a physical address mapped to a target virtual address in the access request, wherein the memory management unit includes a first cache memory.

[0033] In yet another possible implementation, caching the data content to be operated on the access request in the cache space includes:

[0034] If the access request is a read request, obtaining first data to be read by the read request from an internal memory of the electronic device, and caching the first data in the cache space;

[0035] and / or,

[0036] If the access request is a write request, second data to be operated by the write request is cached in the cache space.

[0037] In another aspect, the present application also provides an electronic device, comprising:

[0038] A cache module and a policy control module in communication with the cache module;

[0039] The cache module is used to obtain an access request initiated by a target object in the electronic device; in response to the access request satisfying a first condition, determine a first partition identifier of the target object and a second partition identifier corresponding to a physical address to be accessed by the access request, wherein the second partition identifier is related to a memory space address including the physical address;

[0040] The policy control module is used to determine a resource allocation policy based on the first partition identifier and the second partition identifier;

[0041] The cache module is further used to allocate a corresponding cache space for the target object according to the resource allocation strategy; and cache the associated data required for processing the access request in the cache space.

[0042] In a possible implementation, the policy control module includes: a logic unit and a policy management unit;

[0043] The logic unit is used to integrate the first partition identifier and the second partition identifier into a third partition identifier;

[0044] The policy management unit is used to store at least one preset candidate resource allocation policy, and determine the resource allocation policy corresponding to the third partition identifier from the at least one candidate resource allocation policy. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0046] Figure 1 A flowchart of a method for controlling the use of cache resources provided in this application;

[0047] Figure 2 A schematic diagram of another flow chart of the method for controlling the use of cache resources provided in this application;

[0048] Figure 3 An example diagram of an implementation framework for determining a resource allocation strategy for a memory management unit in this application;

[0049] Figure 4 An example diagram of an implementation for determining a resource control strategy for a memory management unit and allocating cache space for a target object;

[0050] Figure 5 A schematic diagram of another flow chart of the method for controlling the use of cache resources provided in this application;

[0051] Figure 6 A schematic diagram of an implementation framework in which an access request initiated by a target object in this application is transmitted to an SLC storage module via a memory management unit, and the SLC storage module performs resource partition management based on the access request;

[0052] Figure 7 A schematic diagram of a composition structure of an electronic device provided in this application;

[0053] Figure 8 This is another schematic diagram of the composition structure of the electronic device provided in this application. DETAILED DESCRIPTION

[0054] The embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation mode of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application. It is known to those skilled in the art that with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0055] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0056] like Figure 1 , showing a flow chart of a method for controlling the use of cache resources provided in an embodiment of the present application, the method of this embodiment can be applied to an electronic device with a cache memory. Among them, the cache memory can have many possibilities, and there is no restriction on this. For example, the cache memory can be a cache memory in a system level cache (System level cache, SLC) storage module. For another example, the cache memory can be a translation lookaside buffer (Translation Lookaside Buffer, TLB) module in a memory management unit (Memory management unit, MMU). Of course, the cache memory can also have other possibilities, and there is no restriction on this. When the cache resources of the cache memory are used by multiple objects, it is necessary to reasonably allocate resources to improve the utilization efficiency.

[0057] The method of this embodiment may include:

[0058] S101, obtaining an access request initiated by a target object in an electronic device.

[0059] The target object may be an application or process running in the electronic device; or may be various hardware modules in the electronic device that can initiate access requests, such as a processor, an embedded controller, a display module, or an image processing module.

[0060] The access request may be a read request, a write request, or a request related to cache resources, and the specific request type and form are not limited.

[0061] S102: In response to an access request satisfying a first condition, determining a first partition identifier of a target object and a second partition identifier corresponding to a physical address to be accessed by the access request.

[0062] In the present application, the access request satisfies the first condition as a trigger condition for caching the associated data required for processing the access request in the cache memory. Based on this, the access request satisfies the first condition as follows: the associated data required for processing the access request cannot be found in the cache memory.

[0063] Among them, the first partition identifier of the target object is used to uniquely identify the target object. The first partition identifier is also an initial identifier used to identify the resource allocation strategy applicable to the target object under the premise of partition management of the cache resources of the cache memory. For example, the control unit corresponding to the cache memory can be pre-configured with partition identifiers corresponding to different objects, based on which, the first partition identifier corresponding to the target object can be determined according to the partition identifiers corresponding to different objects. For another example, the control unit corresponding to the cache memory can be configured with a generation strategy for generating a partition identifier corresponding to an object, and a first partition identifier is generated for the target object based on the generation strategy.

[0064] In the present application, the second partition identifier is related to the memory space address including the physical address to be accessed by the access request. For example, the second partition identifier may be a unique identifier pre-assigned to the memory space address, or an identifier generated based on the memory space address, without limitation.

[0065] The physical address to be accessed by the access request is the physical address corresponding to the memory storage space to be accessed by the access request.

[0066] Among them, the memory space address including the physical address to be accessed by the access request is an address segment, that is, an address segment corresponding to a memory space. The size of the memory space corresponding to the memory space address can be set according to actual needs and there is no restriction on this.

[0067] S103: Determine a resource allocation strategy based on the first partition identifier and the second partition identifier.

[0068] Unlike determining the resource allocation strategy based only on the unique partition identifier of the target object, the present application will comprehensively determine the resource allocation strategy based on the first partition identifier of the target object and the second partition identifier related to the memory space address of the physical address to be accessed by the access request. Therefore, if the physical addresses to be accessed by different access requests initiated from the same target object belong to different memory space addresses, the determined resource allocation strategy will also be different.

[0069] Based on this, it can be seen that in this application, actually for the same target object, different resource allocation strategies are further subdivided according to the memory space address to which the physical address accessed by the access request initiated by the target object belongs, thereby realizing partition management of cache resources for the same target object according to address segments, and realizing more fine-grained resource partition management.

[0070] It is understandable that if the partition management of cache resources is performed only based on the first partition identifier of the target object, then the target object corresponds to only one resource allocation strategy. However, the access requests initiated by the same process or hardware module at different times have different requirements for the use of cache resources. If the cache resources are allocated according to the same resource allocation strategy, the limited cache resources may not be used efficiently.

[0071] However, in this application, taking into account the different scenarios in which the target object initiates access requests, the memory space addresses of the data usually accessed are also different, and the required resource allocation strategies will also be different. For the same target object, multiple address segments (i.e., different memory space addresses) can be configured with their own corresponding resource allocation strategies. Different resource allocation strategies are matched according to the memory space address and the size of the memory space corresponding to the memory space address to meet the needs of different access scenarios.

[0072] For example, assuming that five address segments are configured with corresponding resource allocation strategies for the target object, and assuming that the target object may initiate 100 access requests, then these 100 access requests will also correspond to these five address segments, that is, corresponding to five different resource allocation strategies, so that the resource allocation strategy can be configured more reasonably according to the access requirements, and naturally, the cache resources can be allocated more reasonably.

[0073] In the present application, there are many specific implementations for determining the resource allocation strategy. For example, resource allocation strategies corresponding to different combinations of first partition identifiers and second partition identifiers can be pre-configured, and on this basis, after the first partition identifier and the second partition identifier are determined, the resource allocation strategy corresponding to the first partition identifier and the second partition identifier can be queried.

[0074] For another example, the first partition identifier and the second partition identifier may be integrated into a third partition identifier to determine the resource allocation strategy corresponding to the third partition identifier. For example, based on the candidate resource allocation strategies corresponding to different configured partition identifiers, the resource allocation strategy corresponding to the third partition identifier is queried.

[0075] The third partition identifier may be obtained by integrating the first partition identifier and the second partition identifier into the third partition identifier. For example, the first partition identifier and the second partition identifier are combined according to the rule that the first partition identifier is in front and the second partition identifier is in the back.

[0076] The third partition identifier can also be obtained by performing a logical operation on the first partition identifier and the second partition identifier. Of course, there are other ways to obtain the third partition identifier, which are not limited.

[0077] S104: Allocate corresponding cache space for the target object according to the resource allocation strategy.

[0078] The cache space belongs to the storage space in the cache memory.

[0079] In the present application, the resource allocation strategy includes at least the size of the cache space that can be allocated, and may also include other cache resource features such as the available bandwidth of the cache space. Based on this, the cache space allocated to the target object is the same as the size of the space configured in the resource allocation strategy, and the features such as the available bandwidth corresponding to the cache space also match the relevant features configured in the resource allocation strategy.

[0080] In the present application, the resource allocation strategy can be set according to actual needs and is not limited thereto.

[0081] For example, in a possible implementation, the resource allocation strategy may be pre-configured. For each object that can initiate an access request, based on each memory space address that may belong to the physical address accessed by the access request initiated by the object, combined with one or more of the information such as the type of the object, the space size and starting address corresponding to the memory space address, and the requirement type of the access request to access the memory space address, determine the resource allocation strategy corresponding to the object and the memory space address.

[0082] Among them, since each object is uniquely identified by a corresponding first partition identifier, and each memory space address is identified by a corresponding second partition identifier, the resource allocation policy corresponding to the object and the memory space address is the resource allocation policy corresponding to the first partition identifier of the object and the second partition identifier of the memory space address.

[0083] For example:

[0084] If, based on the type of data resources pointed to by certain physical addresses accessed by the object, it is determined that the accesses corresponding to these physical addresses are generally single accesses or single continuous address accesses, then it means that after receiving an access request to the physical address, the probability of receiving another access request to access these physical addresses is very small, and naturally there is no need to allocate too much cache space in the cache memory to store the data required to process the access request. On this basis, when configuring the resource allocation strategy based on the object and the memory space addresses corresponding to these physical addresses, the size of the cache space that can be allocated can be configured to be relatively small, or even zero.

[0085] Correspondingly, if it is determined that the object has a high access frequency to the physical addresses included in certain memory space addresses, then in the resource allocation policy corresponding to the object and the memory space address, the allocatable cache space may be configured to be relatively large.

[0086] If some access requests initiated by an object are not sensitive to access latency and bandwidth, then even if the associated data required to process the access request is not cached in the cache memory, the processing effect of the access request will not be affected. In this case, for the object, when configuring the resource allocation strategy for the memory space addresses corresponding to these access requests, the size of the cache space can be configured to be zero, or the allocatable cache space can be configured to be relatively small and the configured access bandwidth can be relatively low.

[0087] Accordingly, if some access requests initiated by an object are sensitive to access latency or bandwidth, then for the object, when configuring a resource allocation strategy for the memory space addresses corresponding to these access requests, a relatively large cache space and a relatively high access bandwidth may be configured.

[0088] It should be noted that for the same target object, the access requests initiated by the target object are different, and the memory space address of the physical address required to be accessed by the access request and the access requirements of the access request will be different. Therefore, combined with the access requirements of the target object and the access requests initiated by it, the cache space size and bandwidth that can be allocated in the resource allocation strategy corresponding to the different address segments configured for the target object may also be different. The specific settings can be based on actual needs and are not restricted.

[0089] As can be seen from the previous introduction, the size of the cache space that can be allocated in the resource allocation strategy can be 0. In this case, based on the resource allocation strategy, the cache space allocated to the target object is zero, that is, there is no need to allocate cache space for the target object, and naturally there is no need to perform the subsequent step S105 to cache the associated data.

[0090] S105, cache the associated data required for processing the access request in the cache space.

[0091] The associated data required for processing the access request may be data required to be acquired in order to execute the processing of the access request and needs to be cached in the cache memory.

[0092] For example, the associated data may be address mapping information required for address mapping of an access request. In this case, the address mapping information may be cached in a cache space of a TLB module in a memory management unit.

[0093] For another example, the associated data may be data content that needs to be accessed or operated by the access request. In this case, the data content may be cached in the cache space of the SLC storage module.

[0094] Of course, there are other possibilities for linked data without limiting this.

[0095] From the above content, it can be seen that in this application, in response to the access request initiated by the target object satisfying the first condition, this application will not only determine the first partition identifier of the target object, but also determine the second partition identifier based on the physical address to be accessed by the access request, and determine the resource allocation strategy based on the first partition identifier and the second partition identifier. Since the second partition identifier is related to the memory space address including the physical address to be accessed by the access request, if the physical addresses to be accessed by different access requests initiated by the target object belong to different memory space addresses, the determined resource allocation strategy will also be different, realizing that for the same target object, different resource allocation strategies are further subdivided according to different memory space addresses, so that the partition management of cache resources can be more fine-grained in combination with the access requirements of the target object, and naturally, cache resources can be allocated more reasonably and the waste of cache resources can be reduced.

[0096] It is understandable that the solution of the present application can be applied to cache resource management of various cache memories in electronic devices. When the cache memories are different, the specific implementation of determining the resource allocation strategy and caching the associated data corresponding to the access request in the cache memory will also be different. The following is an introduction in combination with several possible situations.

[0097] In the first possible case, the access request obtained may include the target virtual address corresponding to the storage space to be accessed. In this case, the determination of the first partition identifier corresponding to the target object can refer to the above related introduction, which will not be repeated. Determining the second partition identifier may include: based on the target virtual address, obtaining the address mapping relationship group, and obtaining the second partition identifier recorded in the address mapping relationship group.

[0098] The address mapping relationship group may include at least one mapping relationship, each mapping relationship including a virtual address and a physical address corresponding to each other, wherein the address mapping relationship group includes at least a mapping relationship between the target virtual address and the physical address.

[0099] In the present application, a partition identifier is added to each address mapping relationship group. Based on this, after obtaining the address mapping relationship group containing the target virtual address, the partition identifier recorded in the address mapping relationship group can be obtained. For the sake of distinction, the partition identifier in the address mapping relationship group is called the second partition identifier. The second partition identifier in the address mapping relationship group is the second partition identifier corresponding to the physical address to be accessed by the access request.

[0100] The second partition identifier is used to identify a section of memory space represented by each physical address in the address mapping relationship group, that is, to identify the address of the memory space including the physical address to be accessed by the access request.

[0101] Wherein, obtaining the address mapping relationship group may be obtaining the address mapping relationship group from the internal memory of the electronic device. For example, if it is necessary to obtain the address mapping relationship using the first cache module where the first cache memory is located, and the cache memory storing the associated data (i.e., the cache memory that needs to perform cache resource partition management) may be the first cache memory or a second cache memory other than the first cache memory, then as long as the address mapping relationship group is not stored in the first cache memory, it is necessary to obtain the address mapping relationship from the internal memory of the electronic device.

[0102] Obtaining the address mapping relationship group can also be obtaining the address mapping relationship group cached in the first cache memory. For example, in the case where the first cache memory stores the address mapping relationship group corresponding to the target virtual address, if it is necessary to perform partition management on the cache resources of the second cache memory, then it is necessary to obtain the address mapping relationship group cached in the first cache memory to obtain the second partition identifier in the address mapping relationship group, and then determine the resource allocation strategy suitable for allocating cache space for the target object from the second cache memory based on the second partition identifier and the first partition identifier of the target object.

[0103] The internal memory of the electronic device may be a double data rate (DDR) dynamic synchronous random access memory (DDR memory for short), or may be other memory storages, which are not limited.

[0104] In the first possible case, the access request meeting the first condition may include: according to the target virtual address, the associated data required for processing the access request cannot be found in the first cache memory.

[0105] In the following example, determining that the first partition identifier and the second partition identifier and allocating cache space to the target object are both executed by the first cache module where the first cache memory is located is combined with Figure 2 , taking the possible situation where the associated data is an address mapping relationship group as an example. In the present application, the first cache module where the cache memory is located may include a first control unit in addition to the first cache memory. For example, the first cache memory may be a cache memory in a memory management unit, then the first cache module where the first cache memory is located belongs to the memory management unit, and the first cache module may include a control unit in the memory management unit and the first cache memory, for example, the first cache memory may be a TLB module.

[0106] like Figure 2 , shows another implementation flow diagram of the cache resource usage control method provided in an embodiment of the present application. The method of this embodiment may include:

[0107] S201, obtaining an access request initiated by a target object in an electronic device.

[0108] The access request includes a target virtual address corresponding to a storage space to be accessed, and the storage space is the storage space pointed to by the physical address to be accessed by the access request, and the storage space belongs to a memory storage space.

[0109] S202: If the address mapping relationship group corresponding to the target virtual address cannot be found in the first cache memory, determine the first partition identifier corresponding to the target object according to the partition identifiers corresponding to different objects.

[0110] For example, first partition identifiers corresponding to different objects are configured in a configuration space identifiable by a first control unit corresponding to the first cache memory, and on this basis, the first control unit can determine the first partition identifier corresponding to the target object from the configured first partition identifier. For example, if the first cache memory is a TLB module in a memory management unit, the first partition identifiers of different objects can be configured in a configuration space identifiable by the memory management unit, and the control unit of the memory management unit can query the first partition identifier of the target object from the configuration space.

[0111] For ease of understanding, this embodiment is described by taking a case where the access request satisfies the first condition as an example; however, the other cases mentioned above are also applicable to this embodiment and are not limited thereto.

[0112] S203: Based on the target virtual address, obtain an address mapping relationship group from an internal memory of the electronic device to obtain a second partition identifier recorded in the address mapping relationship group.

[0113] The address mapping relationship group at least includes a mapping relationship between a target virtual address and a physical address, and the second partition identifier is used to identify a section of memory space represented by each physical address in the address mapping relationship group.

[0114] It is understandable that in the present application, only the address mapping relationship group corresponding to the target virtual address can be obtained. In order to enable the corresponding address mapping relationship group to be found from the first cache memory after receiving an access request subsequently, thereby reducing the number of accesses to the internal memory of the electronic device, the present application may also include obtaining multiple groups of mapping relationship groups including the address mapping relationship group corresponding to the target virtual object. For example, the multiple groups of mapping relationship groups may include the address mapping relationship group corresponding to the target virtual object, and at least one address mapping relationship group adjacent to the address mapping relationship group corresponding to the target virtual address.

[0115] S204: Determine a first resource allocation strategy corresponding to the first cache memory based on the first partition identifier and the second partition identifier.

[0116] The first resource allocation strategy is a resource allocation strategy for allocating cache resources in the first cache memory determined based on the first partition identifier and the second partition identifier.

[0117] For example, the first partition identifier and the second partition identifier are integrated into a third partition identifier, and the resource allocation policy corresponding to the third partition identifier is determined as the first resource allocation policy corresponding to the first cache memory.

[0118] It is understandable that the objects that can initiate access requests in the electronic device are limited, and the number of memory space addresses (i.e., address segments) that can be divided is also limited. Therefore, the third partition identifiers that we can configure are also limited. Based on this, the resource allocation strategy corresponding to each third partition identifier can be determined in advance according to information such as the type of each object and the access requirement characteristics of each memory space address, and the resource allocation strategy corresponding to each third partition identifier can be configured in the first control unit corresponding to the first cache memory.

[0119] For example, if the first cache memory is a TLB module in a memory management unit, the memory management unit may configure a resource allocation strategy corresponding to each third partition identifier in a memory system resource partitioning and monitoring management (MPAM) control unit.

[0120] S205: Allocate corresponding cache space for the target object in the first cache memory according to the first resource allocation strategy.

[0121] For ease of understanding, the first cache memory is taken as a cache memory in the memory management unit as an example:

[0122] The memory management unit may be an input / output memory management unit (IOMMU) or other types of memory management units, and there is no limitation on this.

[0123] The first cache memory of the memory management unit can be a TLB module for storing address mapping relationships. After the memory management unit obtains an access request initiated by the target object, the memory management unit (such as a control unit in the memory management unit) queries whether an address mapping relationship group containing the target virtual address is cached in the TLB module based on the target virtual address carried in the access request. If the address mapping relationship group corresponding to the target virtual address does not exist in the TLB, the memory management unit will obtain the address mapping relationship group corresponding to the target virtual address from an internal memory such as a DDR memory of the electronic device, and obtain the second partition identifier recorded in the address mapping relationship group.

[0124] For example, in the internal memory of an electronic device, a page table can be used to store mapping relationships between different virtual addresses and physical addresses. Each page table may include at least one page table descriptor, and each page table descriptor may store at least one set of mapping relationships between virtual addresses and physical addresses. Therefore, each page table descriptor may be regarded as an address mapping relationship group. In the present application, a second partition identifier may be added to the page table descriptor. For example, a page-based hardware attribute (PBHA) value may be recorded in the page table descriptor. The PBHA values ​​in different page table descriptors are different. Then, the PBHA value may be used as the second partition identifier.

[0125] like Figure 3 A diagram showing an implementation example of a memory management unit determining a resource allocation strategy.

[0126] exist Figure 3 In the example of the internal memory of the electronic device being a DDR memory, it can be seen that there are multiple page tables cached in the DDR memory, each of which includes multiple page table descriptors, such as Figure 3 , each line in the page table is a page table descriptor. Figure 3 It can be seen that each page table descriptor records at least one mapping relationship between a virtual address and a physical address. Moreover, each page table descriptor is filled with a PBHA value. Of course, other information may also be recorded in the page table descriptor, which is not limited.

[0127] Depend on Figure 3It can be seen that the memory management unit can be pre-configured with multiple object partition identifiers (PartIDs), and the Part ID of the object is also the first partition identifier of the object. After the memory management unit obtains the access request initiated by the target object, the Part ID of the target object can be queried.

[0128] exist Figure 3 In the example, the page table descriptor corresponding to the target virtual address carried by the access request does not exist in the TLB module. Based on this, the memory management unit will obtain at least the page table descriptor corresponding to the target virtual address from the DDR memory of the electronic device, so as to obtain the PBHA value recorded in the page table descriptor.

[0129] On this basis, the memory management unit can integrate the Part ID of the target object and the PBHA value in the page table descriptor corresponding to the target virtual address into a final partition identifier, that is, a third partition identifier.

[0130] Depend on Figure 3 It can also be seen that for each object that may initiate an access request and the memory space address corresponding to each page table descriptor, the memory management unit can determine the resource allocation strategy corresponding to the Part ID of different objects and different PBHA values ​​through the policy evaluation unit. Since the Part ID of different objects and different PBHA values ​​will correspond to different third partition identifiers, the memory management unit will determine the resource allocation strategy corresponding to different third partition identifiers through the policy evaluation unit.

[0131] Among them, the policy evaluation unit can determine the resource allocation policy corresponding to the object and the PBHA value in the corresponding page table descriptor in advance based on one or more of the information such as the starting address, space size and possible access mode of the memory space corresponding to the page table descriptor.

[0132] For example, for each object, determine the memory space address to which the physical address that the object may access belongs, and combine the memory space size corresponding to the memory space address to determine the number of cache blocks in the TLB module that the object needs to occupy under the premise that the object can reliably access the memory space and effectively avoid TLB refresh, so that for the third partition identifier corresponding to the PartID of the object and the PBHA value corresponding to the memory space address, configure the corresponding number of cache blocks as the available cache resources corresponding to the third partition identifier into the resource allocation strategy. Among them, the size of each cache block divided in the TLB module can be set according to actual needs, for example, the size of each cache block is the same as the size of the space required to be occupied by a page table descriptor.

[0133] For another example, for each object, if the access request that can be initiated by the object for a certain memory space address is only a single access, then when configuring the resource allocation strategy for the third partition identifier corresponding to the object and the memory space address, the number of cache blocks that can be allocated in the TLB module can be configured to be zero or relatively small in the resource allocation strategy.

[0134] For example, for each object, if the access request initiated by the object to a certain memory space address is more sensitive to access delay and bandwidth, the resource allocation strategy corresponding to the corresponding third partition identifier can be configured to have a relatively large number of cache blocks in the allocatable TLB module and a larger access bandwidth.

[0135] For the sake of distinction, the pre-configured resource allocation strategies may be referred to as candidate resource allocation strategies. Based on this, the memory management unit may query the resource allocation strategy corresponding to the currently determined third partition identifier based on at least one configured candidate resource allocation strategy.

[0136] It is understandable that there are many ways to implement that the memory management unit can integrate the Part ID of the target object and the PBHA value in the page table descriptor into the third partition identifier. In one possible implementation, the memory management unit can also include a logic unit and a policy management unit, and the memory management unit can integrate the Part ID of the target object and the corresponding PBHA value into the third partition identifier with the help of the logic unit. Figure 4 An example diagram of an implementation of determining a resource control strategy and allocating cache space to a target object in a memory management unit is shown.

[0137] Depend on Figure 4 As can be seen in FIG, a policy start switch 401 is provided in the logic unit of the memory management unit. The policy start switch 401 can be used to control whether the logic unit performs resource partition management on the TLB module based only on the first partition identifier of the target object, or performs resource partition management on the TLB module based on the first partition identifier of the target object and the second partition identifier corresponding to the access request.

[0138] If the policy activation switch is turned on, it means that the resource partition management of the TLB module needs to be performed based on the first partition identifier of the target object and the second partition identifier corresponding to the access request. On this basis, the logic unit obtains the partition identifier (Part ID) of the target object and the second partition identifier 1 ( Figure 4 After that, the logical unit will integrate the Part ID and the second partition identifier 1 into the third partition identifier 1.

[0139] At the same time, in order to facilitate understanding of the identification integration operations performed by the logical unit for different access requests, Figure 4 It also shows that the logic unit obtains the Part ID of the target object and the second partition identifier 2 ( Figure 4 In this case, the logic unit integrates the PartID of the target object and the second partition identifier 2 into the third partition identifier 2. However, it can be understood that Figure 4 The two logical units can be the same.

[0140] For example, the first partition of the target object occupies at most bits, and taking the PBHA value corresponding to the access request occupying 4 bits as an example, the operation performed by the logic unit can be expressed by the following formula:

[0141]

[0142] in, Indicates the identification integration result output by the logic unit. , indicating that it is not enabled, that is, the first partition identifier and the second partition identifier are not integrated, so that only the first partition identifier determines the resource allocation strategy; It indicates enabling, that is, it is necessary to integrate a third partition identifier based on the first partition identifier and the second partition identifier, so as to determine a resource allocation strategy based on the third partition identifier.

[0143] It is an integer greater than 1, and the specific value can be set according to actual needs.

[0144] In the above formula, Indicates the first partition identifier, which can also be considered as the partition identifier of the target object. Indicates that the first partition mark (from 0 to bits) left shifted by 4 bits. Indicates that the PBHA value is 4 bits of data, that is, the PBHA value occupies 4 bits from the 0th bit to the 3rd bit. It means that the first partition identifier is shifted left by four bits, and the PBHA value is added to the end of the first partition identifier to obtain the third partition identifier.

[0145] Of course, the above is an example of the PBHA value occupying four bits, but the present application does not limit the number of bits occupied by the PBHA value. For example, in actual applications, in order to achieve more fine-grained partition management, the number of bits occupied by the PBHA value can also be increased.

[0146] After the memory management unit integrates the third partition identifier through the logic unit, the resource allocation policy corresponding to the third partition identifier can be queried from the policy management unit. Figure 4 It can be seen that different third partition identifiers correspond to different resource allocation strategies. Correspondingly, the number of cache blocks allocated from the TLB based on different resource allocation strategies is also different. Figure 4 The white and gray bars in the figure represent the cache blocks allocated based on two different resource allocation strategies.

[0147] In some embodiments, based on an ARM (Advanced RISC Machine) architecture, the policy management unit may implement storage and query of resource allocation policies corresponding to each third partition identifier based on an MPAM control unit.

[0148] S206, cache the address mapping relationship group in the cache space.

[0149] For example, still taking the first cache memory as the memory management unit as an example, since the size of the allocatable cache space and resource characteristics such as bandwidth can be set in the first resource allocation strategy, the memory management unit determines the number of cache blocks that need to be allocated to the target object in the TLB module and the access bandwidth of the cache blocks based on the first resource allocation strategy, and thus caches the address mapping relationship group in the allocated cache blocks according to the access bandwidth corresponding to the cache blocks.

[0150] It is understandable that if multiple address mapping relationship groups (such as page table descriptors) are obtained from an internal memory such as DDR, and the cache space allocated based on the first resource allocation strategy is insufficient to store all of the multiple address mapping relationship groups, then only some of the multiple address mapping relationship groups need to be stored.

[0151] It can be understood that in the embodiment corresponding to the first possible situation above, the present application can also obtain the associated data required to process the access request from the cache space corresponding to the target object in response to the access request satisfying the second condition.

[0152] When the access request satisfies the second condition, the cache space corresponding to the target object is allocated based on the resource allocation strategy corresponding to the first partition identifier and the second partition identifier of the target object. The specific implementation method of obtaining the cache space corresponding to the target object can refer to the above related introduction, which will not be repeated here.

[0153] The access request satisfies the second condition that the associated data required for processing the access request exists in the cache memory.

[0154] For example, when the first partition identifier and the second partition identifier are determined by the first cache memory, and cache space is allocated for the target object, the access request may satisfy the second condition that there is an address mapping relationship group corresponding to the target virtual address in the first cache memory. In this case, in response to the access request satisfying the second condition, the address mapping relationship group corresponding to the target virtual address may be obtained from the cache space allocated by the first cache memory for the target object, so that the access request may be processed by address mapping based on the physical address corresponding to the target virtual address in the address mapping relationship group, and the details will not be repeated.

[0155] It should be noted that the above is explained by taking the address mapping relationship group corresponding to the target virtual address as an example of the associated data required for processing the access request. However, if the first cache module where the first cache memory is located only determines the first partition identifier and the second partition identifier, and the resource allocation strategy corresponding to the second cache memory is determined by the second cache module where the second cache memory is located, then after the second cache module determines the cache space in the second cache memory that needs to be allocated to the target object, the data content to be operated on the access request can also be cached in the cache space.

[0156] The following introduces a second possible implementation manner of determining a resource allocation strategy and caching associated data corresponding to the access request.

[0157] In a second possible implementation, the present application may be that the second cache module where the second cache memory is located obtains an access request initiated by the target object, and the second cache module may include a second cache memory and a second control unit. For example, the second cache memory may belong to an SLC storage module, then the second cache module where the second cache memory is located may include an SLC memory and a control unit in the SLC storage module, and accordingly, the second cache memory may be an SLC memory. Of course, the second cache memory may also belong to other cache modules, without limitation.

[0158] Accordingly, based on the first partition identifier and the second partition identifier, a second resource allocation strategy for allocating cache resources to the target object by the second cache memory can be determined, and corresponding cache space is allocated to the target object in the second cache memory according to the second resource allocation strategy.

[0159] The second cache memory is different from the first cache memory, so the associated data required to process the access request that needs to be stored in the second cache memory will also be different. In one implementation, a cache space allocated to the target object in the second cache memory can be determined, and the data content to be operated on the access request can be cached in the cache space.

[0160] It is understandable that the access request in the electronic device needs to be processed by the memory management unit for address mapping before it is sent to the cache memory in other cache modules. Based on this, taking the first cache memory as the cache memory in the memory management unit and taking an implementation method as an example, the process of determining the resource allocation strategy and caching the data content to be operated on the cache module where the second cache memory is located is introduced.

[0161] like Figure 5 , shows another flow chart of the method for controlling the use of cache resources provided by the present application. The method of this embodiment may include:

[0162] S501: Obtain an access request initiated by a target object in an electronic device.

[0163] In this embodiment, the access request initiated by the target object can be obtained by the second cache module where the second cache memory is located, and the access request can be transmitted to the second cache module by the memory management unit where the first cache memory is located. Before the memory management unit transmits the access request to the second cache module, the memory management unit can Figure 2 The operation of the related embodiment determines a first partition identifier of the target object and a second partition identifier corresponding to the target virtual address in the access request.

[0164] Based on this, the access request may carry the first partition identifier and the second partition identifier.

[0165] Of course, the memory management unit can also map the target virtual address in the access request to a physical address. Therefore, the access request obtained by the second cache module also carries the physical address corresponding to the target virtual address.

[0166] S502: In response to an access request satisfying a first condition, obtaining a first partition identifier and a second partition identifier of a target object carried in the access request.

[0167] As described above, the first partition identifier and the second partition identifier are determined by the memory management unit, and the second partition identifier is determined by the memory management unit based on the physical address to which the target virtual address in the access request is mapped.

[0168] In a possible implementation, the access request satisfies the first condition including: the data content to be operated by the access request cannot be found in the second cache memory. For example, if the access request is a read request, the access request satisfies the first condition including: the first data requested to be read by the read request cannot be found in the second cache memory; if the access request is a write request, the access request satisfies the first condition including: the second data to be operated by the write request cannot be found in the second cache memory. Wherein, the write request can be used to request to modify data, delete data or write data, therefore, the second data to be operated by the write request can be the data to be modified, deleted or written by the write request.

[0169] S503: Determine a second resource allocation strategy corresponding to the second cache memory based on the first partition identifier and the second partition identifier.

[0170] The second resource allocation strategy is a resource allocation strategy determined based on the first partition identifier and the second partition identifier and required to be adopted for allocating cache resources in the second cache memory.

[0171] For example, the first partition identifier and the second partition identifier are integrated into a third partition identifier, and based on the correspondence between different partition identifiers configured in the second cache module and candidate resource allocation strategies, the resource allocation strategy corresponding to the third partition identifier is determined as the second resource allocation strategy.

[0172] S504: Allocate corresponding cache space for the target object in the second cache memory according to the second resource allocation strategy.

[0173] Similar to the previous embodiment, the second resource allocation strategy can specify the size of the allocatable cache space and the available bandwidth, etc. Accordingly, based on the second resource allocation strategy, the cache space in the second cache memory that needs to be allocated to the target object can be determined, and the cache resource characteristics such as the bandwidth of the cache space also match the second resource allocation strategy.

[0174] S505: Cache the data content to be operated on by the access request in the cache space.

[0175] For example, if the access request is a read request, first data to be read by the read request is obtained from the internal memory of the electronic device, and the first data is cached in the cache space. And / or, if the access request is a write request, second data to be operated by the write request is cached in the cache space.

[0176] It is understandable that, in an embodiment, in response to the access request satisfying the second condition, the present application may also process the data content in the cache space allocated to the target object in the second cache memory based on the access request. The access request satisfies the second condition when the second cache memory contains the data content to be operated by the access request.

[0177] For example, if the access request is a read request, the first data to be read by the read request can be obtained from the cache space allocated to the target object in the second cache memory; if the access request is a write request, a write operation is performed on the second data cached in the cache space in the second cache memory based on the write request.

[0178] For ease of understanding, the first cache memory is a TLB module in a memory management unit, and the second cache memory is an SLC memory in an SLC storage module. For ease of description and understanding, the first partition identifier is still used as the Part ID of the target object, and the second partition identifier is used as the PBHA value corresponding to the physical address to be accessed by the access request. Figure 6 , shows an access request initiated by a target object being transmitted to an SLC storage module via a memory management unit, and a schematic diagram of an implementation framework of resource partition management performed by the SLC storage module based on the access request.

[0179] exist Figure 6 In the example, after the memory management unit obtains the access request initiated by the target object, if the page table descriptor corresponding to the target virtual address in the access request does not exist in the TLB module of the memory management unit, the memory management unit can follow the previous Figure 3 and Figure 4 The relevant introduction of the memory management unit obtains the page table descriptor from the DDR memory and caches the page table descriptor in the TLB module. The details are not repeated here. In this case, after obtaining the page table descriptor, the memory management unit can definitely determine the Part ID of the target object and the PBHA value in the page table descriptor. The memory management unit will transmit the access request carrying the Part ID of the target object and the PBHA value to the SLC storage module.

[0180] If the TLB module of the memory management unit caches the page table descriptor corresponding to the target virtual address in the access request, the memory management unit does not need to obtain the page table descriptor from the DDR memory of the electronic device, and naturally does not involve determining the resource allocation strategy corresponding to the Part ID and the PBHA value and the operation of caching the page table description in the TLB module. In this case, the memory management unit can directly determine the Part ID of the target device, query the PBHA value from the page table descriptor, and then transmit the access request carrying the Part ID of the target object and the PBHA value to the SLC storage module.

[0181] On the basis of the above, Figure 6It can be seen that the SLC storage module can integrate the Part ID of the target object carried in the access request and the PBHA value through the logical unit in the SLC storage module to obtain the third partition identifier of the target object. The operations performed by the logical unit in the SLC storage module are similar to those performed by the logical unit in the memory management unit. For details, please refer to the previous Figure 4 The relevant introduction will not be repeated here.

[0182] certainly, Figure 6 Taking the example of setting a logic unit in the SLC storage module, in actual application, a logic unit connected to the SLC storage module may be first set outside the SLC storage module, and the logic unit transmits the integrated third partition identifier to the SLC storage module.

[0183] After the third partition identifier of the target object is obtained through integration of the logic unit corresponding to the SLC storage module, the SLC storage module can query the resource allocation policy corresponding to the third partition identifier from its corresponding policy management unit. Similar to the previous memory management unit, the policy management unit in the SLC storage module can also be an MPAM control unit.

[0184] It is understandable that the resource allocation policy corresponding to the third partition identifier in the policy management unit of the SLC storage module is different from the resource allocation policy configured for the third partition identifier in the previous memory management unit.

[0185] Among them, in the SLC storage module, the resource allocation strategy corresponding to the Part ID of the target object and the PBHA value can be determined in advance based on one or more of the information such as the starting address, space size and possible access mode of the memory space corresponding to the page table descriptor where the PBHA value is located.

[0186] For example, for each object, determine the memory space address to which the physical address that the object may access belongs, and combine the size of the memory space corresponding to the memory space address to determine how much storage space in the SLC memory is needed to allocate to the object to meet the object's access requirements to the memory space corresponding to the memory space address, and configure the corresponding size of allocatable storage space in the resource allocation policy.

[0187] For another example, if an access request initiated by an object to a certain memory space address is not sensitive to access delay and bandwidth, based on the third partition identifier corresponding to the object and the memory space address, in the policy management unit of the SLC storage module, when configuring a resource allocation policy for the third partition identifier corresponding to the object and the memory space address, less storage space can be configured in the resource allocation policy, and even the storage space to be allocated in the SLC memory can be configured to be zero.

[0188] In another aspect, the present application also provides an electronic device. Figure 7 , showing a schematic diagram of the composition structure of an electronic device provided by the present application.

[0189] Depend on Figure 7 It can be seen that the electronic device includes: a cache module 71 and a policy control module 72 that is in communication connection with the cache module 71;

[0190] The cache module 71 is used to obtain an access request initiated by a target object in the electronic device; in response to the access request satisfying a first condition, determine a first partition identifier of the target object and a second partition identifier corresponding to a physical address to be accessed by the access request, wherein the second partition address segment identifier is related to a memory space address including the physical address;

[0191] The policy control module 72 is used to determine a resource allocation policy based on the first partition identifier and the second partition identifier;

[0192] The cache module 71 is further configured to allocate a corresponding cache space to the target object according to the resource allocation strategy; and cache associated data required for processing the access request in the cache space.

[0193] In a possible implementation, the cache module may include a control unit and a cache memory for storing data. Figure 8 , showing another schematic diagram of the composition structure of the electronic device provided in an embodiment of the present application.

[0194] exist Figure 8 The cache module 71 may include a control unit 711 and a cache memory 712 that are communicatively connected, and the control unit 711 also has a communicatively connected relationship with the policy control module 72 .

[0195] On this basis, the control unit 711 is used to obtain an access request initiated by a target object in the electronic device; in response to the access request satisfying a first condition, determine a first partition identifier of the target object and a second partition identifier corresponding to a physical address to be accessed by the access request; and allocate corresponding cache space to the target object according to the resource allocation strategy.

[0196] Accordingly, the cache memory 712 is used to cache the associated data required to process the access request in the cache space.

[0197] For example, the electronic device includes a memory management unit, which includes the cache module and the policy control module, and the control unit and the cache memory in the cache module are respectively the control unit and the TLB module in the memory management unit.

[0198] For another example, the electronic device includes an SLC storage module, the SLC storage module includes the cache module and the policy control module, and the control unit and the memory in the cache module are respectively the control unit and the SLC memory in the SLC storage module.

[0199] Further, in any of the above embodiments of the electronic device, the policy control module may include a logic unit and a policy management unit.

[0200] by Figure 8 For example, in Figure 8 The policy control module 72 includes: a logic unit 721 and a policy management unit 722 .

[0201] The logic unit 721 is used to integrate the first partition identifier and the second partition identifier into a third partition identifier.

[0202] The policy management unit 722 is configured to store at least one preset candidate resource allocation policy, and determine a resource allocation policy corresponding to the third partition identifier from the at least one candidate resource allocation policy.

[0203] In any of the above electronic device embodiments, the access request obtained by the cache module includes a target virtual address of the storage space to be accessed;

[0204] Accordingly, when the cache module determines the first partition identifier of the target object and the second partition identifier corresponding to the physical address to be accessed by the access request, specifically:

[0205] Determine, according to the partition identifiers corresponding to different objects, a first partition identifier corresponding to the target object;

[0206] Based on the target virtual address, an address mapping relationship group is obtained to obtain a second partition identifier recorded in the address mapping relationship group, wherein the address mapping relationship group includes at least a mapping relationship between the target virtual address and the physical address, and the second partition identifier is used to identify a section of memory space represented by each physical address in the address mapping relationship group.

[0207] Further, the cache module includes a first control unit and a first cache memory having a communication connection;

[0208] The policy control module includes a first policy control module, and the first policy control module is in communication connection with the first control unit.

[0209] Among them, the first control unit is used to obtain an access request initiated by a target object in the electronic device; in response to the access request satisfying the first condition, determine the first partition identifier corresponding to the target object according to the partition identifiers corresponding to different objects; based on the target virtual address, obtain the address mapping relationship group to obtain the second partition identifier recorded in the address mapping relationship group.

[0210] The first policy control module is used to determine a first resource allocation policy corresponding to the first cache memory based on the first partition identifier and the second partition identifier.

[0211] The first control unit is further configured to allocate corresponding cache space for the target object in the first cache memory according to the first resource allocation strategy.

[0212] The first cache memory is used to cache the address mapping relationship group in the cache space.

[0213] In yet another possible implementation, the access request satisfies the first condition including: according to the target virtual address, the associated data required for processing the access request cannot be found in the first cache memory;

[0214] The first control unit is also used to, in response to the access request satisfying the second condition, obtain the associated data required to process the access request from the cache space corresponding to the target object, and the cache space is allocated based on the resource allocation policy corresponding to the first partition identifier and the second partition identifier of the target object.

[0215] In another possible implementation, the cache module includes a second control unit and a second cache memory that are communicatively connected. The policy control module includes a second policy control module that is communicatively connected to the second control module.

[0216] The second control unit is used to obtain an access request initiated by a target object in the electronic device; in response to the access request satisfying a first condition, determine a first partition identifier of the target object and a second partition identifier corresponding to a physical address to be accessed by the access request;

[0217] The second policy control module is used to determine a second resource allocation policy corresponding to the second cache memory based on the first partition identifier and the second partition identifier;

[0218] The second control unit is further configured to allocate a corresponding cache space for the target object in the second cache memory according to the second resource allocation strategy;

[0219] The second cache memory is used to cache the data content to be operated on by the access request in the cache space.

[0220] In another possible implementation, when determining the first partition identifier of the target object and the second partition identifier corresponding to the physical address to be accessed by the access request, the second control unit is specifically used to: obtain the first partition identifier and the second partition identifier of the target object carried in the access request, the first partition identifier and the second partition identifier are determined by a memory management unit, and the second partition identifier is determined by the memory management unit based on the physical address mapped to the target virtual address in the access request, wherein the memory management unit includes a first cache memory.

[0221] In another possible implementation, when the second cache memory caches the data content of the access request to be operated in the cache space, it is specifically used to: if the access request is a read request, obtain the first data to be read by the read request from the internal memory of the electronic device, and cache the first data in the cache space; and / or, if the access request is a write request, cache the second data to be operated by the write request in the cache space.

[0222] A computer program product is also provided in an embodiment of the present application, including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any cache resource usage control method provided in an embodiment of the present application.

[0223] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any cache resource usage control method provided in an embodiment of the present application.

[0224] It should also be noted that the device embodiments described above are merely schematic, wherein the units described 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 they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.

[0225] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0226] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0227] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.

Claims

1. A method for controlling the use of cache resources, comprising: Obtaining an access request initiated by a target object in an electronic device; In response to the access request satisfying the first condition, determining a first partition identifier of the target object and a second partition identifier corresponding to a physical address to be accessed by the access request, wherein the second partition identifier is related to a memory space address including the physical address; Determine a resource allocation strategy based on the first partition identifier and the second partition identifier; Allocate corresponding cache space for the target object according to the resource allocation strategy; The associated data required for processing the access request is cached in the cache space.

2. The method for controlling the use of cache resources according to claim 1, wherein determining the resource allocation strategy based on the first partition identifier and the second partition identifier comprises: Integrate the first partition identifier and the second partition identifier into a third partition identifier; Determine a resource allocation strategy corresponding to the third partition identifier.

3. According to the method for controlling the use of cache resources as claimed in claim 1, the access request includes a target virtual address of the storage space to be accessed; The determining the first partition identifier of the target object and the second partition identifier corresponding to the physical address to be accessed by the access request includes: Determine, according to the partition identifiers corresponding to different objects, a first partition identifier corresponding to the target object; Based on the target virtual address, an address mapping relationship group is obtained to obtain a second partition identifier recorded in the address mapping relationship group, wherein the address mapping relationship group includes at least a mapping relationship between the target virtual address and the physical address, and the second partition identifier is used to identify a section of memory space represented by each physical address in the address mapping relationship group.

4. The method for controlling the use of cache resources according to claim 3, wherein determining the resource allocation strategy based on the first partition identifier and the second partition identifier comprises: Determining a first resource allocation strategy corresponding to the first cache memory based on the first partition identifier and the second partition identifier; The allocating corresponding cache space to the target object according to the resource allocation strategy includes: Allocating corresponding cache space for the target object in the first cache memory according to the first resource allocation strategy; The caching of the associated data required for processing the access request in the cache space includes: The address mapping relationship group is cached in the cache space.

5. The method for controlling the use of cache resources according to claim 3 or 4, wherein the access request satisfies the first condition comprising: According to the target virtual address, the associated data required for processing the access request cannot be found from the first cache memory; The method for controlling the use of cache resources also includes: in response to the access request satisfying a second condition, obtaining associated data required to process the access request from the cache space corresponding to the target object, the cache space being allocated based on a resource allocation strategy corresponding to a first partition identifier and a second partition identifier of the target object.

6. The method for controlling the use of cache resources according to claim 1, wherein determining the resource allocation strategy based on the first partition identifier and the second partition identifier comprises: Determine a second resource allocation strategy corresponding to the second cache memory based on the first partition identifier and the second partition identifier; The allocating corresponding cache space to the target object according to the resource allocation strategy includes: Allocating corresponding cache space for the target object in the second cache memory according to the second resource allocation strategy; The caching of the associated data required for processing the access request in the cache space includes: The data content to be operated on by the access request is cached in the cache space.

7. The method for controlling the use of cache resources according to claim 6, wherein the determining the first partition identifier of the target object and the second partition identifier corresponding to the physical address to be accessed by the access request comprises: Obtain a first partition identifier and a second partition identifier of the target object carried in the access request, wherein the first partition identifier and the second partition identifier are determined by a memory management unit, and the second partition identifier is determined by the memory management unit based on a physical address mapped to a target virtual address in the access request, wherein the memory management unit includes a first cache memory.

8. The method for controlling the use of cache resources according to claim 6, wherein the step of caching the data content to be operated by the access request in the cache space comprises: If the access request is a read request, obtaining first data to be read by the read request from an internal memory of the electronic device, and caching the first data in the cache space; and / or, If the access request is a write request, second data to be operated by the write request is cached in the cache space.

9. An electronic device, comprising: A cache module and a policy control module in communication with the cache module; The cache module is used to obtain an access request initiated by a target object in the electronic device; in response to the access request satisfying a first condition, determine a first partition identifier of the target object and a second partition identifier corresponding to a physical address to be accessed by the access request, wherein the second partition identifier is related to a memory space address including the physical address; The policy control module is used to determine a resource allocation policy based on the first partition identifier and the second partition identifier; The cache module is further used to allocate a corresponding cache space for the target object according to the resource allocation strategy; and cache the associated data required for processing the access request in the cache space.

10. The electronic device according to claim 9, wherein the policy control module comprises: Logical units and policy management units; The logic unit is used to integrate the first partition identifier and the second partition identifier into a third partition identifier; The policy management unit is used to store at least one preset candidate resource allocation policy, and determine the resource allocation policy corresponding to the third partition identifier from the at least one candidate resource allocation policy.

Citation Information

Patent Citations

  • File access method and apparatus, and storage system

    CN105580010A

  • Resource access method applied to computer and computer

    CN107783913A

  • Mapping partition identifiers

    CN115407931A

  • Storage space access method and device, equipment and storage medium

    CN116680210A

  • Partition identifier space selection

    CN117120988A

Cited By

  • Translation lookaside buffer, management method of translation lookaside buffer, computing device and system

    CN122527050A

  • Translation lookaside buffer and management method thereof, computing device and system

    CN122527050B