Memory management method and server

By determining the target addressing mode and memory space in RDMA technology, the problem of mismatch between the number of message queue entities and memory space is solved, and efficient resource utilization and memory management stability are achieved.

CN119829284APending Publication Date: 2025-04-15XFUSION DIGITAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411899540.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-23
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

In RDMA technology, the number of message queue entities actually used by the application does not match the memory space applied by the hardware, resulting in waste of resources or insufficient memory.

Method used

By obtaining the target number of message queue entities when the source node completes initialization configuration, and determining the target addressing mode and memory space based on the target number and the maximum number of storage supported by the source node, reapplying the memory space to ensure that the number of message queue entities actually used matches the requested memory space.

Benefits of technology

Avoid resource waste and insufficient memory, ensuring efficient memory management and optimal resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119829284A_ABST
    Figure CN119829284A_ABST
Patent Text Reader

Abstract

The invention relates to a memory management method and a server, which are used for ensuring that the number of actually used message queue entities is matched with an applied memory space and avoiding the situation of resource waste or insufficient memory. The memory management method comprises the steps that under the condition that a source node completes initial configuration, the target number of message queue entities applied by the source node is obtained, and the message queue entities are used for bearing messages for communication between the source node and a target node; the initial configuration is used for representing that the source node performs initial configuration according to a preset addressing mode and the maximum number of the message queue entities supported and stored by the source node; determining a target addressing mode according to the target number and the maximum number of the message queue entities supported and stored by the source node; and determining a target memory space based on the target addressing mode and the maximum number, the target memory space being used for storing the message queue entity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a memory management method and a server. Background Art

[0002] Remote Direct Memory Access (RDMA) technology is created to solve the delay of server-side data processing during network transmission.

[0003] Queue Pair (QP) is the smallest unit of RDMA communication. When two remote nodes need to communicate, they need to create QP for communication. Each pair of QP contains a send queue (SQ) and a receive queue (RQ), which are used to manage various messages in the queue. SQ and RQ are collectively called work queues (WQ). In the specific RDMA implementation, the user sends a message to QP, and the message content is carried by a work queue entity (WQE). After the WQE is processed, the corresponding completion queue entity (CQE) will be generated in the completion queue (CQ). The hardware parses the CQE to inform the other end that the message processing is completed.

[0004] As the business continues to grow, the number of message queue entities (such as Queue Pair Context (QPC), Completion Queue Context (CQC), WQE, etc.) required by RDMA technology is also growing exponentially, especially in the field of High Performance Compute (HPC), where more message queue entities are needed. In view of the increasing number of message queue entities used, a multi-level addressing design is mostly used when storing message queue entities in memory.

[0005] Currently, during the initialization driver loading process, parameters are read from the network card firmware to apply for memory to store message queue entities. Usually, there is a mismatch between the number of message queue entities actually used by the application and the memory space applied by the hardware, which leads to resource waste or insufficient memory. Summary of the invention

[0006] The embodiments of the present application provide a memory management method and a server to ensure that the number of message queue entities actually used matches the applied memory space, thereby avoiding resource waste or insufficient memory.

[0007] In a first aspect, an embodiment of the present application provides a memory management method, which is applied to a source node that communicates using a remote direct memory access (RDMA over Converged Ethernet, RoCE) network protocol of a converged Ethernet, and the method includes:

[0008] When the source node completes initialization configuration, obtaining a target number of message queue entities applied for by the source node, the message queue entity being used to carry messages for communication between the source node and the target node, the initialization configuration being used to indicate that the source node performs initialization configuration according to a preset addressing mode and a maximum number of the message queue entities supported by the source node for storage;

[0009] Determining a target addressing mode according to the target quantity and a maximum number of the message queue entities supported for storage by the source node;

[0010] Based on the target addressing mode and the maximum number, a target memory space is determined, and the target memory space is used to store the message queue entity.

[0011] Through the above method, when the source node completes the initialization configuration, when the source node communicates with the target node, the target number of message queue entities applied for by the source node is obtained, and then the target addressing mode is determined according to the target number and the maximum number of message queue entities supported by the source node for storage, and the target addressing mode and the maximum number of message queue entities supported by the source node for storage are used to determine the target memory space required for this communication, and the memory space is reapplied. In this way, the number of message queue entities actually used in the communication process matches the applied memory space, avoiding resource waste or insufficient memory.

