Intelligent network card HMU storage method, system, medium, program product and terminal based on large page memory

By adopting a HMU storage method based on large page memory in smart network cards, dynamically adjusting the memory type, solving the problems of low memory utilization efficiency and network card performance in the existing technology, and achieving more efficient memory management and system performance optimization.

CN118642667BActive Publication Date: 2025-03-18CORE YUNSHENG (HANGZHOU) ELECTRONIC TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411119251.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-15
Publication Date
2025-03-18
Estimated Expiration
2044-08-15

AI Technical Summary

Technical Problem

The existing HMU memory management methods cannot effectively deal with the default small memory pages and memory switching mechanisms of Linux systems, resulting in low memory utilization efficiency and affecting network card performance.

Method used

The HMU storage method of smart network card based on large page memory is adopted. By applying for the reservation of large page memory or ordinary page memory in the host memory, it converts it into an HMU multi-level conversion table, and sending it to the smart network card, and the memory type is dynamically adjusted to optimize system performance.

Benefits of technology

It improves memory access efficiency, reduces memory management costs, optimizes system performance, reduces memory fragmentation and resource waste, and improves system resource utilization and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118642667B_ABST
    Figure CN118642667B_ABST
Patent Text Reader

Abstract

The present application provides a smart network card HMU storage method, system, medium, program product and terminal based on large page memory. First, when the smart network card driver is initialized, the system's available large page memory support is checked. If supported, a continuous physical memory block is applied for the network card PCIe DMA from the large page memory area at one time. If the large page memory is not supported, the HMU memory is still applied from the system's ordinary memory page. The present application improves memory access efficiency, reduces management costs, optimizes system performance, saves resources, reduces host pressure, and increases flexibility. At the same time, it simplifies the memory management process and solves the problem that the existing HMU memory management method cannot effectively cope with the Linux system's default small memory pages and memory swap mechanism, resulting in low memory utilization efficiency and affecting network card performance.
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 large page memory-based smart network card HMU storage method, system, medium, program product and terminal. Background Art

[0002] With the rapid growth of cloud computing services, the complexity of business application software is increasing day by day. Smart NICs have been widely used and are taking on more and more business volume. To meet the development needs of smart NIC technology, improving the performance of storage components has become the key. In smart NICs, the Host Memory Unit (HMU) is a memory area used to process data packets. After the data packet arrives at the NIC, it will be copied to the host memory unit, and then the host processor will perform further processing. This method not only improves network performance, but also reduces the burden on the host processor. In order to reduce costs, the industry has proposed a method of using HMU memory for NIC storage, that is, putting a large amount of content with low access frequency into the host memory, and borrowing the host memory as the storage space of the NIC.

[0003] In the traditional HMU memory management method, the Smart NIC driver will apply for multiple physical memory blocks of the NIC PCIeDMA during initialization, and pass the relevant address information to the NIC Core thread for HMU management through a dedicated channel, so that it is configured into the first or multi-level HMU conversion table of the Smart NIC. When the NIC enters the running state, when the core program of other NIC services reads the HMU space, the hardware logic converts the accessed address into the corresponding PCIe address through the HMU conversion table, and then imports the data in the host memory into the HMU cache through the PCIe DMA channel. The content in the HMU cache can be read and written by all NIC service core threads until the content is swapped out.

[0004] The existing HMU memory management method has the following technical defects: First, the smart network card expects to use a larger block of HMU memory to reduce the amount of memory address storage and obtain a larger available space. However, the Linux system usually uses 4K as the default size of the memory page, which causes the smart network card to apply for a large number of discontinuous small memory blocks. Secondly, when the memory is insufficient, the Linux system will use extended memory to swap infrequently accessed content to disk space. This mechanism is not suitable for smart network cards. If the smart network card HMU memory is swapped to the swap space, it will affect the read and write speed and increase the complexity of the implementation. Finally, due to the small space limit of the HMU conversion table, when the applied memory is a non-continuous memory block, it is necessary to store the first address and size of each non-continuous memory block. When the memory block is only 4K in size, the HMU conversion table can only store less than 1G of memory space, which greatly limits the available size of the HMU memory space. Summary of the invention

[0005] In view of the shortcomings of the prior art described above, the purpose of the present application is to provide a smart network card HMU storage method, system, medium, program product and terminal based on large page memory, which is used to solve the problem that the existing HMU memory management method cannot effectively cope with the default small memory pages and memory swap mechanism of the Linux system, resulting in low memory utilization efficiency and affecting the performance of the network card.

