Method, device and electronic equipment for managing rmda memory region context cache
By optimizing MRCT cache management through the RRIP algorithm and utilizing the dynamic update mechanism of RRPV values, the problems of low efficiency and low hit rate in RDMA cache management are solved, thereby improving the access performance of RDMA memory regions.
Patent Information
- Application Number
- CN202411116802.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-14
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2044-08-14
AI Technical Summary
In existing RDMA technologies, the MRCT cache management scheme is inefficient and has a low hit rate during virtual-to-physical address translation, which cannot effectively improve the performance of RDMA, especially when performing operations such as quickly creating and binding memory windows.
The Reference Interval Prediction (RRIP) algorithm is used to optimize MRCT cache management. Through the dynamic update mechanism of RRPV value, the replacement strategy of cache unit is distinguished according to MRCT access type, thereby improving cache hit rate and replacement efficiency.
It achieves precision and flexibility in MRCT cache management, improves access efficiency and hit probability of RDMA memory regions, and optimizes the utilization of cache resources.
Smart Images

Figure CN118860909B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of computers, and particularly relates to a management method and device for RMDA memory region context cache and electronic equipment. BACKGROUND
[0002] RDMA (Remote Direct Memory Access) is a remote direct memory access technology, which can directly read data from a local memory by an RDMA network card without copying through a local CPU and a peer CPU, and send and write the data into a memory of the peer.
[0003] In some related RDMA-related technologies, only the key information of MRCT, i.e., access permission verification information, is extracted and cached on a cache of a network card, and a virtual-real address conversion relationship is not stored, but a large physical page (2 MB or more) is stored, and the physical address of the physical page and the corresponding virtual address and length are stored. Although these schemes simplify the size of MRCT required for virtual-real address conversion on-chip, store more number of MRCT in the same on-chip cache space, and increase the hit rate to a certain extent, the following disadvantages still exist:
[0004] 1) The simplified MRCT can only be used for virtual-real address conversion when a packet is received and sent, and cannot help performance improvement for other MRCT operations of RDMA, such as fast creation, binding of a memory window, local / remote invalidation, and the like, which need to access complete MRCT functions.
[0005] 2) The simplified MRCT does not store the virtual-real address conversion relationship, and only saves the address of a large physical page, so that when the MRCT is accessed, even if the cache is hit, the memory range to be accessed may not be in the large physical page, and in this case, the complete MRCT still needs to be accessed through a system bus and converted through the virtual-real address conversion relationship in the MRCT.
[0006] Based on the above analysis, the application provides a management method and device for RMDA memory region context cache and electronic equipment. SUMMARY
[0007] The application aims to provide a management method and device for RMDA memory region context cache and electronic equipment, which can solve the problems of low RDMA access efficiency and low hit rate in related technologies.
[0008] According to a first aspect of the application, a management method for RMDA memory region context cache is provided, which comprises:
[0009] receiving an MRCT access request, performing a cache lookup based on the MRCT access request, and obtaining an MRCT lookup result;
[0010] updating an RRPV value according to the MRCT lookup result;
[0011] obtaining a target MRCT corresponding to the MRCT access request, and returning the target MRCT to a request source.
[0012] In an optional implementation, the updating of the RRPV value according to the MRCT lookup result comprises:
[0013] In a case where the MRCT corresponding to the MR_Index is found in the cache, the MRCT lookup result is successful, and a first update of the RRPV value is performed according to a first request type of the MRCT access request; or
[0014] In a case where the MRCT corresponding to the MR_Index is not found in the cache, the MRCT lookup result is failed, and a second update of the RRPV value is performed according to a second request type of the MRCT access request.
[0015] In an optional implementation, in a case where the first request type is VA2PA, a bound memory window, a query of the MRCT or the MR_KEY, the first update of the RRPV value is updating a corresponding RRPV value to 0; in a case where the first request type is a destruction of the MR, a deallocation of the MR_KEY, or a local / remote invalidation, the first update of the RRPV value is updating a corresponding RRPV value to 3.
[0016] In an optional implementation, the determining of the MRCT replacement address comprises: traversing the cache and determining an address corresponding to an MRCT with a maximum RRPV value as the MRCT replacement address, and if there are multiple MRCTs with the same RRPV value, selecting an address corresponding to an MRCT with the maximum RRPV value that appears for the first time as the MRCT replacement address.
[0017] In an optional implementation, in a case where the second request type is a registration of the MR, the second update of the RRPV value is updating a corresponding RRPV value to 1; in a case where the second request type is the VA2PA, the bound memory window, the query of the MRCT or the MR_KEY, the second update of the RRPV value is updating a corresponding RRPV value to 2.
[0018] In an optional implementation, after the second update of the RRPV value according to the second request type of the MRCT access request, the method further comprises:
[0019] initiating a DMA read request to a system bus, obtaining a requested target MRCT from a host memory, and writing the obtained target MRCT to the MRCT replacement address.
[0020] In optional embodiments, the method further comprises:
[0021] dynamically traversing all of the RRPV values, and in a case where all of the RRPV values are less than 3, adding 1 to all of the RRPV values;
[0022] The RRPV values include 0, 1, 2, and 3.
[0023] According to a second aspect of the present application, a management apparatus for an RMDA memory region context cache is provided, comprising:
[0024] an MRCT lookup module configured to receive an MRCT access request, perform a lookup on the cache based on the MRCT access request, and obtain an MRCT lookup result;
[0025] an RRPV management module configured to update an RRPV value according to the MRCT lookup result;
[0026] a cache read-write control module configured to obtain a target MRCT corresponding to the MRCT access request, and return the target MRCT to a request source.
[0027] In optional embodiments, the updating of the RRPV value according to the MRCT lookup result comprises:
[0028] in a case where the MRCT corresponding to MR_Index is found in the cache, the MRCT lookup result is successful, and a first update is performed on the RRPV value according to a first request type of the MRCT access request; or
[0029] in a case where the MRCT corresponding to MR_Index is not found in the cache, the MRCT lookup result is failed, a MRCT replacement address is determined, and a second update is performed on the RRPV value according to a second request type of the MRCT access request.
[0030] A third aspect of the present application provides an electronic device comprising a processor and a memory, wherein the memory stores a computer program, and the processor is configured to invoke the computer program to cause the electronic device to execute the method of the first aspect.
[0031] Compared with the related art, the technical solution of the present application at least has the following advantages:
[0032] The RMDA memory region context cache management method, device and electronic equipment provided by the embodiment of the application optimize and improve the management of the MRCT cache based on the RRIP replacement algorithm, accurately judge the cache unit, make the management of the RMDA memory region more accurate and flexible, and effectively improve the replacement efficiency and hit probability of the cache region.
[0033] Other features and advantages of the present application will be set forth in the following description, and in part will be apparent from the description, or can be learned by practice of the present application. The objects and other advantages of the present application can be realized and obtained by the structure and process indicated in the specification and drawings. BRIEF DESCRIPTION OF DRAWINGS
[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related art, the drawings needed to be used in the embodiment or related art description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and those skilled in the art can also obtain other drawings according to these drawings without creative labor.
[0035] Figure 1 It is a flowchart of the RMDA memory region context cache management method according to the exemplary embodiment of the present application.
[0036] Figure 2 It is a schematic diagram of the RRPV update process according to the exemplary embodiment of the present application.
[0037] Figure 3 It is a schematic diagram of the RMDA memory region context cache management device according to the exemplary embodiment of the present application. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical scheme and advantages of the embodiments of the present application more clear, the technical scheme 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. Obviously, the described embodiments are some embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0039] The present application involves some professional terms, and the related professional terms involved in the present application will be explained as follows:
[0040] 1) RDMA (Remote Direct Memory Access): Remote Direct Memory Access; a high-performance network communication technology that reads and writes remote memory by bypassing the complex TCP / IP network protocol stack of traditional Ethernet;
[0041] 2) IB (Infiniband): a protocol that implements RDMA technology;
[0042] 3) MR (Memory Region): a special memory space planned by the RDMA software layer in the memory, used for storing the data received and sent by the RDMA network card;
[0043] 4) MRCT (Memory Region Context Table): used for recording the access permission, address range, etc. of each MR, and used for accessing the address conversion table when performing virtual-real address conversion;
[0044] 5) MW (Memory Window): a subset of the MR, containing a part of the memory address range of the MR, and the access permission thereof can be extended compared with the MR;
[0045] 6) L_KEY: local memory region key, used for accessing the local memory region at the local end;
[0046] 7) R_KEY: remote memory region key, used for accessing the local memory region at the opposite end (or the local end holds it to access the memory region at the opposite end);
[0047] 8) PBL (Physical Buffer List): physical buffer table, the content of each PBL Entry is the first address of a physical page, and these PBL Entries are stored continuously to form the PBL table:
[0048] 9) Cache: cache of the data structure on the chip, which can reduce the access time of the chip to the host memory;
[0049] 10) LRU (Least Recently Used): records the last access time of each unit in the Cache, and when the Cache needs to be replaced, the unit with the earliest last access time is replaced first;
[0050] 11) RRIP (Re-reference Interval Prediction): a Cache replacement algorithm;
[0051] 12) RRPV (Re-Reference Prediction Value): reuse prediction value, indicating the probability that each Cache address is most likely to be used in the RRIP algorithm, and the smaller the RRPV value is, the greater the recent use probability is;
[0052] 13) VA2PA: Virtual Address to Physical Address translation.
[0053] RDMA can not pass through the kernel state of CPU, directly initiated by the application process access, so as to ensure the safety of data, avoid malicious access, in the IB protocol (Infiniband, the protocol to realize the technology of RDMA) is specified that the memory region MR concept, for RDMA access to the memory address range and access rights, but also facilitate the RDMA network card to give the virtual address of the application process conversion physical address.
[0054] In order to record the above-mentioned MR access permissions, address range, virtual-real address conversion relationship and other contents, in the implementation of RDMA network card, it is necessary to allocate a corresponding MRCT for each MR. Each MR has a 24-bit index number MR_Index and 8-bit key KEY, which are spliced into an L_KEY or R_KEY.
[0055] Host in the delivery of RDMA command, by specifying L_KEY / R_KEY, start virtual address and address length, tell the RDMA network card packet and packet need to access the memory. RDMA network card in processing the above-mentioned packet, packet command, first to read the memory region corresponding to the context MRCT, MRCT is used to access permissions and address boundary check, and then through the virtual-real address corresponding relationship in MRCT, to address the physical page table PBL. In some RDMA network card, for the physical page is large enough, do not need to access PBL, can get the physical address directly, but still must read MRCT to carry out access permission check, to ensure the safety of data. Therefore, reading MRCT is in the performance critical path of RDMA packet.
[0056] In addition, in the RDMA work, also need to create, destroy, allocate, deallocate, fast create, bind memory window, local / remote invalidation operation of MRCT, the execution time of these operations also affect the performance of RDMA.
[0057] Because the number of MRCT is usually very large, the maximum number supported by IB protocol is 2 24 (16M), the size of each MRCT is usually 64Byte, can not be stored on-chip, therefore can only be saved in the host memory. In order to save the access time of MRCT, avoid the delay caused by system bus access, a part of MRCT is cached in the SRAM on the network card chip in the related RDMA network card product.
[0058] However, the on-chip cache resource is limited, and in continuous multiple different MRCT access requests, when one of the MRCTs misses the on-chip cache, the subsequent MRCT access delay will increase due to the requirement of maintaining order.
[0059] Therefore, in combination with the use scenario of MRCT, reasonably and efficiently implementing the management of MRCT cache on hardware, maximizing the hit rate of MRCT cache, and reasonably utilizing the limited on-chip SRAM resource help to improve the performance of RDMA.
[0060] In the related art, the design scheme of MRCT cache mostly adopts the LRU type replacement algorithm. Although this method seems to reasonably manage the MRCT cache, it may need to record the timestamp of each Cache unit for comparison during replacement, which occupies a large amount of hardware resources, or adopts a simplified LRU method, which saves hardware resources but cannot better implement the reasonable management of Cache. Most importantly, the Cache is managed in the same way every time MRCT is accessed without considering the difference in the influence of MRCT access type on the subsequent possible use probability of the MRCT in the Cache.
[0061] Based on the above analysis, the technical scheme involved in the present application learns from the method of reference interval prediction algorithm RRIP, and optimizes and improves the design based on several use scenarios of MRCT of RDMA network card.
[0062] The various non-limiting embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0063] The core idea of the management of the RMDA memory area context cache of the present application will be described below through a specific example:
[0064] The RRIP strategy uses M bits in each cache block to store the reuse prediction value (RRPV) of the block, and the RRPV value dynamically changes with the frequency of each recent data access. For example, if the value of M is set to 2, the RRPV value equal to 0 indicates that the cache block has been frequently called recently, and it is predicted that the user will access the cache block again soon; the RRPV value equal to 3 indicates that the cache block has not been accessed recently, and it will not be accessed again in a short time; and the RRPV value equal to 1 or 2 indicates that the cache block will have a high probability of being accessed. When the initial cache is empty, the RRPV value of each cache block is set to 3, and when writing is needed in the cache, the first cache address with RRPV = 3 is found from left to right for replacement, and after replacement, the RRPV value is updated to 2. If the cache unit with an RRPV value less than or equal to 2 is hit again, the RRPV value is updated to 0. When all the RRPV values of all cache addresses are flushed to non-3 values, all the RRPV values of all cache addresses are incremented by 1, and the cache address with RRPV = 3 is found for replacement.
[0065] As can be seen from the description of the above RRIP strategy, the RRIP algorithm with M = 2 sets the probability of each cache unit being accessed again to four levels of 0, 1, 2, and 3, which correspond to the most likely to be accessed and the least likely to be accessed in turn. The cache unit with a smaller RRPV value will not be kicked out of the cache immediately even if it has not been accessed in the last round.
[0066] Based on this idea, the application introduces the access type of MRCT as a dimension to determine the update mode of the RRPV value in the traditional RRIP algorithm. For different MRCT access types, the likelihood of subsequent MRCT access is different. After adding the access type dimension to the RRPV value update, the next replaceable address can be found more reasonably and efficiently, which is beneficial to improving the hit rate of subsequent MRCT access.
[0067] Exemplarily, with reference to Figure 1 The management method of the RMDA memory region context cache provided by the embodiment of the application is described in detail. The application provides a management method of an RMDA memory region context cache, which comprises:
[0068] S1, receiving an MRCT access request, searching the cache based on the MRCT access request, and obtaining an MRCT search result;
[0069] S2, updating the RRPV value according to the MRCT search result;
[0070] S3, obtaining the target MRCT corresponding to the MRCT access request, and returning the target MRCT to the request source.
[0071] In some embodiments, the MRCT access request includes MR_Index.
[0072] The method for managing the RMDA memory region context cache according to the embodiments of the present application, the RRPV value is updated according to the MRCT lookup result, comprising:
[0073] In the case of finding the MRCT corresponding to MR_Index in the cache, the MRCT lookup result is successful, and the RRPV value is updated according to the first request type of the MRCT access request; or,
[0074] In the case of not finding the MRCT corresponding to MR_Index in the cache, the MRCT lookup result is failed, and the RRPV value is updated according to the second request type of the MRCT access request.
[0075] Exemplarily, referring to Figure 2 , the RRPV update process is described by a specific example provided by the embodiments of the present application:
[0076] Firstly, the MRCT lookup module receives the MRCT access request of other modules on the network card, the request can be a read request or a rewrite request, and the accessed MRCT is found in the cache according to MR_Index in the MRCT access request.
[0077] If the cache is hit, the RRPV value of the hit address is updated according to the request type of the MRCT access request, the hit address is transmitted to the cache read-write control module, the MRCT stored in the cache is read out, and the MRCT is returned to the request source.
[0078] If the cache is not hit, a replaceable address (and MRCT replacement address) is found by the RRPV value management module; the RRPV value is updated according to the request type of the MRCT access request by the MRCT lookup module, and the MRCT lookup module initiates a DMA read request to the system bus to read the accessed MRCT from the host memory. After the MRCT is read from the host side, it is written into the determined replaceable address by the cache read-write control module, and the MRCT is returned to the request source.
[0079] In the above steps, the access request types of the MRCT include virtual-to-physical address conversion requests initiated by the virtual-to-physical address conversion module of the network card and registration, destruction, allocation, deallocation, fast registration, binding memory window, local / remote invalidation requests initiated by the host, and the descriptions of the above requests and the RRPV updating manner can refer to the example in Table 1.
[0080] Table 1
[0081]
[0082]
[0083] Those skilled in the art can know that the above-described examples are only examples, and other access request types and corresponding updating manners known to those skilled in the art can also be applied herein; for example, the RRPV can be changed to M = 3, that is, the updating value of the RRPV is 0-7, or based on the same idea of the present application, some updating values are changed from 0 to 1 or from 1 to 0, or the replacement value is changed to 1 when performing VA2PA access, and no specific limitation is made to this.
[0084] The management method of the RMDA memory region context cache of the specific embodiment of the present application updates the RRPV value to 0 in the case of the first request type being VA2PA, binding memory window, querying MRCT or MR_KEY; and updates the RRPV value to 3 in the case of the first request type being destroying MR, deallocating MR_KEY, or local / remote invalidation.
[0085] Specifically, the value of the RRPV can be updated by referring to Table 1 described above, which is exemplary, and other updating manners known to those skilled in the art can also be applied herein. In some embodiments, the determination of the MRCT replacement address comprises: traversing the cache and determining the address corresponding to the MRCT with the RRPV value equal to 3 as the MRCT replacement address, and if there are multiple values equal to 3, the address corresponding to the MRCT with the RRPV value equal to 3 appearing for the first time is selected as the MRCT replacement address.
[0086] In the optional implementation, in the execution of the above-described traversal of the cache and determination of the RRPV value, the RRPV value can also be other values, for example, when the RRPV value can be 1 / 2 / 3 / 4, the address corresponding to the MRCT with the RRPV value equal to 4 can be the MRCT replacement address, that is, the address corresponding to the MRCT with the maximum RRPV value can be the MRCT replacement address, which is exemplary, and other determination manners of the MRCT replacement address based on the RRPV value known to those skilled in the art can also be applied herein.
[0087] Specifically, the traversal cache can adopt a left-to-right search method to find the first Cache address with RRPV=3 for replacement, which is the MRCT replacement address in the present application, or other search methods known to those skilled in the art.
[0088] In some embodiments, when the second request type is registration MR, the second update of the RRPV value is to update the corresponding RRPV value to 1; when the second request type is VA2PA, binding memory window, querying MRCT or MR_KEY, the second update of the RRPV value is to update the corresponding RRPV value to 2.
[0089] In some embodiments, after the second update of the RRPV value according to the second request type of the MRCT access request, the method further comprises:
[0090] initiating a DMA read request to the system bus to obtain the requested target MRCT from the host memory, and writing the obtained target MRCT into the MRCT replacement address.
[0091] The method for managing the RMDA memory region context cache provided by the embodiments of the present application optimizes and improves the management of the MRCT cache based on the RRPV replacement algorithm, realizes accurate judgment of the cache unit, makes the management of the RMDA memory region more accurate and flexible, and effectively improves the replacement efficiency and hit probability of the cache region.
[0092] The present application is more accurate and flexible in judging the cache unit of "recently not accessed again" and "recently probably accessed again", which can effectively improve the replacement efficiency and hit probability of the cache.
[0093] In some optional embodiments, the method further comprises:
[0094] dynamically traversing all the RRPV values, and adding 1 to all the RRPV values when all the RRPV values are less than 3; the RRPV values include 0, 1, 2 and 3; wherein the advantages of RRPV values of 0, 1, 2 and 3 are that each RRPV value is represented by only 2-bit, which can save register resources when implemented in a chip, and the four levels of 0, 1, 2 and 3 are sufficient to distinguish the access probability of each address, so as to save resources and improve efficiency.
[0095] The execution flow of the dynamic traversal of the RRPV value is flexible, can be before the RRPV value is updated, or can be after the RRPV value is updated, the dynamic traversal process can be set according to actual requirements, can be cyclically traversed according to a certain time period, or can be executed according to the actual RRPV value update situation, and is not limited further herein.
[0096] In the case of dividing each functional module according to each function, the application provides a management device of RMDA memory region context cache in a second aspect. Exemplarily, refer to Figure 3 The management device provided by the embodiment of the application includes an MRCT lookup module, an RRPV management module and a cache read-write control module. Wherein:
[0097] The MRCT lookup module is configured to receive an MRCT access request, perform lookup on the cache based on the MRCT access request, and obtain an MRCT lookup result.
[0098] The RRPV management module is configured to update an RRPV value according to the MRCT lookup result.
[0099] The cache read-write control module is configured to obtain a target MRCT corresponding to the MRCT access request, and return the target MRCT to a request source.
[0100] Exemplarily, the management device further includes a system bus configured to access a host memory.
[0101] Exemplarily, the updating of the RRPV value according to the MRCT lookup result includes:
[0102] In the case that the MRCT corresponding to MR_Index is found in the cache, the MRCT lookup result is successful, and the RRPV value is updated according to a first request type of the MRCT access request; or,
[0103] In the case that the MRCT corresponding to MR_Index is not found in the cache, the MRCT lookup result is failed, a MRCT replacement address is determined, and the RRPV value is updated according to a second request type of the MRCT access request.
[0104] The management device of the RMDA memory region context cache described above can implement all the management methods of the RMDA memory region context cache involved in the application, and implement all the technical effects of the management method of the RMDA memory region context cache of the application, and will not be repeated herein.
[0105] It should be noted that the method of one or more embodiments of the present application can be executed by a single device, such as a computer or a server, etc. The method of the present embodiment can also be applied to a distributed scenario, and be completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only execute one or more steps in the method of one or more embodiments of the present application, and the multiple devices can interact with each other to complete the method.
[0106] It should be noted that the above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the acts or steps recited in the claims can be performed in a different order than those described in the embodiments and still achieve desirable results. Also, the processes depicted in the figures do not necessarily require the particular order shown or sequential order in order to achieve the desired results. In some implementations, multitasking and parallel processing can be advantageous.
[0107] Embodiments of the present application also provide an electronic device, comprising a processor and a memory, the memory stores a computer program, and the processor is configured to invoke the computer program to enable the electronic device to execute the aforementioned management method of RMDA memory area context cache, and has the beneficial effects of the corresponding method embodiments, which are not described here again.
[0108] The terms "unit", "module" and the like used in the present specification can be used to represent computer-related entities, hardware, firmware, combinations of hardware and software, software, or software in execution. In the present application, "unit" and "module" can be used interchangeably.
[0109] In the above embodiments, the functions of the various functional units can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, the functions can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions (programs). When the computer program instructions (programs) are loaded and executed on a computer, the whole or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transferred from one website, computer, server, or data center to another website, computer, server, or data center through wired (such as coaxial cable, optical fiber, digital subscriber line DSL) or wireless (such as infrared, wireless, microwave, etc.) manner. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that includes one or more available media sets. The available media can be magnetic media (such as floppy disk, hard disk, magnetic tape), optical media (such as digital versatile disc DVD), or semiconductor media (such as solid state disk SSD), etc.
[0110] The functions, if implemented in the form of software functional units and sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the parts that make contributions to the prior art or parts of the technical solutions can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the embodiments of the present application. The foregoing storage medium includes: U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk, and various media that can store program codes.
[0111] Although the present application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions described in the foregoing embodiments can be modified, or some of the technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for managing RMDA memory region context cache, characterized in that, The method comprises: receiving an MRCT access request, searching a cache based on the MRCT access request, and obtaining an MRCT search result; updating an RRPV value according to the MRCT search result; obtaining a target MRCT corresponding to the MRCT access request, and returning the target MRCT to a request source; the updating of the RRPV value according to the MRCT search result comprises: in the case that the MRCT corresponding to MR_Index is found in the cache, the MRCT search result is successful, and the RRPV value is updated according to a first request type of the MRCT access request; in the case that the first request type is VA2PA, a binding memory window, query of the MRCT or MR_KEY, the first update of the RRPV value is updating the corresponding RRPV value to 0; in the case that the first request type is destruction of the MR, deallocation of the MR_KEY, or local / remote invalidation, the first update of the RRPV value is updating the corresponding RRPV value to 3.
2. The method of claim 1, wherein the RMDA memory region context cache is managed by a memory management unit (MMU) of the processor. It further comprises: dynamically traversing all the RRPV values, and adding 1 to all the RRPV values in the case that all the RRPV values are less than 3; wherein the RRPV value comprises 0, 1, 2 and 3.
3. A method for managing an RMDA memory region context cache, the method comprising: The method comprises: receiving an MRCT access request, searching a cache based on the MRCT access request, and obtaining an MRCT search result; updating an RRPV value according to the MRCT search result; obtaining a target MRCT corresponding to the MRCT access request, and returning the target MRCT to a request source; the updating of the RRPV value according to the MRCT search result comprises: in the case that the MRCT corresponding to MR_Index is not found in the cache, the MRCT search result is failed, determining an MRCT replacement address, and updating the RRPV value according to a second request type of the MRCT access request; the determination of the MRCT replacement address comprises: traversing the cache and determining that the address corresponding to the MRCT with the maximum RRPV value is the MRCT replacement address, and if there are multiple values that are the same, selecting the address corresponding to the MRCT with the maximum RRPV value that appears for the first time as the MRCT replacement address; in the case that the second request type is registration of the MR, the second update of the RRPV value is updating the corresponding RRPV value to 1; in the case that the second request type is VA2PA, the binding memory window, query of the MRCT or MR_KEY, the second update of the RRPV value is updating the corresponding RRPV value to 2.
4. The method of claim 3, wherein the RMDA memory region context cache is managed by a memory management unit (MMU) of the processor. after the second update of the RRPV value according to the second request type of the MRCT access request, it further comprises: initiating a DMA read request to a system bus, obtaining the requested target MRCT from a host memory, and writing the obtained target MRCT into the MRCT replacement address.
5. The method of claim 3 or 4, wherein, It further comprises: dynamically traversing all the RRPV values, and adding 1 to all the RRPV values in a case that all the RRPV values are less than 3; wherein the RRPV values include 0, 1, 2 and 3.
6. An apparatus for managing an RMDA memory region context cache, for executing the management method according to any one of claims 1-5, characterized in that, The management device comprises: an MRCT lookup module, configured to receive an MRCT access request, perform a lookup on a cache based on the MRCT access request, and obtain an MRCT lookup result; an RRPV management module, configured to update an RRPV value according to the MRCT lookup result; a cache read-write control module, configured to obtain a target MRCT corresponding to the MRCT access request, and return the target MRCT to a request source.
7. The apparatus for managing RMDA memory region context cache according to claim 6, wherein, The updating of the RRPV value according to the MRCT lookup result comprises: in a case that the MRCT corresponding to MR_Index is found in the cache, the MRCT lookup result is successful, and the RRPV value is updated according to a first request type of the MRCT access request; or in a case that the MRCT corresponding to MR_Index is not found in the cache, the MRCT lookup result is failed, an MRCT replacement address is determined, and the RRPV value is updated according to a second request type of the MRCT access request.
8. An electronic device, comprising: The electronic device comprises a processor and a memory, the memory stores a computer program, and the processor is configured to invoke the computer program, so that the electronic device performs the management method of the RMDA memory area context cache. dynamically traversing all the RRPV values, and adding 1 to all the RRPV values in a case that all the RRPV values are less than 3; wherein the RRPV values include 0, 1, 2 and 3. The management device comprises: an MRCT lookup module, configured to receive an MRCT access request, perform a lookup on a cache based on the MRCT access request, and obtain an MRCT lookup result; an RRPV management module, configured to update an RRPV value according to the MRCT lookup result; a cache read-write control module, configured to obtain a target MRCT corresponding to the MRCT access request, and return the target MRCT to a request source. The updating of the RRPV value according to the MRCT lookup result comprises: in a case that the MRCT corresponding to MR_Index is found in the cache, the MRCT lookup result is successful, and the RRPV value is updated according to a first request type of the MRCT access request; or in a case that the MRCT corresponding to MR_Index is not found in the cache, the MRCT lookup result is failed, an MRCT replacement address is determined, and the RRPV value is updated according to a second request type of the MRCT access request. The electronic device comprises a processor and a memory, the memory stores a computer program, and the processor is configured to invoke the computer program, so that the electronic device performs the management method of the RMDA memory area context cache.
Citation Information
Patent Citations
Data caching method, device, chip, processor and system
CN117917648A