[0012] In a possible implementation manner, determining the target addressing mode according to the target quantity and the maximum number of the message queue entities supported for storage by the source node includes:

[0013] When it is determined that the target number does not match the maximum number of the message queue entities that the source node supports storing, a target addressing mode is determined according to the target number and the maximum number of the message queue entities that the source node supports storing.

[0014] Through the above method, when it is determined that the target number does not match the maximum number of message queue entities supported by the source node for storage, the target addressing mode is determined based on the target number and the maximum number of message queue entities supported by the source node for storage, and then the memory space is reapplied. If the target number matches the maximum number of message queue entities supported by the source node for storage, there is no need to reapply for the memory space.

[0015] In a possible implementation manner, in one or more of the following situations, it is determined that the target quantity does not match the maximum quantity of the message queue entities supported for storage by the source node:

[0016] The target number is greater than the maximum number of the message queue entities supported by the source node for storage;

[0017] The difference between the maximum number of the message queue entities supported by the source node for storage and the target number is greater than a preset threshold.

[0018] In the above method, when the target number is greater than the maximum number of message queue entities supported by the source node for storage, that is, the maximum number of message queue entities supported by the source node for storage is insufficient to store the target number of message queue entities, it is determined that the target number does not match the maximum number of message queue entities supported by the source node for storage; when the difference between the maximum number of message queue entities supported by the source node for storage and the target number is greater than a preset threshold, although the source node is sufficient to store the target number of message queue entities, some space will be idle, which can also be regarded as a mismatch between the target number and the maximum number of message queue entities supported by the source node for storage. In both of the above cases, it is necessary to reapply for memory space so that the maximum number of message queue entities supported by the source node for storage matches the target number.

[0019] In a possible implementation manner, determining the target addressing mode according to the target quantity and the maximum number of the message queue entities supported for storage by the source node includes:

[0020] Based on the target number and the maximum number of the message queue entities supported by the source node for storage, the corresponding target addressing mode is searched from the configuration combination information pre-stored by the source node, and the pre-stored configuration combination information is used to record the correspondence between the number of message queue entities applied for by the source node, the maximum number of the message queue entities supported by the source node for storage, and the addressing mode.

[0021] In a possible implementation manner, the pre-stored configuration combination information is stored in the form of a table or a code line.

[0022] In the above method, by pre-storing the configuration combination information in the form of a table or code lines, the corresponding target addressing mode can be quickly found and determined based on the target number and the maximum number of message queue entities supported and stored by the source node.

[0023] In a possible implementation, the target addressing mode includes the number of target addressing levels and the size of the base address table of each level of addressing;

[0024] The determining of the target memory space based on the target addressing mode and the maximum number includes:

[0025] Use the following formula to determine the target memory space:

[0026] Q=B1×B2×…×B i ×q formula 1

[0027] Among them, Q is the target memory space, B is the base address table size of each level of addressing, i is the number of addressing levels, and q is the storage space required for each message queue entity.

[0028] In a possible implementation manner, obtaining a target number of message queue entities applied for by the source node includes:

[0029] Creating a message queue entity based on the communication parameters configured by the user when communicating with the target node, and assigning a message queue entity number to each message queue entity;

[0030] The maximum value of the message queue entity numbers is determined as the target number.

[0031] In a possible implementation manner, the initialization parameters of the source node initialization configuration are obtained from the network card firmware, or from a pre-acquired initialization configuration file.

[0032] In the above method, the initialization parameters of the source node initialization configuration can be directly initialized using the level 1 addressing mode to shorten the initialization loading time and improve the user experience.

[0033] In a possible implementation, the message queue entity includes: queue pair content QPC, completion queue content CQC, and work queue entity WQE.

[0034] In a second aspect, an embodiment of the present application provides a memory management device, which is applied to a source node that communicates using a RoCE network protocol, and the device includes:

[0035] an acquiring unit, configured to acquire, when the source node completes initialization configuration, a target number of message queue entities applied for by the source node, the message queue entity being used to carry messages for communication between the source node and the target node, the initialization configuration being used to indicate that the source node performs initialization configuration according to a preset addressing mode and a maximum number of the message queue entities supported by the source node for storage;