[0006] To achieve the above-mentioned purpose and other related purposes, the first aspect of the present application provides a method for storing HMU of a smart network card based on large page memory, the method is applied to a host, the host is communicatively connected to the smart network card, and the method includes: initializing the driver of the smart network card, and obtaining the network card hardware information and the network card memory requirement configuration of the smart network card; based on the network card hardware information and the network card memory requirement configuration, judging whether large page memory can be used as the HMU memory of the smart network card, and generating a corresponding large page support status; when the large page support status is supported, generating large page memory requirements according to the network card hardware information and the network card memory requirement configuration; based on the large page memory requirements, applying for reserving large page memory in the host memory, and obtaining the memory address of the reserved large page memory; converting the memory address into an HMU multi-level conversion table, and sending the HMU multi-level conversion table to the smart network card; when the large page support status is not supported, applying for reserving ordinary page memory in the host memory, and obtaining the memory address of the reserved ordinary page memory, and sending the memory address of the ordinary page memory to the smart network card.

[0007] In some embodiments of the first aspect of the present application, the HMU multi-level conversion table includes: a memory index table: used to store multiple first index information, wherein each first index information points to a corresponding first-level memory block address table; wherein the first-level memory block address table stores multiple memory block addresses of the same size; and / or stores one or more second index information, wherein each second index information further points to a corresponding second-level memory block address table, and the second-level memory block address table stores multiple memory block addresses of the same size.

[0008] In some embodiments of the first aspect of the present application, the memory block size pointed to by the memory block address stored in the first-level memory block address table is different from the memory block size pointed to by the memory block address stored in the second-level memory block address table.

[0009] In some embodiments of the first aspect of the present application, the process of applying for reserved large page memory in the host memory based on the large page memory demand includes: based on the large page memory demand, calling the partner system to allocate large page memory in the host memory; if a sufficiently large memory block cannot be found during the large page memory allocation process, instructing the partner system to merge adjacent memory fragments to meet the large page memory demand.

[0010] In some embodiments of the first aspect of the present application, the process of sending the HMU multi-level conversion table to the smart network card includes: packaging the HMU multi-level conversion table in a preset manner to generate an HMU data packet; sending the HMU data packet to the HMU management core of the smart network card through the PCIe bus, so that the HMU management core parses the HMU data packet and stores the HMU multi-level conversion table obtained by the parsing.

[0011] In some embodiments of the first aspect of the present application, the process of applying for reserved large page memory in the host memory based on the large page memory demand includes: applying for a large page memory in the host memory, and mapping the large page memory to the virtual address space of the smart network card; allocating a physical memory block in the large page memory, obtaining the virtual address corresponding to the physical memory block, and sending the virtual address to the smart network card, so that the smart network card converts the virtual address into a corresponding physical address based on a DMA mechanism, and accesses the large page memory based on the physical address.

[0012] To achieve the above-mentioned purpose and other related purposes, the second aspect of the present application provides a large page memory-based smart network card HMU storage system, the system includes a smart network card and a host, and the interaction method of the system includes: the host initializes the driver of the smart network card and obtains the network card hardware information and the network card memory requirement configuration of the smart network card; the host determines whether the large page memory can be used as the HMU memory of the smart network card based on the network card hardware information and the network card memory requirement configuration, and generates a corresponding large page support status; when the large page support status is supported, the The host generates a large page memory requirement according to the network card hardware information and the network card memory requirement configuration; the host applies for reserving large page memory in the host memory based on the large page memory requirement, and obtains the memory address of the reserved large page memory; the host converts the memory address into an HMU multi-level conversion table, and sends the HMU multi-level conversion table to the smart network card; when the large page support status is not supported, the host applies for reserving ordinary page memory in the host memory, obtains the memory address of the reserved ordinary page memory, and sends the memory address of the ordinary page memory to the smart network card.

[0013] To achieve the above-mentioned purpose and other related purposes, the third aspect of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the intelligent network card HMU storage method based on large page memory is implemented.

[0014] To achieve the above-mentioned purpose and other related purposes, the fourth aspect of the present application provides a computer program product, which includes a computer program code. When the computer program code is run on a computer, the computer implements the large page memory-based smart network card HMU storage method.

