Physical memory management method, device, equipment and medium based on RDMA
By forming a ring-shaped chain structure for the physical page in RDMA communication, requesting and cacheing subsequent physical pages in advance, the addressing delay problem caused by physical page discontinuity is solved, and the RDMA communication performance is improved.
Patent Information
- Application Number
- CN202410419201.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-09
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-04-09
AI Technical Summary
During RDMA communication, due to the discontinuity of physical pages, the hardware needs to look up the PBL table when addressing the queue, resulting in a high latency.
By pre-writing the physical address, multiple physical pages form a ring-shaped chain structure. In response to the read and write request of the physical page, the physical address is obtained from the preset position of the first physical page, and the corresponding second physical page is cached. In order to start reading and writing of the next physical page immediately after processing the current physical page.
It reduces the time overhead brought by page switching, reduces the delay in RDMA communication process, and improves RDMA communication performance.
Smart Images

Figure CN118312098B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a physical memory management method, apparatus, device and medium based on RDMA. Background Art
[0002] DPU (Data Processing Unit) is a new generation of computing chips that are data-centric, I / O-intensive, and use software-defined technology to support infrastructure resource layer virtualization. It can improve computing system efficiency, reduce the total cost of ownership of the overall system, improve data processing performance, and reduce the performance loss of other computing chips. RDMA (Remote Direct Memory Access) technology is one of the important supporting technologies for realizing the potential of DPU solutions. Organizing and managing queue memory is an important part of the RDMA communication process.
[0003] In the related art, Boardcom adopts a secondary page table-like method based on PBL (Page Buffer List) in the BCM575 series RDMA network card to organize and manage queue memory, which is convenient for software to use queues. However, for hardware, due to the discontinuity of physical pages, the DMA (Direct Memory Access) address used by the hardware when addressing the queue is not continuous, resulting in the hardware needing to look up the PBL table to obtain the physical address of the queue when using the queue, resulting in a high latency problem. Summary of the invention
[0004] In order to solve the above technical problems, the present disclosure provides a physical memory management method, apparatus, device and medium based on RDMA.
[0005] In a first aspect, an embodiment of the present disclosure provides a physical memory management method based on RDMA, including:
[0006] In response to a read / write request for a first physical page among a plurality of physical pages, performing a read / write operation on the first physical page, and acquiring at least one physical address from a preset position of the first physical page;
[0007] Requesting at least one second physical page corresponding to the at least one physical address, and caching the at least one second physical page; wherein the plurality of physical pages form a ring-shaped chain structure by pre-writing physical addresses, and the at least one second physical page is located after the first physical page in the ring-shaped chain structure and is adjacent and continuous;
[0008] When a read or write request for the second physical page is obtained, the second physical page is called from the cache to perform a read or write operation on the second physical page.
[0009] In a second aspect, an embodiment of the present disclosure provides a physical memory management device based on RDMA, including:
[0010] a request module, configured to, in response to a read / write request for a first physical page among a plurality of physical pages, perform a read / write operation on the first physical page, and obtain at least one physical address from a preset position of the first physical page;
[0011] a cache module, configured to request at least one second physical page corresponding to the at least one physical address, and cache the at least one second physical page; wherein the plurality of physical pages form a ring-shaped chain structure by pre-writing the physical address, and the at least one second physical page is located after the first physical page in the ring-shaped chain structure and is adjacent and continuous;
[0012] The calling module is used to call the second physical page from the cache when a read or write request for the second physical page is obtained, so as to perform a read or write operation on the second physical page.
[0013] In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement the RDMA-based physical memory management method described in the first aspect above.
[0014] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the RDMA-based physical memory management method described in the first aspect is implemented.
[0015] The technical solution provided by the embodiment of the present disclosure has the following advantages compared with the prior art: by pre-writing physical addresses, multiple physical pages form a ring-like chain structure. When reading and writing multiple physical pages, in response to a read and write request for a first physical page among the multiple physical pages, the first physical page is read and written, and at the same time, at least one physical address is obtained from a preset position of the first physical page, and at least one second physical page corresponding to the at least one physical address is requested and cached. Then, when a read and write request for the second physical page is obtained, the second physical page is called from the cache to perform read and write operations on the second physical page. Therefore, through the physical memory management of the RDMA queue, the hardware can request and cache subsequent physical pages in advance while reading and writing physical pages. After processing the current physical page, the reading and writing of the next physical page can be started immediately, thereby reducing the time overhead caused by paging, reducing the delay in the RDMA communication process, and improving the RDMA communication performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0017] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0018] Figure 1 A flow chart of a physical memory management method based on RDMA provided in an embodiment of the present disclosure;
[0019] Figure 2 A schematic diagram of an address mapping relationship provided by an embodiment of the present disclosure;
[0020] Figure 3 A schematic diagram of a queue storage structure provided by an embodiment of the present disclosure;
[0021] Figure 4 A schematic diagram of another queue storage structure provided by an embodiment of the present disclosure;
[0022] Figure 5 A schematic diagram of the structure of a physical memory management device based on RDMA provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0023] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0024] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0025] First, the terms used in this disclosure are explained.
[0026] WQE (Work Queue Element) is used to describe the task instructions and task information sent by the software to the hardware during RDMA communication. WQ (Work Queue) is used to store WQE. SQ (Send Queue) is a WQ instance used to store sending tasks. RQ (Receive Queue) is a WQ instance used to store receiving tasks. QP (Queue Pair) is created in pairs with SQ and RQ. The combination is called QP. QP is the basic unit of RDMA communication. CQE (Completion Queue Element) is used to describe the task report reported by the hardware to the software during RDMA communication. Each CQE describes the completion information of a corresponding WQE. CQ (CompletionQueue) is used to store CQE.
[0027] Figure 1 This is a flow chart of an RDMA-based physical memory management method provided in an embodiment of the present disclosure. The method provided in an embodiment of the present disclosure can be executed by an RDMA-based physical memory management device, which can be implemented in software and / or hardware and can be integrated on any electronic device with computing capabilities.
[0028] like Figure 1 As shown, the RDMA-based physical memory management method provided by the embodiment of the present disclosure may include:
[0029] Step 101 , in response to a read / write request for a first physical page among a plurality of physical pages, performing a read / write operation on the first physical page, and acquiring at least one physical address from a preset position of the first physical page.
[0030] The method of the disclosed embodiment is applied to a DPU chip to implement physical memory management of a receiving queue, a sending queue, and a completion queue of RDMA (Remote Direct Memory Access).
[0031] In this embodiment, the physical memory includes multiple physical pages, and the multiple physical pages can be discrete in the physical memory. Before performing read and write operations on the physical page, a mapping relationship between the physical address of the physical page and the virtual address is established in advance and sent to the hardware. Then, when the physical page is requested to be read and written through software, the software sends the virtual address to the hardware. The hardware determines the corresponding physical address based on the virtual address query mapping relationship, and performs read and write operations on the physical page corresponding to the physical address.
[0032] The process of establishing the mapping relationship is described below.
[0033] In one embodiment of the present disclosure, a physical address of each physical page in a plurality of physical pages is obtained, and a corresponding virtual address is assigned to the physical address of each physical page, wherein the plurality of virtual addresses are continuous in a process virtual address space, and the plurality of virtual addresses correspond one-to-one with the physical addresses of the plurality of physical pages in sequence, and then, the mapping relationship between the virtual address and the physical address is notified to the hardware.
[0034] Reference Figure 2 , Figure 2 A schematic diagram of an address mapping relationship provided in an embodiment of the present disclosure is provided. Figure 2 The left side is the process virtual address space, and the right side is the physical memory. Multiple virtual addresses are continuous, while multiple physical pages can be partially continuous and partially discrete. Virtual address 0 to virtual address 5 correspond to physical address 0 to physical address 5, and physical address 0 to physical address 5 correspond to physical page 0 to physical page 5. For SQ, RQ, and CQ, the queue is applied by the RDMA driver during the QP creation phase, and the queue length is 4K aligned, that is, the size of the queue buffer is an integer multiple of 4096. The RDMA driver retains the physical address information and virtual address information of each block of memory with continuous physical addresses, and after all memory applications are completed, the corresponding physical memory is hashed and mapped to a continuous virtual address in the user program.
[0035] As an example, based on Figure 2According to the mapping relationship shown, the software sends a read / write request carrying virtual address 0 to the hardware, and the hardware determines physical address 0 by querying the mapping relationship according to virtual address 0, and then requests physical page 0 according to physical address 0 to perform read / write operations on the queue element in physical page 0, and simultaneously obtains at least one pre-written physical address from the preset position of physical page 0. In this example, the queue elements include WQE and CQE. For example, for SQ and RQ, the physical page includes WQE, and the length of WQE can be an integer power of 2 and less than 4K, such as a length of 64, 128, or 256. For another example, for CQ, the physical page includes CQE, and the length of CQE can be an integer power of 2 and less than 4K, wherein the preset position can be a specified field of any WQE or CQE in the physical page, and no specific limitation is made here.
[0036] Step 102: Request at least one second physical page corresponding to at least one physical address, and cache at least one second physical page.
[0037] Among them, multiple physical pages form a ring-shaped chain structure by pre-writing physical addresses, and at least one second physical page is located after the first physical page in the ring-shaped chain structure and is adjacent and continuous. Optionally, the physical addresses of the subsequent N physical pages are written at a preset position in each physical page, where N is a positive integer. In the case where the number of subsequent physical pages is less than N, for example, if the physical page to which the physical address is currently to be written is the last physical page among multiple physical pages, the physical addresses of the first N physical pages among the multiple physical pages are written to the preset position of the physical page to which the physical address is currently to be written. For the last N physical pages among the multiple physical pages, the physical addresses can be written in accordance with the above method, so that the multiple physical pages form a ring-shaped chain structure, which will not be repeated here.
[0038] In this embodiment, while performing read and write operations on the first physical page currently being read and written, at least one physical address is obtained from a preset position of the first physical page to synchronously request at least one second physical page corresponding to the at least one physical address, and the second physical page is cached in hardware.
[0039] Step 103: When a read or write request for the second physical page is obtained, the second physical page is called from the cache to perform a read or write operation on the second physical page.
[0040] In this embodiment, reading and writing are performed cyclically on multiple physical pages to realize cyclic use of queues. After performing read and write operations on the first physical page, when reading and writing are performed on the second physical page, since the second physical page has been requested and cached in advance, in response to the read and write requests for the second physical page, the second physical page is called from the cache and read and write operations are performed on the second physical page.
[0041] As an example, based on Figure 2 As shown in the mapping relationship, the software requests read and write in sequence through the virtual address, for example, starting from virtual address 0, and after performing read and write operations on the queue elements in physical page 0, the software sends a read and write request carrying virtual address 1 to the hardware. The hardware determines the physical address 1 based on the mapping relationship of virtual address 1, and calls the physical page 1 corresponding to the physical address 1 from the cache to perform read and write operations on the queue elements in physical page 1.
[0042] It should be noted that when the first physical page is read and written, the same applies to the case of calling from the cache.
[0043] Optionally, in response to a read / write request for a first physical page among multiple physical pages, a read / write operation is performed on the first physical page, including: if the first physical page exists in the cache, the first physical page is called from the cache; if the first physical page does not exist in the cache, the first physical page is obtained from the physical memory based on the read / write request; and the read / write operation is performed on the first physical page. Wherein, if the first physical page currently being read / written is the first physical page of the cyclic read / write, that is, the first physical page is not pre-cached, then the corresponding physical address is obtained based on the virtual address query mapping relationship carried by the read / write request, and the first physical page is requested from the physical memory according to the physical address; if the first physical page currently being read / written is not the first physical page of the cyclic read / write, the first physical page has been cached while the previous physical page performs the read / write operation, and the first physical page is called from the cache to reduce the paging overhead.
[0044] According to the technical solution of the embodiment of the present disclosure, a plurality of physical pages are formed into a ring-like chain structure by pre-writing physical addresses. When reading and writing the plurality of physical pages, in response to a read and write request for a first physical page among the plurality of physical pages, a read and write operation is performed on the first physical page, and at the same time, at least one physical address is obtained from a preset position of the first physical page, and at least one second physical page corresponding to the at least one physical address is requested and cached. Then, when a read and write request for the second physical page is obtained, the second physical page is called from the cache to perform read and write operations on the second physical page. Thus, through the physical memory management of the RDMA queue, the hardware can request and cache subsequent physical pages in advance while reading and writing physical pages. After processing the current physical page, the reading and writing of the next physical page can be started immediately, which facilitates the RDMA hardware to perform physical page addressing, reduces the time overhead caused by waiting for page switching, reduces the delay in the RDMA communication process, and thus improves the RDMA communication performance.
[0045] Based on the above embodiments, Figure 3 A schematic diagram of a queue storage structure provided by an embodiment of the present disclosure, such as Figure 3As shown, the preset position of each physical page is written with the physical address of the next physical page.
[0046] In this embodiment, at the preset position of each physical page, the physical address of a physical page that is sequentially after and adjacent to the physical page in multiple physical pages is written, that is, at the preset position of each physical page, the physical address of the next physical page of the physical page in multiple physical pages is written.
[0047] Optionally, requesting at least one second physical page corresponding to the at least one physical address and caching at least one second physical page includes: based on the obtained physical address, requesting a physical page corresponding to the obtained physical address, and saving a physical page corresponding to the obtained physical address in the cache.
[0048] If the physical page of the current physical address to be written is the last physical page among the multiple physical pages, the physical address of the first physical page among the multiple physical pages is written into the preset position of the physical page of the current physical address to be written.
[0049] As an example, a physical page includes multiple queue elements, and the physical address is written at a preset position of the physical page through the following steps: for each physical page, determine the first queue element of each physical page, and write the physical address in the preset field of the first queue element of each physical page, so that multiple physical pages form a ring-like chain structure. In this example, the queue element is WQE or CQE, and 64 bits are reserved at the beginning of WQE or CQE for storing the physical page number. After the queue memory allocation mapping is completed, the physical pages are linked in units of 4K, and multiple physical pages are connected in series into a ring-like chain structure. In the case where the queue has multiple 4K pages, the first WQE or CQE of each 4K page fills in the physical address of the next 4K page in the reserved field, such as Figure 3 As shown, for the last physical page pointed to by the queue buffer, the physical address of the first physical page pointed to by the queue buffer is written in the first WQE or CQE to form a ring chain structure. Optionally, the base address of the first physical page is stored in the chip to facilitate the hardware to search for physical pages.
[0050] In the disclosed embodiment, by adjusting the WQE and CQE formats, the information of the next physical page is written at the header of each physical page, so that the physical pages form a ring. While the hardware is performing read and write operations on the WQE / CQE of a physical page, it can request the next physical page in advance and cache it. After processing the current physical page, the WQE / CQE reading and writing of the next physical page can be started immediately, thereby reducing the time overhead caused by waiting for page changes.
[0051] Based on the above embodiments, Figure 4 A schematic diagram of another queue storage structure provided by an embodiment of the present disclosure, such as Figure 4 As shown, the preset position of each physical page is written with the physical addresses of the next two physical pages.
[0052] In this embodiment, at the preset position of each physical page, the physical addresses of two physical pages that are sequentially located after the physical page and adjacent to it in sequence among multiple physical pages are written, that is, at the preset position of each physical page, the physical addresses of the next two physical pages of the physical page among multiple physical pages are written.
[0053] Optionally, requesting at least one second physical page corresponding to the at least one physical address and caching at least one second physical page includes: based on the obtained physical address, requesting two physical pages corresponding to the obtained physical address, and storing the two physical pages corresponding to the obtained physical address in the cache.
[0054] Wherein, if the physical page of the current physical address to be written is the last physical page among multiple physical pages, the physical address of the first physical page and the physical address of the second physical page among the multiple physical pages are written into the preset position of the physical page of the current physical address to be written. If the physical page of the current physical address to be written is the second to last physical page among multiple physical pages, the physical address of the last physical page and the physical address of the first physical page among the multiple physical pages are written into the preset position of the physical page of the current physical address to be written.
[0055] As an example, a physical page includes multiple queue elements, and a physical address is written at a preset position of the physical page by the following steps: for each physical page, the first queue element of each physical page is determined, and the physical address is written in a preset field of the first queue element of each physical page, so that the multiple physical pages form a ring chain structure. In this example, Figure 4 As shown, each WQE / CQE reserves two 64-bit spaces for pre-storing the physical addresses of the next two 4K pages in the page header WQE / CQE. Optionally, the base address of the first physical page is stored inside the chip to facilitate hardware physical page search.
[0056] In the disclosed embodiment, the hardware can pre-fetch the next two physical pages at one time when performing a physical page search, thereby further shortening the physical page search time, reducing the time overhead generated when waiting for page changes, and improving performance.
[0057] Figure 5 A schematic diagram of the structure of a physical memory management device based on RDMA provided by an embodiment of the present disclosure is shown in FIG. Figure 5As shown, the RDMA-based physical memory management device includes: a request module 51, a cache module 52, and a calling module 53.
[0058] The request module 51 is used to respond to a read / write request for a first physical page among the multiple physical pages, perform a read / write operation on the first physical page, and obtain at least one physical address from a preset position of the first physical page;
[0059] a cache module 52, configured to request at least one second physical page corresponding to the at least one physical address, and cache the at least one second physical page; wherein the plurality of physical pages form a ring-shaped chain structure by pre-writing the physical address, and the at least one second physical page is located after the first physical page in the ring-shaped chain structure and is adjacent and continuous;
[0060] The calling module 53 is used to call the second physical page from the cache when a read or write request for the second physical page is obtained, so as to perform a read or write operation on the second physical page.
[0061] In one embodiment of the present disclosure, the request module 51 is specifically used to, if the first physical page exists in the cache, call the first physical page from the cache; if the first physical page does not exist in the cache, obtain the first physical page from the physical memory based on the read and write request; and perform read and write operations on the first physical page.
[0062] In one embodiment of the present disclosure, the physical page includes a plurality of queue elements, and the apparatus further includes: a writing module, configured to write, at a preset position of each physical page, a physical address of a physical page that is sequentially located after and adjacent to the physical page in the plurality of physical pages;
[0063] The cache module 52 is specifically used for: requesting a physical page corresponding to the acquired physical address according to the acquired physical address, and storing the physical page corresponding to the acquired physical address in the cache.
[0064] In one embodiment of the present disclosure, the physical page includes a plurality of queue elements, and the apparatus further includes: a writing module, configured to write, at a preset position of each physical page, physical addresses of two physical pages that are sequentially located after the physical page and are sequentially adjacent to the physical page in the plurality of physical pages;
[0065] The cache module 52 is specifically used for: requesting two physical pages corresponding to the acquired physical address according to the acquired physical address, and storing the two physical pages corresponding to the acquired physical address in the cache.
[0066] In one embodiment of the present disclosure, the writing module is also used to: if the physical page of the current physical address to be written is the last physical page among the multiple physical pages, then the physical addresses of the first N physical pages among the multiple physical pages are written into the preset position of the physical page of the current physical address to be written; N is a positive integer.
[0067] In one embodiment of the present disclosure, the device also includes: a preprocessing module, used to determine the first queue element of each physical page for each physical page; write a physical address in a preset field of the first queue element of each physical page so that the multiple physical pages form a ring chain structure.
[0068] In one embodiment of the present disclosure, the device also includes: a mapping module, used to obtain the physical address of each physical page in the multiple physical pages, and assign a corresponding virtual address to the physical address of each physical page; wherein the multiple virtual addresses are continuous in the process virtual address space, and the multiple virtual addresses correspond to the physical addresses of the multiple physical pages in sequence one by one; and the mapping relationship between the virtual address and the physical address is notified to the hardware.
[0069] The RDMA-based physical memory management device provided in the embodiments of the present disclosure can execute any RDMA-based physical memory management method provided in the embodiments of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method. For the contents not described in detail in the embodiments of the device of the present disclosure, reference can be made to the description in any method embodiment of the present disclosure.
[0070] The present disclosure also provides an electronic device, which includes one or more processors and a memory. The processor may be a central processing unit (CPU) or other forms of processing units with data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device to perform desired functions. The memory may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on a computer-readable storage medium, and the processor may run the program instructions to implement the method of the above embodiment of the present disclosure and / or other desired functions. Various contents such as input signals, signal components, noise components, etc. may also be stored in the computer-readable storage medium.
[0071] In one example, the electronic device may further include: an input device and an output device, and these components are interconnected through a bus system and / or other forms of connection mechanisms. In addition, the input device may also include, for example, a keyboard, a mouse, etc. The output device may output various information to the outside, including determined distance information, direction information, etc. The output device may include, for example, a display, a speaker, a printer, and a communication network and a remote output device connected thereto, etc. In addition, according to the specific application, the electronic device may also include any other appropriate components such as a bus, an input / output interface, etc.
[0072] In addition to the above methods and devices, the embodiments of the present disclosure may also be a computer program product, which includes computer program instructions. When the computer program instructions are executed by a processor, the processor executes any method provided by the embodiments of the present disclosure.
[0073] The computer program product may be written in any combination of one or more programming languages to write program code for performing the operations of the disclosed embodiments, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0074] In addition, the embodiments of the present disclosure may also be a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes any method provided by the embodiments of the present disclosure.
[0075] Computer readable storage media can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0076] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0077] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A physical memory management method based on RDMA, characterized in that: include: In response to a first read / write request for a first physical page among the multiple physical pages, query a mapping relationship according to a first virtual address carried in the first read / write request, determine a physical address of the first physical page corresponding to the first virtual address, request the first physical page according to the physical address of the first physical page to perform a read / write operation on a queue element of the first physical page, and obtain at least one physical address from a preset position of the first physical page; Requesting at least one second physical page corresponding to the at least one physical address, and caching the at least one second physical page; wherein the multiple physical pages form a ring chain structure by pre-writing physical addresses, and the at least one second physical page is located after the first physical page in the ring chain structure and is adjacent and continuous; the physical page includes multiple queue elements, and the physical address is written at a preset position of the physical page by the following steps: for each physical page, determining the first queue element of each physical page; writing the physical address in a preset field of the first queue element of each physical page, so that the multiple physical pages form a ring chain structure; When a second read / write request for the second physical page is obtained, the mapping relationship is queried according to the second virtual address carried by the second read / write request, the physical address of the second physical page corresponding to the second virtual address is determined, and the second physical page is called from the cache according to the physical address of the second physical page to perform read / write operations on the queue element of the second physical page.
2. The method according to claim 1, characterized in that The performing a read and write operation on the queue element of the first physical page includes: If the first physical page exists in the cache, calling the first physical page from the cache; If the first physical page does not exist in the cache, acquiring the first physical page from the physical memory based on the first read / write request; Read and write operations are performed on the queue elements of the first physical page.
3. The method according to claim 1, characterized in that Also includes: Writing, at a preset position of each physical page, a physical address of a physical page that is sequentially after and adjacent to the physical page in the plurality of physical pages; The requesting at least one second physical page corresponding to the at least one physical address and caching the at least one second physical page includes: According to the obtained physical address, a physical page corresponding to the obtained physical address is requested, and the physical page corresponding to the obtained physical address is stored in the cache.
4. The method according to claim 1, characterized in that Also includes: Writing, at a preset position of each physical page, physical addresses of two physical pages that are sequentially located after the physical page and are sequentially adjacent to the physical page in the plurality of physical pages; The requesting at least one second physical page corresponding to the at least one physical address and caching the at least one second physical page includes: According to the obtained physical address, two physical pages corresponding to the obtained physical address are requested, and the two physical pages corresponding to the obtained physical address are stored in the cache.
5. The method according to claim 1, characterized in that Also includes: If the physical page of the current physical address to be written is the last physical page among the multiple physical pages, the physical addresses of the first N physical pages among the multiple physical pages are written into the preset position of the physical page of the current physical address to be written; N is a positive integer.
6. The method according to claim 1, characterized in that Also includes: Obtaining a physical address of each physical page in the plurality of physical pages, and assigning a corresponding virtual address to the physical address of each physical page; wherein the plurality of virtual addresses are continuous in the process virtual address space, and the plurality of virtual addresses correspond to the physical addresses of the plurality of physical pages in sequence one by one; The mapping relationship between the virtual address and the physical address is notified to the hardware.
7. A physical memory management device based on RDMA, characterized in that: include: a request module, configured to, in response to a first read / write request for a first physical page among a plurality of physical pages, query a mapping relationship according to a first virtual address carried in the first read / write request, determine a physical address of the first physical page corresponding to the first virtual address, request the first physical page according to the physical address of the first physical page to perform a read / write operation on a queue element of the first physical page, and obtain at least one physical address from a preset position of the first physical page; A cache module, used for requesting at least one second physical page corresponding to the at least one physical address, and caching the at least one second physical page; wherein the multiple physical pages form a ring chain structure by pre-writing physical addresses, and the at least one second physical page is located after the first physical page in the ring chain structure and is adjacent and continuous; the physical page includes multiple queue elements, and the physical address is written at a preset position of the physical page by the following steps: for each physical page, determining the first queue element of each physical page; writing the physical address in a preset field of the first queue element of each physical page, so that the multiple physical pages form a ring chain structure; A calling module is used to query the mapping relationship according to the second virtual address carried by the second read / write request when a second read / write request for the second physical page is obtained, determine the physical address of the second physical page corresponding to the second virtual address, and call the second physical page from the cache according to the physical address of the second physical page to perform read / write operations on the queue element of the second physical page.
8. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the RDMA-based physical memory management method described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the RDMA-based physical memory management method described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
System memory management unit, read-write request processing method, electronic equipment and system on chip
CN114546896A
Memory management method, system, component and equipment
CN115794667A