[0036] A first processing unit, configured to determine a target addressing mode according to the target quantity and a maximum quantity of the message queue entities supported for storage by the source node;

[0037] The second processing unit is used to determine a target memory space based on the target addressing mode and the maximum number, and the target memory space is used to store the message queue entity.

[0038] In a possible implementation manner, the first processing unit is specifically configured to:

[0039] When it is determined that the target number does not match the maximum number of the message queue entities that the source node supports storing, a target addressing mode is determined according to the target number and the maximum number of the message queue entities that the source node supports storing.

[0040] In a possible implementation manner, the first processing unit determines that the target number does not match the maximum number of the message queue entities supported for storage by the source node in one or more of the following situations:

[0041] The target number is greater than the maximum number of the message queue entities supported by the source node for storage;

[0042] The difference between the maximum number of the message queue entities supported by the source node for storage and the target number is greater than a preset threshold.

[0043] In a possible implementation manner, the first processing unit is specifically configured to:

[0044] Based on the target number and the maximum number of the message queue entities supported by the source node for storage, the corresponding target addressing mode is searched from the configuration combination information pre-stored by the source node, and the pre-stored configuration combination information is used to record the correspondence between the number of message queue entities applied for by the source node, the maximum number of the message queue entities supported by the source node for storage, and the addressing mode.

[0045] In a possible implementation manner, the pre-stored configuration combination information is stored in the form of a table or a code line.

[0046] In a possible implementation, the target addressing mode includes the number of target addressing levels and the size of the base address table of each level of addressing;

[0047] The second processing unit is specifically configured to:

[0048] Use the following formula to determine the target memory space:

[0049] Q=B1×B2×…×B i ×q formula 1

[0050] Among them, Q is the target memory space, B is the base address table size of each level of addressing, i is the number of addressing levels, and q is the storage space required for each message queue entity.

[0051] In a possible implementation manner, the acquisition unit is specifically configured to:

[0052] Creating a message queue entity based on the communication parameters configured by the user when communicating with the target node, and assigning a message queue entity number to each message queue entity;

[0053] The maximum value of the message queue entity numbers is determined as the target number.

[0054] In a possible implementation manner, the initialization parameters of the source node initialization configuration are obtained from the network card firmware, or from a pre-acquired initialization configuration file.

[0055] In a possible implementation, the message queue entity includes: queue pair content QPC, completion queue content CQC, and work queue entity WQE.

[0056] In a third aspect, an embodiment of the present application provides a server, comprising a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes any one of the memory management methods in the first aspect.

[0057] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which includes a computer program. When the computer program is run on a computer device, the computer program is used to enable the computer device to execute any one of the memory management methods in the above-mentioned first aspect.

[0058] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes a computer program stored in a computer-readable storage medium; when a processor of a computer device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the computer device executes any one of the memory management methods in the above-mentioned first aspect.

[0059] In a sixth aspect, the present application further provides a computer chip, wherein the chip is connected to a memory, and the chip is used to read and execute a software program stored in the memory, and to execute any one of the memory management methods in the first aspect above.

[0060] For the technical effects that may be achieved by each of the above-mentioned second to sixth aspects, please refer to the above-mentioned description of the technical effects that can be achieved by various possible schemes in the first aspect, and no further details will be given here. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0062] Figure 1 A schematic diagram of an application scenario of a memory management method provided in an embodiment of the present application;

[0063] Figure 2 A schematic diagram of the interaction between an application program and a network card in a source node provided in an embodiment of the present application;

[0064] Figure 3 A schematic flow chart of a memory management method provided in an embodiment of the present application;

[0065] Figure 4 A schematic flow chart of a specific implementation process of a memory management method provided in an embodiment of the present application;

[0066] Figure 5 A schematic diagram of the structure of a memory management device provided in an embodiment of the present application;

[0067] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0068] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution 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 part of the embodiments of the technical solution of the present application, rather than all of the embodiments. Based on the embodiments recorded in the application documents, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the technical solution of the present application.

[0069] The following is an introduction to some concepts involved in the embodiments of the present application.

[0070] 1. RoCE, or RDMA over Converged Ethernet. Simply put, it is to use hardware to process the network layer and transport layer packets in the converged Ethernet. Therefore, an accelerated network card that supports the RoCE engine is usually required in the RDMA network.