[0015] To achieve the above-mentioned purpose and other related purposes, the fifth aspect of the present application provides an electronic terminal, including a memory, a processor and a computer program stored in the memory; the processor executes the computer program to implement the large page memory-based smart network card HMU storage method.

[0016] As described above, the large page memory-based smart network card HMU storage method, system, medium, program product and terminal of the present application have the following beneficial effects: First, the use of large page memory can improve memory access efficiency, reduce memory management costs, and accelerate the data processing and communication speed of the smart network card. Secondly, dynamically selecting the memory type according to the hardware information and memory demand configuration of the smart network card is conducive to optimizing system performance and improving overall operating efficiency. In addition, the rational use of large page memory can reduce memory fragmentation and resource waste, and improve system resource utilization and stability. Reserving large page memory or ordinary page memory can effectively reduce the burden on the host CPU and accelerate the system response speed. Most importantly, selecting the memory configuration method according to the large page support status increases the flexibility of the system, simplifies the memory management process, reduces management costs, and improves the stability of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 A flow chart of an embodiment of a smart network card HMU storage method based on large page memory of the present application is shown.

[0018] Figure 2 A flow chart of another embodiment of the intelligent network card HMU storage method based on large page memory of the present application is shown.

[0019] Figure 3 A schematic diagram of the structure of the HMU multi-level conversion table in an embodiment of the HMU storage method of the smart network card based on large page memory of the present application is shown.

[0020] Figure 4 A schematic diagram of the structure of the large page memory in an embodiment of the intelligent network card HMU storage method based on large page memory of the present application is shown.

[0021] Figure 5 A structural diagram of an embodiment of a smart network card HMU storage system based on large page memory of the present application is shown.

[0022] Figure 6 A structural diagram of an embodiment of a smart network card HMU storage terminal based on large page memory of the present application is shown. DETAILED DESCRIPTION

[0023] The following describes the embodiments of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.

[0024] Before further describing the present invention in detail, the nouns and terms involved in the embodiments of the present invention are explained. The nouns and terms involved in the embodiments of the present invention are applicable to the following interpretations:

[0025] <1> Large page memory: Large page memory refers to memory that the operating system can manage at a larger granularity than a standard page. Usually, the size of a large page is several times that of a standard page, such as 2MB or 4MB. Using large page memory can reduce the TLB (Translation Lookaside Buffer) load and improve memory access efficiency and performance.

[0026] <2> Smart NIC: A smart NIC is a network interface card with certain processing capabilities and functions. It can perform some network-related tasks through the internal processor, such as offloading the network protocol stack, packet processing, flow control and other functions, thereby reducing the burden on the host CPU.

[0027] <3> HMU (Host Memory Unit): HMU refers to the module in the SmartNIC used to manage and access the host memory. HMU works inside the SmartNIC and is responsible for processing data read and write operations, data packet cache management, and other tasks.

[0028] <4> Smart NIC driver: used to manage and control the communication between the Smart NIC device and the host system. The Smart NIC driver is responsible for initializing the NIC, configuring network parameters, and processing data packet transmission.

[0029] <5> Buddy system: A data structure used in the kernel memory management algorithm. When the buddy system allocates memory, it divides the memory block into powers of 2 to quickly locate an available memory block that can meet the requested size.

[0030] <6> Multi-level translation table: A data structure used to implement virtual address to physical address mapping, usually used in the virtual memory management of the operating system. The multi-level translation table maps the virtual address to the actual physical memory address in a hierarchical structure to support more flexible and efficient virtual memory management.

[0031] To facilitate understanding of the embodiments of the present application, first Figure 1 Detailed description. Figure 1 A flowchart of a large-page memory-based intelligent network card HMU storage method in an embodiment of the present invention is shown. Figure 2 A flowchart of a large page memory based smart network card HMU storage method in another embodiment of the present invention is shown. The large page memory based smart network card HMU storage method in this embodiment mainly includes the following steps:

[0032] Step S11: Initialize the driver of the smart network card, and obtain the network card hardware information and the network card memory requirement configuration of the smart network card.

[0033] In one embodiment of the present invention, a large page memory based smart NIC HMU storage method is implemented under the Linux operating system to support large page memory allocation and management. The process of initializing the driver of the smart NIC includes: writing the initialization function of the driver and registering the initialization function in the Linux kernel. Define and initialize the PCI driver structure, including the device ID and callback function, initialize the network card interface and configure the transmission rate.

[0034] In one embodiment of the present invention, the process of obtaining the network card hardware information of the smart network card includes the steps of accessing the PCI configuration space, communicating with the network card, parsing the device descriptor, calling the hardware query interface, parsing the data table, and analyzing and recording information. The process of obtaining the network card memory requirement configuration of the smart network card includes the key steps of evaluating network traffic and workload, analyzing application scenarios and performance requirements, determining memory size and type, memory management and allocation, memory protection and isolation, and dynamic adjustment and optimization. By obtaining the network card hardware information and the network card memory requirement configuration of the smart network card, the memory requirements of the smart network card can be effectively evaluated, configured, and managed to achieve more efficient data processing and network performance.

[0035] Figure 2A flow chart of another embodiment of the present invention is shown. When the smart network card driver is initialized, it will first obtain the hardware information of the network card and the configuration information of the memory requirements. It will then check whether the system supports system large pages to determine whether the large page memory can be used for the HMU memory of the smart network card. If the system supports large pages, the driver will reserve large page memory according to the large page usage plan, and convert the acquired memory address into a PCIe bus address. Then, the memory block size information is converted together into the format of the HMU conversion table that can be stored in the smart network card, and packaged into a message format that can be recognized by the smart network card, and sent to the HMU management core of the smart network card through the PCIe bus for storage. If there is not enough large page memory in the system for HMU to use, the traditional system normal page memory will still be selected to ensure that the HMU mechanism will not fail due to insufficient large pages.

[0036] Step S12: Based on the network card hardware information and the network card memory requirement configuration, determine whether large page memory can be used as the HMU memory of the smart network card, and generate a corresponding large page support status.

[0037] In one embodiment of the present invention, the process of determining whether large page memory can be used as the HMU memory of the smart network card includes: based on the data access mode of the smart network card, including read-write ratio, access order, data block size, etc., evaluating the impact of large page memory on data access efficiency. Analyzing the memory allocation frequency and memory page failure times of the smart network card to determine whether the current smart network card can allocate memory blocks frequently, and whether large page memory can effectively reduce the overhead caused by memory imaging. And generating large page support status based on the above analysis results.

[0038] In one embodiment of the present invention, the large page support status includes: support status and current configuration status. The support status indicates whether the host supports the large page memory function, and the current configuration status indicates whether the large page memory is used as the HMU memory of the smart network card under the current host configuration. By generating large page support status information, it can be confirmed whether the smart network card can make full use of the large page memory in the current environment, so as to take corresponding measures to optimize the memory configuration and improve the performance and efficiency of the system.

[0039] Step S13: When the large page support status is supported, generate a large page memory requirement according to the network card hardware information and the network card memory requirement configuration. Apply for reserving large page memory in the host memory based on the large page memory requirement, and obtain the memory address of the reserved large page memory. Convert the memory address into an HMU multi-level conversion table, and send the HMU multi-level conversion table to the smart network card.

[0040] In one embodiment of the present invention, the process of applying for reserved large page memory in the host memory based on the large page memory demand includes: based on the large page memory demand, calling the partner system to allocate large page memory in the host memory; if a sufficiently large memory block cannot be found during the large page memory allocation process, allowing the partner system to merge adjacent memory fragments to meet the large page memory demand.

[0041] In one embodiment of the present invention, the process of applying for reserved large page memory in the host memory based on the large page memory demand includes: applying for a large page memory in the host memory, and mapping the large page memory to the virtual address space of the smart network card; allocating a physical memory block in the large page memory, obtaining a virtual address corresponding to the physical memory block, and sending the virtual address to the smart network card, so that the smart network card converts the virtual address into a corresponding physical address based on the DMA mechanism, and accesses the large page memory based on the physical address.

[0042] In one embodiment of the present invention, the large page memory requirement includes: large page memory size, large page memory quantity, large page memory allocation strategy, large page memory reserved address range and large page memory usage mode. Among them, the large page memory size indicates the size of each large page memory block, such as 2MB or 4MB. The large page memory quantity indicates how many large page memory blocks need to be reserved to meet the memory requirements of the smart network card. The large page memory allocation strategy indicates how to allocate and manage large page memory in the host memory, including static allocation or dynamic allocation, the location of memory allocation, etc. The large page memory reserved address range indicates the address range of the large page memory to be reserved to ensure that there will be no conflict with other memory areas. The large page memory usage indicates how it is used by the smart network card, for example, as a continuous data buffer, etc.