[0071] 2. Multi-level addressing is an addressing mechanism that allows the use of multiple levels of base address tables (BT) to store data addresses. The number of addressing levels is determined by the number of base address tables.

[0072] The following is a brief introduction to the application scenarios of the embodiments of the present application:

[0073] First reference Figure 1 , which is a schematic diagram of an application scenario of the memory management method provided in an embodiment of the present application, such as Figure 1 As shown, it may include: a source node 101 and a target node 102, both of which are equipped with a network card supporting the RoCE network protocol, and the source node 101 may be installed with artificial intelligence (AI) intelligent computing, high performance computing (HPC), and applications in high-speed storage scenarios. Such applications in the source node 101 can directly access the memory of the target node 102 through the network card based on the RoCE network protocol without the participation of the central processing unit (CPU) of the source node 101 and the target node 102, thereby reducing the occupancy of computing resources and increasing the data transmission rate. The source node 101 and the target node 102 are connected via a network. Exemplarily, the network may include, but is not limited to, a mobile communication network, a local area network, a wide area network, the Internet of Things, and the like.

[0074] In the embodiment of the present application, taking the source node 101 as an example, Figure 2 As shown, a network card supporting the RoCE network protocol is installed in the source node 101, and a network card driver is installed in the source node 101, including a driver for the RoCE network. When the network card driver is initialized, it will obtain initialization parameters from the network card firmware (written at the factory), or initialize according to the initialization parameters configured in the obtained initialization configuration file (configured by the user), and apply for a certain memory space to store the message queue entities (such as QPC, CQC, WQE, etc.) created during the communication process between the source node 101 and the target node 102 based on the RoCE network protocol.

[0075] When the application (AI intelligent computing, HPC, and application in high-speed storage scenarios) in the source node 101 directly accesses the memory of the target node 102 through the network card based on the RoCE network protocol, the network card driver of the source node 101 creates a message queue entity based on the communication parameters configured by the user (which can be pre-configured in the application writing stage or requested to be configured by the user), such as QP capability or type, the number of WRs to be sent, and the number of WRs that can be received, etc., and assigns a message queue entity number to each message queue entity. Then, the maximum value of the message queue entity number is used as the number of message queue entities applied for communication with the target node 102, which is recorded as the target number.

[0076] The source node 101 determines the target addressing mode required to store the target number of queue entity contents based on the target number and the maximum number of message queue entities supported by the source node for storage, and determines the target memory space based on the target addressing mode and the maximum number of message queue entities supported by the source node for storage, and then reapplies for memory space to store the target number of message queue entities, ensuring that the number of message queue entities supported for storage by the reapplied memory space matches the target number, thereby avoiding waste of memory space resources or insufficient memory space.

[0077] In the embodiment of the present application, the source node 101 and the target node 102 may be servers, terminals, or any other devices with computing capabilities, wherein the server may be an independent physical server, or a cloud server that provides basic cloud computing services such as cloud servers, cloud databases, and cloud storage, which is not limited in the embodiment of the present application.

[0078] based on Figure 1 The application scenario shown below will refer to the attached Figures 3 to 6 The exemplary embodiments of the present application are described in more detail. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principle of the present application, and the implementation of the present application is not limited in any way. On the contrary, the implementation of the present application can be applied to any applicable scenario.

[0079] See also Figure 3 As shown, it is an implementation flow chart of a memory management method in an embodiment of the present application. The specific implementation process of the method is as follows S301-S303:

[0080] S301: When the source node completes the initialization configuration, the target number of message queue entities applied for by the source node is obtained. The message queue entity is used to carry messages for communication between the source node and the target node. The initialization configuration is used to indicate that the source node is initialized according to a preset addressing mode and the maximum number of message queue entities supported by the source node for storage.

[0081] Among them, the message queue entities mentioned in the embodiments of the present application may include but are not limited to QPC, CQC, WQE, etc.

[0082] During specific implementation, the network card driver of the source node creates a message queue entity based on the communication parameters configured by the user (which can be pre-configured in the application writing stage or requested to be configured by the user), such as QP capability or type, the number of WRs to be sent, and the number of WRs that can be received, etc., and assigns a message queue entity number to each message queue entity, and then determines the maximum value of the message queue entity number as the target number.