[0043] In one embodiment of the present invention, the HMU multi-level conversion table includes: a memory index table: used to store multiple first index information, wherein each first index information points to a corresponding first-level memory block address table; wherein the first-level memory block address table stores multiple memory block addresses of the same size; and / or stores one or more second index information, wherein each second index information further points to a corresponding second-level memory block address table, and the second-level memory block address table stores multiple memory block addresses of the same size.

[0044] In one embodiment of the present invention, the size of the memory block pointed to by the memory block address stored in the primary memory block address table is different from the size of the memory block pointed to by the memory block address stored in the secondary memory block address table.

[0045] In one embodiment of the present invention, the process of sending the HMU multi-level conversion table to the smart network card includes: packaging the HMU multi-level conversion table in a preset manner to generate an HMU data packet; sending the HMU data packet to the HMU management core of the smart network card through the PCIe bus, so that the HMU management core parses the HMU data packet and stores the HMU multi-level conversion table obtained by the parsing.

[0046] Figure 3 The structural diagram of the HMU multi-level conversion table in one embodiment of the present invention is shown. Among them, the intelligent network card adopts a multi-level storage method when storing the HMU memory address, and stores memory blocks of different sizes in different tables. In particular, the specific memory address is not stored in table S, but different table information is stored, and then the table storing the specific memory address is found according to this information to obtain the available HMU memory address. The entry_i in table S points to tableX, and further, the entry_i in tableX stores the address information of the memory block obtained from the large page memory. The entry_j in table S points to tableY, and the entry_k in tableY stores the address information of the memory block size different from that in table Z. In some other embodiments, tableX and tableY can also point to other tables to form a multi-level conversion table with a deeper depth. The present invention does not limit the number of levels contained in the multi-level conversion table, but limits the pointing relationship between different levels of the multi-level conversion table.

[0047] Step S14: When the large page support status is not supported, apply to reserve ordinary page memory in the host memory, obtain the memory address of the reserved ordinary page memory, and send the memory address of the ordinary page memory to the smart network card.

[0048] In the prior art, the system defaults to a normal page size of 4KB, and a maximum of 1024 consecutive pages of memory can be applied for, that is, a 4MB memory block. If the HMU memory requires a memory size of 8GB, 2048 4MB memory blocks are required. If a 2MB memory block is used, 4096 2MB memory blocks are required. This information needs to be integrated and stored in the HMU memory conversion table of the smart network card. When the system is running for a long time, if the driver cannot allocate a 2MB memory block, in the worst case, the partner system will only be able to allocate 4KB pages, and due to hardware limitations, it can only support a maximum of 512MB of HMU memory. Furthermore, according to Figure 4As shown, the present invention uses system large pages as HMU memory. If 1G large pages are used, 8GB HMU memory only needs 8 pages to meet the requirements. If these pages are continuous, they can be stored in a connected manner. Even if they are not continuous, only the information of these pages needs to be stored, and very little information is required. If 2MB large pages are selected, a maximum of 4096 pages are required to meet the requirements of 8GB HMU memory. In addition, storing large page memory addresses actually occupies fewer bits of the memory address. Taking a 64-bit system as an example, storing a 2MB page header address only requires 36 bits, and the other 28 bits can be used to store other information, such as translated flags, ReqID and other identifiers. If a 4KB page header address is stored (52 bits are used), only the last 12 bits can be used to store other information.

[0049] It is worth noting that the present invention uses system large pages as HMU memory, which can significantly reduce storage requirements and improve memory utilization. By using 1G large pages or 2MB large pages, the storage information is greatly simplified and the flexibility of storage space is increased. Compared with the traditional method, the present invention requires fewer bits when storing large page memory addresses, can more effectively manage HMU memory, and improve system performance and efficiency.

[0050] In the embodiments of the present application, words such as "first" and "second" are used to distinguish the same items or similar items with basically the same functions and effects. For example, the first index information and the second index information are only used to distinguish different index information, and do not limit their order. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit them to be different.

[0051] It should be noted that in the embodiments of the present application, words such as "exemplary" or "for example" represent examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0052] In the embodiments of the present application, "at least one" refers to one or more, and "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can represent: a, b, c, ab, ac, bc or abc, where a, b, c can be single or multiple.