[0083] The network card driver initialization configuration of the source node refers to the initialization configuration of the source node according to the initialization parameters, wherein the initialization parameters include but are not limited to: a preset addressing mode and the maximum number of message queue entities supported by the source node for storage. The initialization parameters can be obtained from the network card firmware (written at the factory) or from the initialization configuration file (configured by the user).

[0084] It should be noted that, since the source node can reapply for memory space based on the target number of message queue entities applied for by the source node when communicating with the target node, the preset addressing mode in the initialization parameters can be a level 1 addressing mode, that is, the maximum number of message queue entities supported by the source node for storage is directly initialized and configured, thereby shortening the initialization loading time and improving the user experience.

[0085] For example, the addressing mode preset in the initialization parameters is level 1, and the maximum number of message queue entities that the source node supports for storage is 100. In this case, when the network card driver is initialized and configured, the level 1 addressing mode and the maximum number of message queue entities that the source node supports for storage are 100. The memory space that can store 100 message queue entities is applied for. Assuming that the size of each message queue entity is 256 bytes (B), 25600B (256B*100) of memory space can be applied for.

[0086] S302: Determine a target addressing mode according to the target quantity and the maximum number of message queue entities supported for storage by the source node.

[0087] It should be noted that the addressing mode includes the addressing level and the base address table size, wherein the addressing level is generally 1-3 levels of addressing, and the base address table size refers to the size of the base address table. Taking the Linux system as an example, there are currently 4 kilobytes (KB), 1 megabyte (MB), 1 gigabyte (GB), etc. The base address table is used to store the address of the message queue entity. Taking level 1 addressing as an example, 1 base address table is used to store the address of the message queue entity. Assuming that the base address table size is 4KB and the address size of each message queue entity is 8B, then level 1 storage can store 4KB / 8B message queue entities.

[0088] In specific implementation, assuming that the addressing mode and the maximum number of message queue entities that the source node supports for storage are known, the maximum number of message queue entities that can be stored through multi-level addressing can be calculated. For example, the addressing level is A, the size of the base address table at each level is the same and is B, and the maximum number of message queue entities that the source node supports for storage is C. Then the maximum number of message queue entities that can be stored through multi-level addressing is B. A ×C.

[0089] Similarly, when the target number and the maximum number of message queue entities supported by the source node for storage are determined, the target addressing mode can be determined according to the target number and the maximum number of message queue entities supported by the source node for storage. Specifically, the ratio of the target number and the maximum number of message queue entities supported by the source node for storage can be first calculated to determine the number of addresses that need to be extended, and then the addressing level is determined based on the number of addresses that need to be extended and the size of the base address table. After the addressing level is determined, the addressing level and the size of the base address table are the target addressing mode.

[0090] In another embodiment, when the maximum number of message queue entities that the source node supports for storage and the size of the base address table are fixed, there is a certain correspondence between the addressing level and the maximum number of message queue entities that can be stored through multi-level addressing. In this case, configuration combination information can be pre-stored to record the correspondence between the number of message queue entities applied for by the source node (or the maximum number of message queue entities that can be stored through multi-level addressing), the maximum number of message queue entities that the source node supports for storage, and the addressing mode. Then, when determining the target addressing mode based on the target number and the maximum number of message queue entities that the source node supports for storage, the target addressing mode can be directly searched and determined in the pre-stored configuration combination information.

[0091] The pre-stored configuration combination information may be stored in the form of a table or a code line, or may be stored in other forms.

[0092] For example, assuming that the pre-stored configuration combination information stores addressing modes corresponding to the number of message queue entities of 10000, 5000, 2000, and 1000, respectively, if the target number is 8000, the addressing mode corresponding to 10000 can be directly used as the target addressing mode.

[0093] In specific implementation, in order to further improve the user experience, when determining the target addressing mode based on the target number and the maximum number of message queue entities supported by the source node for storage, if it is determined that the target number does not match the maximum number of message queue entities supported by the source node for storage, the target addressing mode can be determined based on the target number and the maximum number of message queue entities supported by the source node for storage, and then re-apply for memory space. If the target number matches the maximum number of message queue entities supported by the source node for storage, there is no need to re-apply for memory space.

[0094] In specific implementation, in one or more of the following situations, it is determined that the target quantity does not match the maximum number of message queue entities that the source node supports storing:

[0095] Case 1: The target number is greater than the maximum number of message queue entities that the source node supports storing. At this time, the maximum number of message queue entities that the source node supports storing is insufficient to store the target number of message queue entities, and it is determined that the target number does not match the maximum number of message queue entities that the source node supports storing.

[0096] Case 2: The difference between the maximum number of message queue entities supported by the source node and the target number is greater than the preset threshold. At this time, although the source node is sufficient to store the target number of message queue entities, some space will be idle, which can also be regarded as a mismatch between the target number and the maximum number of message queue entities supported by the source node. Among them, the preset threshold can be set according to an empirical value, for example: the preset threshold is 1000, which is not limited in the embodiments of the present application.

[0097] It should be noted that in the embodiment of the present application, when it is determined that the target number does not match the maximum number of message queue entities supported by the source node for storage, the target addressing mode is re-determined. In other embodiments of the present application, other methods can also be used to trigger the re-determination of the target addressing mode, such as setting a button and triggering it by the user through a button.

[0098] S303: Determine a target memory space based on the target addressing mode and the maximum number, where the target memory space is used to store the message queue entity.

[0099] In specific implementation, the target addressing mode includes the addressing level and the base address table size of each level of addressing. When the target addressing mode and the maximum number of message queue entities supported by the source node for storage are determined, the target memory space can be determined using the following formula (1):

[0100] Q=B1×B2×…×B i ×q formula (1)

[0101] Among them, Q is the target memory space, B is the base address table size of each level of addressing, i is the number of addressing levels, and q is the storage space required for each message queue entity.

[0102] In specific implementation, after determining the target memory space, applying for the memory space of corresponding size can ensure that the memory space matches the size of the target number of message queue entities, thus avoiding resource waste or insufficient memory.

[0103] After an overall introduction to the memory management method provided by the embodiment of the present application, Figure 4 , the application in the source node performs RDMA communication with the target node through the network card based on the RoCE network protocol, and the message queue entity takes QPC as an example to describe in detail the specific implementation process of the memory management method provided in the embodiment of the present application.

[0104] like Figure 4 As shown, the specific implementation process of the memory management method provided in the embodiment of the present application includes:

[0105] Step 401, the network card driver in the source node is initialized and configured.

[0106] During specific implementation, the network card driver of the source node is initialized and configured according to the initialization parameters, wherein the initialization parameters include but are not limited to: a preset addressing mode and the maximum number of message queue entities supported by the source node for storage. The initialization parameters can be obtained from the network card firmware (written at the factory) or from the initialization configuration file (configured by the user).

[0107] Step 402: The network card driver in the source node calls the ib verbs interface to create a message queue entity according to the communication parameters configured by the user, and assigns a message queue entity number to each message queue entity, and then determines the maximum value of the message queue entity numbers as the target number.

[0108] The communication parameters configured by the user may be pre-configured during the application writing phase, or may be requested by the application or the network card driver to be configured by the user. The communication parameters may include but are not limited to: QP capability or type, the number of WRs to be sent, and the number of WRs that can be received.

[0109] Step 403 , the application in the source node determines whether the target number is greater than the maximum number of message queue entities that the source node supports storing. If not, step 404 is executed. If so, step 405 is executed.

[0110] During specific implementation, the application may use a comparator to determine the relationship between the target quantity and the maximum number of message queue entities that the source node supports storing.

[0111] Step 404 , the application in the source node determines whether the difference between the maximum number of message queue entities supported by the source node for storage and the target number is greater than a preset threshold, if so, execute step 405 , otherwise, execute step 409 .

[0112] In specific implementation, the application can calculate the difference between the maximum number of message queue entities supported by the source node and the target number through an adder, and determine the relationship between the difference and a preset threshold through a comparator. The preset threshold can be set according to an empirical value, for example, the preset threshold is 1000.

[0113] Step 405: The application in the source node determines the target addressing mode based on the pre-stored configuration combination information, according to the target quantity and the maximum quantity of message queue entities that the source node supports storing.

[0114] The pre-stored configuration combination information may be stored in the form of a table or code lines, and is used to record the number of message queue entities applied for by the source node, the maximum number of message queue entities supported by the source node for storage, and the correspondence between addressing modes.

[0115] Step 406: The application in the source node determines the target memory space based on the target addressing mode and the maximum number of message queue entities that the source node supports storing.