[0053] Figure 5 is a schematic block diagram of a large page memory based intelligent network card HMU storage system provided in an embodiment of the present application. Figure 5 As shown, the system includes a smart network card and a host, and the interaction mode of the system includes:

[0054] The host initializes the driver of the smart network card and obtains the network card hardware information and the network card memory requirement configuration of the smart network card; the host determines whether large page memory can be used as the HMU memory of the smart network card based on the network card hardware information and the network card memory requirement configuration, and generates a corresponding large page support status; when the large page support status is supported, the host generates a large page memory requirement according to the network card hardware information and the network card memory requirement configuration; the host applies for reserving large page memory in the host memory based on the large page memory requirement, and obtains the memory address of the reserved large page memory; the host converts the memory address into an HMU multi-level conversion table, and sends the HMU multi-level conversion table to the smart network card; when the large page support status is not supported, the host applies for reserving ordinary page memory in the host memory, obtains the memory address of the reserved ordinary page memory, and sends the memory address of the ordinary page memory to the smart network card.

[0055] In one embodiment of the present invention, Figure 5As shown, the host includes a smart network card driver and a host memory. The smart network card driver is connected to the HMU management core of the smart network card through a PCIe bus. The host memory contains a large page memory, which contains one or more HMU memory blocks. On the smart network card side, the HMU management core is used to manage the module or thread that configures the HMU memory translation table. The HMU management core is connected to a storage module that stores the HMU multi-level table. The storage module is used to store the HMU address space. Multiple sub-tables can be stored in the smart network card, and one or more levels of address lookup are used for address translation as needed. The HMU cache exists in the smart network card as a cache of the HMU memory, which can improve the reading and writing speed of the smart network card to the data stored in the HMU memory.

[0056] In one embodiment of the present invention, the process of applying for reserved large page memory in the host memory based on the large page memory demand includes: applying for a large page memory in the host memory, and mapping the large page memory to the virtual address space of the smart network card; allocating a physical memory block in the large page memory, obtaining a virtual address corresponding to the physical memory block, and sending the virtual address to the smart network card, so that the smart network card converts the virtual address into a corresponding physical address based on the DMA mechanism, and accesses the large page memory based on the physical address.

[0057] Furthermore, the operations performed by the smart network card in the above process include: the smart network card receives a virtual address sent by the host, and the virtual address is used to identify the address identifier of the required memory block with the host. After receiving the virtual address, the DMA controller inside the smart network card converts the virtual address into a corresponding physical address to achieve mapping between the virtual address and the physical address through the DMA controller. Based on the physical address, the smart network card directly accesses the corresponding physical memory block through the DMA mechanism, and transmits data between the host memory and the smart network card to speed up data transmission, reduce CPU intervention, and improve system efficiency.

[0058] It should be understood that the specific process of each module executing the above corresponding steps has been described in detail in the above method embodiment, and for the sake of brevity, it will not be repeated here.

[0059] It should also be understood that the division of modules 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. In addition, each functional module in each embodiment of the present application may be integrated into a processor, or may exist physically separately, or two or more modules may be integrated into one module. The above-mentioned integrated modules may be implemented in the form of hardware or in the form of software functional modules.

[0060] Figure 6is a schematic block diagram of an electronic terminal provided in an embodiment of the present application. Figure 6 As shown, the electronic terminal includes: at least one processor 601, a memory 602, at least one network interface 603 and a user interface 605. The various components in the device are coupled together through a bus system 604. It can be understood that the bus system 604 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 604 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, Figure 6 In the specification, various buses are labeled as bus systems.

[0061] The user interface 605 may include a display, a keyboard, a mouse, a trackball, a click gun, keys, buttons, a touch pad or a touch screen.

[0062] It is understood that the memory 602 can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM). The memory described in the embodiments of the present invention is intended to include but is not limited to these and any other suitable categories of memory.

[0063] The memory 602 in the embodiment of the present invention is used to store various categories of data to support the operation of the electronic terminal 600. Examples of these data include: any executable program for operating on the electronic terminal 600, such as an operating system 6021 and an application 6022; the operating system 6021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks. The application 6022 may include various applications, such as a media player (Media Player), a browser (Browser), etc., for implementing various application services. The large page memory-based smart network card HMU storage method provided in the embodiment of the present invention may be included in the application 6022.