[0116] In specific implementation, the target addressing mode includes the addressing level and the base address table size of each level of addressing. When the target addressing mode and the maximum number of message queue entities supported by the source node for storage are determined, the target memory space can be determined using the following formula (2):

[0117] Q=B1×B2×…×B i ×q formula (2)

[0118] Among them, Q is the target memory space, B is the base address table size of each level of addressing, i is the number of addressing levels, and q is the storage space required for each message queue entity.

[0119] Step 407: The application program in the source node applies for memory space.

[0120] Step 408: The application in the source node uses the re-applied memory space to store the QPC created when performing RDMA communication with the target node based on the RoCE network protocol.

[0121] Step 409 , the application in the source node uses the memory space configured by the network card driver initialization to store the QPC created when performing RDMA communication with the target node based on the RoCE network protocol.

[0122] Based on the same inventive concept, the embodiment of the present application also provides a memory management device, which is applied to a source node that communicates using the RoCE network protocol. Figure 5 As shown, it is a schematic diagram of the structure of the memory management device 500, which may include:

[0123] The acquisition unit 501 is used to acquire the target number of message queue entities applied for by the source node when the source node completes the initialization configuration. The message queue entity is used to carry messages for communication between the source node and the target node. The initialization configuration is used to indicate that the source node performs initialization configuration according to a preset addressing mode and the maximum number of message queue entities supported by the source node for storage;

[0124] A first processing unit 502 is used to determine a target addressing mode according to the target number and the maximum number of message queue entities supported and stored by the source node;

[0125] The second processing unit 503 is used to determine a target memory space based on the target addressing mode and the maximum number, where the target memory space is used to store the message queue entity.

[0126] In a possible implementation manner, the first processing unit 502 is specifically configured to:

[0127] When it is determined that the target number does not match the maximum number of message queue entities supported for storage by the source node, a target addressing mode is determined according to the target number and the maximum number of message queue entities supported for storage by the source node.

[0128] In a possible implementation manner, the first processing unit 502 determines that the target number does not match the maximum number of message queue entities supported for storage by the source node in one or more of the following situations:

[0129] The target number is greater than the maximum number of message queue entities that the source node supports storing;

[0130] The difference between the maximum number of message queue entities that the source node supports storing and the target number is greater than a preset threshold.

[0131] In a possible implementation manner, the first processing unit 502 is specifically configured to:

[0132] Based on the target number and the maximum number of message queue entities supported by the source node for storage, the corresponding target addressing mode is searched from the configuration combination information pre-stored by the source node. The pre-stored configuration combination information is used to record the correspondence between the number of message queue entities applied for by the source node, the maximum number of message queue entities supported by the source node for storage, and the addressing mode.

[0133] In a possible implementation manner, the pre-stored configuration combination information is stored in the form of a table or a code line.

[0134] In one possible implementation, the target addressing mode includes the number of target addressing levels and the size of the base address table for each level of addressing;

[0135] The second processing unit 503 is specifically configured to:

[0136] Use the following formula to determine the target memory space:

[0137] Q=B1×B2×…×B i ×q formula 1

[0138] Among them, Q is the target memory space, B is the base address table size of each level of addressing, i is the number of addressing levels, and q is the storage space required for each message queue entity.

[0139] In a possible implementation, the acquiring unit 501 is specifically configured to:

[0140] Based on the communication parameters configured by the user when communicating with the target node, a message queue entity is created, and a message queue entity number is assigned to each message queue entity;

[0141] The maximum value of the message queue entity number is determined as the target number.

[0142] In a possible implementation manner, the initialization parameters of the source node initialization configuration are obtained from the network card firmware, or from a pre-acquired initialization configuration file.

[0143] In a possible implementation, the message queue entity includes: queue pair content QPC, completion queue content CQC, and work queue entity WQE.

[0144] It should be noted that the division of units in the embodiments of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. Each functional unit in the embodiments of the present application may be integrated into a processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0145] The above embodiments can be implemented in whole or in part by software, hardware, firmware or any other combination. When implemented by software, the above embodiments 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. When the computer program instructions are loaded or executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can 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 can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. 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 or data center that contains one or more available media sets. The available medium can 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. The semiconductor medium can be a solid state drive (SSD).

[0146] In a simple embodiment, those skilled in the art can imagine that the electronic device in the above embodiment can be used Figure 6 The form shown.

[0147] like Figure 6 The electronic device 600 shown includes at least one processor 601 , a memory 602 , and optionally, a communication interface 603 .

[0148] The memory 602 may be a volatile memory, such as a random access memory; the memory may also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), or the memory 602 may be any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 602 may be a combination of the above memories.

[0149] The specific connection medium between the processor 601 and the memory 602 is not limited in the embodiment of the present application.

[0150] The processor 601 may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, artificial intelligence chips, chips on chips, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. When the processor 601 communicates with other devices, data transmission may be performed through the communication interface 603, such as receiving parameters input by an object.

[0151] When electronic devices use Figure 6 When the form shown is Figure 6 The processor 601 in the electronic device can call the computer execution instructions stored in the memory 602 so that the electronic device can execute the memory management method described in any of the above method embodiments.

[0152] Specifically, Figure 5 The functions / implementation processes of the acquisition unit 501, the first processing unit 502, and the second processing unit 503 can be realized by Figure 6The processor 601 in the embodiment calls the computer execution instructions stored in the memory 602 to implement.

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

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

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

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

[0157] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A memory management method, applied to a source node communicating using a remote direct memory access RoCE network protocol of converged Ethernet, characterized in that: The method comprises: When the source node completes initialization configuration, obtaining a target number of message queue entities applied for by the source node, the message queue entity being used to carry messages for communication between the source node and the target node, the initialization configuration being used to indicate that the source node performs initialization configuration according to a preset addressing mode and a maximum number of the message queue entities supported by the source node for storage; Determining a target addressing mode according to the target quantity and a maximum number of the message queue entities supported for storage by the source node; Based on the target addressing mode and the maximum number, a target memory space is determined, and the target memory space is used to store the message queue entity.

2. The method according to claim 1, characterized in that The determining of the target addressing mode according to the target quantity and the maximum quantity of the message queue entities supported for storage by the source node comprises: When it is determined that the target number does not match the maximum number of the message queue entities that the source node supports storing, a target addressing mode is determined according to the target number and the maximum number of the message queue entities that the source node supports storing.

3. The method according to claim 2, characterized in that In one or more of the following situations, it is determined that the target number does not match the maximum number of message queue entities that the source node supports storing: The target number is greater than the maximum number of the message queue entities supported by the source node for storage; The difference between the maximum number of the message queue entities supported by the source node for storage and the target number is greater than a preset threshold.

4. The method according to claim 2, characterized in that: The determining of the target addressing mode according to the target quantity and the maximum quantity of the message queue entities supported for storage by the source node comprises: Based on the target number and the maximum number of the message queue entities supported by the source node for storage, the corresponding target addressing mode is searched from the configuration combination information pre-stored by the source node, and the pre-stored configuration combination information is used to record the correspondence between the number of message queue entities applied for by the source node, the maximum number of the message queue entities supported by the source node for storage, and the addressing mode.

5. The method according to claim 4, characterized in that The pre-stored configuration combination information is stored in the form of a table or a code line.

6. The method according to claim 1, characterized in that The target addressing mode includes the number of target addressing levels and the size of the base address table of each level of addressing; The determining of the target memory space based on the target addressing mode and the maximum number includes: Use the following formula to determine the target memory space: Q=B1×B2×…×B i ×q formula 1 Among them, Q is the target memory space, B is the base address table size of each level of addressing, i is the number of addressing levels, and q is the storage space required for each message queue entity.

7. The method according to any one of claims 1 to 6, characterized in that The step of obtaining the target number of message queue entities applied for by the source node includes: Creating a message queue entity based on the communication parameters configured by the user when communicating with the target node, and assigning a message queue entity number to each message queue entity; The maximum value of the message queue entity numbers is determined as the target number.

8. The method according to any one of claims 1 to 6, characterized in that The initialization parameters of the source node initialization configuration are obtained from the network card firmware, or from a pre-acquired initialization configuration file.

9. The method according to any one of claims 1 to 6, characterized in that: The message queue entity includes: queue pair content QPC, completion queue content CQC, and work queue entity WQE.

10. A server, characterized in that: It comprises a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of any one of the methods of claims 1 to 9.