[0064] The method disclosed in the above embodiment of the present invention can be applied to the processor 601, or implemented by the processor 601. The processor 601 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 601 or the instruction in the form of software. The above processor 601 may be a general processor, a digital signal processor (DSP, Digital Signal Processor), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor 601 can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiment of the present invention. The general processor 601 may be a microprocessor or any conventional processor, etc. In combination with the steps of the accessory optimization method provided in the embodiment of the present invention, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, which is located in a memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.

[0065] In an exemplary embodiment, the electronic terminal 600 may be implemented by one or more application specific integrated circuits (ASIC), DSP, programmable logic device (PLD), complex programmable logic device (CPLD) to execute the aforementioned method.

[0066] According to the method provided in the embodiment of the present application, the present application also provides a computer program product, which includes: a computer program code, when the computer program code is run on a computer, the computer executes Figures 1 to 4 A smart network card HMU storage method based on large page memory in any of the embodiments shown.

[0067] According to the method provided in the embodiment of the present application, the present application also provides a computer-readable storage medium, which stores a program code, and when the program code is run on a computer, the computer executes Figures 1 to 4 A smart network card HMU storage method based on large page memory in any of the embodiments shown.

[0068] The terms "component", "module", "system", etc. used in this specification are used to represent computer-related entities, hardware, firmware, a combination of hardware and software, software, or software in execution. For example, a component can be, but is not limited to, a process, a processor, an object, an executable file, an execution thread, a program and / or a computer running on a processor. By way of illustration, both applications and computing devices running on a computing device can be components. One or more components may reside in a process and / or an execution thread, and a component may be located on a computer and / or distributed between two or more computers. In addition, these components may be executed from various computer-readable media having various data structures stored thereon. Components may, for example, communicate through local and / or remote processes according to signals having one or more data packets (e.g., data from two components interacting with another component between a local system, a distributed system and / or a network, such as the Internet interacting with other systems through signals).

[0069] Those of ordinary skill in the art will appreciate that the various illustrative logical blocks and steps described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0070] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0071] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0072] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0073] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0074] In the above embodiments, the functions of each functional unit can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions (programs). When the computer program instructions (programs) are loaded and executed on a computer, the process or function according to the embodiment of the present application 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 a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (Digital Subscriber Line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. 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 includes one or more available media integrated. Available media may be magnetic media (e.g., floppy disks, hard disks, tapes), optical media (e.g., high-density digital video discs (DVDs), or semiconductor media (e.g., solid state disks (SSDs)).

[0075] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can essentially or in other words, the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program codes.

[0076] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0077] In summary, the present application provides a smart network card HMU storage method, system, medium, program product and terminal based on large page memory. The present invention provides a storage mechanism for improving the smart network card HMU. When the smart network card driver is initialized, it checks the support of the large page memory available in the system. If supported, a continuous 1GB or larger physical memory block is applied from the large page memory area at one time for the network card PCIe DMA. If the large page memory is not supported, the memory of the HMU is still applied from the system's ordinary memory page. The advantages of the present application are to improve memory access efficiency, reduce management costs, optimize system performance, save resources, reduce host pressure, increase flexibility and simplify management processes, and solve the problem that the existing HMU memory management method cannot effectively cope with the Linux system's default small memory page and memory exchange mechanism, resulting in low memory utilization efficiency and affecting the performance of the network card. Therefore, the present application effectively overcomes the various shortcomings in the prior art and has a high industrial utilization value.

[0078] The above embodiments are merely illustrative of the principles and effects of the present application and are not intended to limit the present application. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present application. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed in the present application shall still be covered by the claims of the present application.

Claims

1. A large page memory based intelligent network card HMU storage method, characterized in that: The method is applied to a host, the host is communicatively connected to a smart network card, and the method includes: Initialize the driver of the smart network card and obtain the network card hardware information and memory requirement configuration of the smart network card; Based on the network card hardware information and the network card memory requirement configuration, determine whether large page memory can be used as the HMU memory of the smart network card, and generate a corresponding large page support status; When the large page support state is supported, a large page memory demand is generated according to the network card hardware information and the network card memory demand configuration; based on the large page memory demand, a large page memory is reserved in the host memory, and a memory address of the reserved large page memory is obtained; the memory address is converted into an HMU multi-level conversion table, and the HMU multi-level conversion table is sent to the smart network card; including: packaging the HMU multi-level conversion table in a preset manner to generate an HMU data packet; sending the HMU data packet to the HMU management core of the smart network card through the PCIe bus, so that the HMU management core parses the HMU data packet, and the HMU multi-level conversion table obtained by the parsing is converted into an HMU multi-level conversion table; The HMU multi-level conversion table is stored; the HMU multi-level conversion table includes: a memory index table: used to store multiple first index information, wherein each first index information points to a corresponding first-level memory block address table; wherein the first-level memory block address table stores multiple memory block addresses of the same size; and / or stores one or more second index information, wherein each second index information further points to a corresponding second-level memory block address table, wherein the second-level memory block address table stores multiple memory block addresses of the same size; the memory block size pointed to by the memory block address stored in the first-level memory block address table is different from the memory block size pointed to by the memory block address stored in the second-level memory block address table; When the large page support status is not supported, an application is made to reserve a normal page memory in the host memory, and a memory address of the reserved normal page memory is obtained, and the memory address of the normal page memory is sent to the smart network card.

2. The large page memory based intelligent network card HMU storage method according to claim 1, characterized in that: The process of applying for reserved large page memory in the host memory based on the large page memory requirement includes: Based on the large page memory requirement, calling the partner system to allocate large page memory in the host memory; If a sufficiently large memory block cannot be found during the allocation of the large page memory, the buddy system is instructed to merge adjacent memory fragments to meet the large page memory requirement.

3. The intelligent network card HMU storage method based on large page memory according to claim 1 is characterized in that: The process of applying for reserved large page memory in the host memory based on the large page memory requirement includes: Apply for a large page memory in the host memory, and map the large page memory to the virtual address space of the smart network card; A physical memory block is allocated in the large page memory, a virtual address corresponding to the physical memory block is obtained, and the virtual address is sent to the smart network card, so that the smart network card converts the virtual address into a corresponding physical address based on a DMA mechanism, and accesses the large page memory based on the physical address.

4. A large page memory based smart network card HMU storage system, characterized in that: The system includes a smart network card and a host, and the interaction mode of the system includes: The host initializes the driver of the smart network card and obtains the network card hardware information and the network card memory requirement configuration of the smart network card; The host determines whether large page memory can be used as the HMU memory of the smart NIC based on the NIC hardware information and the NIC memory requirement configuration, and generates a corresponding large page support status; When the large page support status is supported, the host generates a large page memory requirement according to the network card hardware information and the network card memory requirement configuration; the host applies for reserving large page memory in the host memory based on the large page memory requirement, and obtains the memory address of the reserved large page memory; the host converts the memory address into an HMU multi-level conversion table, and sends the HMU multi-level conversion table to the smart network card; including: packaging the HMU multi-level conversion table in a preset manner to generate an HMU data packet; sending the HMU data packet to the HMU management core of the smart network card through the PCIe bus, so that the HMU management core parses the HMU data packet, and parses the HMU data packet. The HMU multi-level conversion table is stored; the HMU multi-level conversion table includes: a memory index table: used to store multiple first index information, wherein each first index information points to a corresponding first-level memory block address table; wherein the first-level memory block address table stores multiple memory block addresses of the same size; and / or stores one or more second index information, wherein each second index information further points to a corresponding second-level memory block address table, wherein the second-level memory block address table stores multiple memory block addresses of the same size; the memory block size pointed to by the memory block address stored in the first-level memory block address table is different from the memory block size pointed to by the memory block address stored in the second-level memory block address table; When the large page support status is not supported, the host applies for reserving ordinary page memory in the host memory, obtains the memory address of the reserved ordinary page memory, and sends the memory address of the ordinary page memory to the smart network card.

5. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the intelligent network card HMU storage method based on large page memory described in any one of claims 1 to 3 is implemented.

6. A computer program product, characterized in that The computer program product includes computer program codes. When the computer program codes are executed on a computer, the computer is enabled to implement the large page memory-based intelligent network card HMU storage method according to any one of claims 1 to 3.

7. An electronic terminal comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the large page memory-based smart network card HMU storage method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Method and device for improving performance of transparent large page of memory, user equipment and storage medium

    CN112596913A

  • Memory allocation method, device and equipment and readable storage medium

    CN115543618A