Method and apparatus for memory allocation management

By setting memory type identifiers and determining free memory, the time-consuming clearing operation for memory with read bandwidth greater than write bandwidth was resolved, thus improving the creation and startup speed of virtual machines.

CN115562871BActive Publication Date: 2026-04-14JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
Filing Date
2022-10-28
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Existing technologies, when allocating memory, especially memory with read bandwidth greater than write bandwidth, consume a lot of time in the zeroing operation, resulting in slow virtual machine creation and startup speeds, which is particularly difficult to improve in large memory virtual machines.

Method used

By setting a memory type identifier, it can determine whether the memory is free. Only physical memory that is not free is zeroed, avoiding repeated zeroing of free memory and improving memory allocation and management efficiency.

Benefits of technology

It significantly improves the creation and startup speed of virtual machines with read bandwidth greater than write bandwidth and optimizes the memory allocation and management process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115562871B_ABST
    Figure CN115562871B_ABST
Patent Text Reader

Abstract

The application discloses a memory allocation management method and device, and relates to the technical field of computers. A specific embodiment of the method comprises the following steps: in response to a page fault exception caused by a virtual machine process accessing a user space, allocating physical memory for the user space, and obtaining a memory type identifier of the physical memory; in the case that the memory type identifier is a preset identifier, judging whether the physical memory is idle memory, and in the case that the physical memory is not idle memory, performing a zero operation on the physical memory, so that the physical memory becomes idle memory; wherein the read bandwidth of the physical memory with the preset identifier is greater than the write bandwidth. The embodiment can greatly improve the creation and startup speed of a virtual machine based on a memory with a read bandwidth greater than a write bandwidth.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a method and apparatus for memory allocation management. Background Technology

[0002] In existing technologies, when allocating memory, the kernel typically performs page table mapping and memory allocation first, and then zeroes out the allocated memory. For memory with read bandwidth greater than write bandwidth, the zeroing operation takes a significant amount of time due to write bandwidth limitations, thus increasing the creation and startup time of virtual machines. This phenomenon is particularly pronounced in memory-intensive virtual machines, and even increasing the concurrency of page table mapping and memory allocation cannot effectively improve the speed of virtual machine creation and startup. Summary of the Invention

[0003] In view of this, embodiments of the present invention provide a method and apparatus for memory allocation management. By setting a memory type identifier, it is possible to determine whether the allocated physical memory is memory with read bandwidth greater than write bandwidth. By further determining whether the allocated physical memory is free memory when it is memory with a preset identifier, and performing a zeroing operation on the physical memory when it is not free memory, and not performing a zeroing operation when it is free memory, the creation and startup speed of virtual machines based on memory with read bandwidth greater than write bandwidth can be significantly improved.

[0004] To achieve the above objectives, according to one aspect of the present invention, a method for memory allocation management is provided, comprising:

[0005] In response to a page fault exception occurring when a virtual machine process accesses user space, physical memory is allocated to the user space, and the memory type identifier of the physical memory is obtained;

[0006] If the memory type identifier is a preset identifier, determine whether the physical memory is free memory, and if the physical memory is not free memory, perform a zeroing operation on the physical memory to make the physical memory free memory; wherein, the read bandwidth of the physical memory with the preset identifier is greater than the write bandwidth.

[0007] Optionally, the method further includes: setting a memory type field for a physical memory node before allocating physical memory to the user space, and writing a memory type identifier in the memory type field according to the memory type of the physical memory during the kernel driver initialization phase.

[0008] Optionally, the method further includes: if the memory type identifier is not a preset identifier, performing a zeroing operation on the physical memory to make the physical memory free memory.

[0009] Optionally, a buddy system may be used to allocate physical memory for the user space.

[0010] Optionally, the virtual machine process uses a data plane development kit to process data packets.

[0011] According to a second aspect of the present invention, an apparatus for memory allocation management is provided, comprising:

[0012] The memory allocation module, in response to a page fault exception generated when a virtual machine process accesses user space, allocates physical memory to the user space and obtains the memory type identifier of the physical memory;

[0013] The memory clearing module determines whether the physical memory is free when the memory type identifier is a preset identifier, and performs a clearing operation on the physical memory when the physical memory is not free, so as to make the physical memory free; wherein, the read bandwidth of the physical memory with the preset identifier is greater than the write bandwidth.

[0014] Optionally, the apparatus further includes an initialization module for: setting a memory type field for a physical memory node before allocating physical memory to the user space, and writing a memory type identifier in the memory type field according to the memory type of the physical memory during the kernel driver initialization phase.

[0015] Optionally, the memory clearing module is further configured to: clear the physical memory when the memory type identifier is not a preset identifier, so as to make the physical memory free memory.

[0016] Optionally, the memory allocation module uses a buddy system to allocate physical memory to the user space.

[0017] Optionally, the virtual machine process uses a data plane development kit to process data packets.

[0018] According to a third aspect of the present invention, an electronic device for memory allocation management is provided, comprising: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in the first aspect of the present invention.

[0019] According to a fourth aspect of the present invention, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method provided in the first aspect of the present invention.

[0020] One embodiment of the above invention has the following advantages or beneficial effects: by setting a memory type identifier, it is possible to determine whether the allocated physical memory is memory with read bandwidth greater than write bandwidth; by further determining whether the allocated physical memory is free memory when the allocated physical memory is memory with a preset identifier, and by performing a zeroing operation on the physical memory when the allocated physical memory is not free memory, and not performing a zeroing operation when the allocated physical memory is free memory, the creation and startup speed of virtual machines based on memory with read bandwidth greater than write bandwidth can be greatly improved.

[0021] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description

[0022] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:

[0023] Figure 1 This is a schematic diagram of the main flow of the memory allocation and management method according to an embodiment of the present invention;

[0024] Figure 2 This is a schematic diagram of the physical memory registration process in an optional embodiment of the present invention;

[0025] Figure 3 This is a schematic diagram illustrating the principle of creating and starting a QEMU virtual machine in existing technologies;

[0026] Figure 4 This is a schematic diagram illustrating the principle of creating and starting a QEMU virtual machine in some embodiments of the present invention;

[0027] Figure 5 This is a schematic diagram of the main modules of the memory allocation and management device according to an embodiment of the present invention;

[0028] Figure 6 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied;

[0029] Figure 7 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Detailed Implementation

[0030] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0031] Typically, the CPU (Central Processing Unit / Processor) can access all peripherals connected to the address bus, including physical memory and I / O (Input / Output) devices, through the address bus. However, the access address issued by the CPU is not the physical address of these peripherals on the address bus, but a virtual address. The MMU (Memory Management Unit) translates the virtual address into a physical address before issuing it from the address bus. This virtual-to-physical address translation relationship needs to be created in the MMU; the process of creating this translation relationship is the page table mapping process. When a virtual address-to-physical address mapping is not created, or when the corresponding physical memory cannot be written to, the MMU will notify the CPU to generate a page fault. Page faults can be resolved by allocating physical memory to the virtual address. After creating the page table mapping and mapping the corresponding physical memory to the virtual address space, to ensure system stability, a cleanup operation is usually performed on the allocated physical memory. Zeroing is an operation that writes all 0s to the memory at the corresponding address. This cleanup operation converts the corresponding physical memory into free memory, allowing write operations to be performed.

[0032] For memory with read bandwidth greater than write bandwidth, zeroing operations consume a significant amount of time due to write bandwidth limitations, thus increasing the creation and startup time of virtual machines. This phenomenon is particularly pronounced in large-memory virtual machines, and even increasing the concurrency of page table mapping and memory allocation cannot effectively improve the speed of virtual machine creation and startup.

[0033] In view of this, according to one aspect of the present invention, a method for memory allocation management is provided.

[0034] Figure 1 This is a schematic diagram illustrating the main flow of the memory allocation and management method according to an embodiment of the present invention. Figure 1 As shown, the memory allocation management method according to an embodiment of the present invention includes:

[0035] Step S101: In response to a page fault exception occurring when a virtual machine process accesses user space, allocate physical memory for the user space and obtain the memory type identifier of the physical memory;

[0036] Step S102: Determine whether the memory type identifier is a preset identifier; if the memory type identifier is a preset identifier, proceed to step S103; otherwise, proceed to step S105.

[0037] Step S103: Determine whether the physical memory is free memory; if the physical memory is not free memory, proceed to step S104; otherwise, the process ends.

[0038] Step S105: Perform a zeroing operation on the physical memory to make the physical memory free memory.

[0039] In this embodiment of the invention, a memory type identifier is set for memory that can be allocated to virtual machine processes, wherein the memory type identifier corresponding to memory with read bandwidth greater than write bandwidth is a preset identifier. In practical applications, before allocating physical memory to the user space, a memory type field can be set for the physical memory node, and during the kernel driver initialization phase, the memory type identifier is written to the memory type field according to the memory type of the physical memory. For example, the memory type is indicated by adding a feature field of a node (a node in NUMA) to the memory node that can be allocated to the virtual machine process. For example, a memory_type field is added to the / sys / devices / system / node / nodeN directory of the memory node. When the kmem (a kernel driver) driver is initialized, if the physical memory allocated to the user space mapping is memory with read bandwidth greater than write bandwidth, this field is set to optane; if the physical memory allocated to the user space is memory with read bandwidth less than or equal to write bandwidth, this field is set to dram. Figure 2 This is a schematic diagram of the physical memory registration process in an optional embodiment of the present invention. For example... Figure 2 As shown, the node registration process for memory with read bandwidth greater than write bandwidth includes: step S201, memory initialization; step S202, setting the memory type identifier of the memory node to optane; step S203, registering the memory node.

[0040] In this embodiment of the invention, by setting a memory type identifier, it is possible to determine whether the allocated physical memory is memory with read bandwidth greater than write bandwidth; by further determining whether the allocated physical memory is free memory when the allocated physical memory is memory with a preset identifier, and by performing a zeroing operation on the physical memory when the allocated physical memory is not free memory, and not performing a zeroing operation when the allocated physical memory is free memory, the creation and startup speed of virtual machines based on memory with read bandwidth greater than write bandwidth can be greatly improved.

[0041] If the memory type identifier of the physical memory allocated to user space is not a preset identifier, steps S103-S105 can be used to determine whether to perform a cleanup operation, or the determination can be skipped and the physical memory can be directly zeroed out to make it free memory. For physical memory without a preset identifier, its write bandwidth is greater than or equal to its read bandwidth. Since the write bandwidth is relatively high, the zeroing operation is relatively fast. Skipping the logical determination in step S103 and directly performing the zeroing operation can improve the efficiency of memory allocation and management.

[0042] The method for determining the physical memory allocated to each user space can be selectively determined based on actual conditions. Optionally, a buddy system can be used to allocate physical memory to the user space. The buddy system is a Linux kernel memory allocation system that uses 4K pages as the management unit. Considering that some data structures are very small during system operation, embodiments of the present invention can also use slab (a memory allocation mechanism) to allocate physical memory to the user space to reduce the granularity of memory allocation.

[0043] The virtual machine process uses the Intel Data Plane Development Kit (DPDK) to process data packets. Using DPDK technology can significantly improve system forwarding performance.

[0044] The following combination Figure 3 and Figure 4 The memory allocation and management method of this invention will be described by way of example. For memory with read bandwidth greater than write bandwidth, 3D Xpoint technology can be used to significantly improve memory storage speed and density, thereby improving memory durability and reducing costs. Currently, the Linux kernel can use the kmem driver to extend memory with read bandwidth greater than write bandwidth into a separate numa node in AD mode (app direct mode, in which system software can control and manage memory).

[0045] QEMU (Quick EMUlato, a virtual machine emulation software that can be used with KVM to simulate virtual machines and can be applied to cloud computing scenarios) can allocate memory using big pages. When a QEMU virtual machine allocates big pages on a numa node where the read bandwidth is greater than the write bandwidth, the QEMU virtual machine can then provide that memory to the virtual machine guest operating system as virtual ordinary memory. Figure 3This is a schematic diagram illustrating the principle of creating and starting a QEMU virtual machine in existing technologies. When the QEMU virtual machine uses the DPDK solution, because DPDK shares memory with the virtual machine, QEMU needs to allocate all memory in advance, corresponding to the operation of touch pages. During the QEMU touch pages stage, the kernel performs page table mapping and memory allocation, and finally zeroes the memory. Since the read bandwidth of memory is greater than its write bandwidth (often many times greater), when encountering large memory-intensive virtual machines such as 1TB of memory, the kernel spends a significant amount of time performing the memory zeroing operation. Furthermore, due to write bandwidth limitations, even increasing the concurrency of touch pages cannot improve the speed of the memory zeroing operation. In this situation, the creation and startup time of the virtual machine is many times longer than with ordinary memory.

[0046] This invention addresses the characteristics of memory with read bandwidth greater than write bandwidth and the existing kernel memory allocation method by improving the kernel's process for clearing memory with read bandwidth greater than write bandwidth, thereby optimizing the startup speed of cloud hosts using large memory with read bandwidth greater than write bandwidth. Figure 4 This is a schematic diagram illustrating the principle of creating and starting a QEMU virtual machine in some embodiments of the present invention. See also Figure 4 The technical solution of this embodiment includes two parts:

[0047] First, we can indicate whether a memory node has a read bandwidth greater than a write bandwidth by adding a feature to the NUMA node. Specifically, we add a `memory_type` field to the ` / sys / devices / system / node / nodeN` directory. When the kmem driver is initialized, this field will be set to `optane` for memory nodes with read bandwidth greater than write bandwidth, and `dram` for ordinary memory nodes.

[0048] Second, when the kernel buddy system allocates a page to user space, it checks whether the memory_type field of the corresponding numa node is optane before zeroing it. If it is, it first reads the memory of this page and compares it with 0. If all values ​​are 0, it directly returns the result to the user without zeroing. If not all values ​​are 0, it performs the zeroing operation. If it is ordinary memory, the process is the same as before, and the zeroing operation is performed directly.

[0049] This embodiment uses a feature added to the numa node to determine whether the physical memory allocated to user space has a read bandwidth greater than a write bandwidth. If it does, the page is first read for evaluation; if all values ​​are 0, no zeroing operation is performed. This significantly improves the creation and startup speed of cloud servers with read bandwidth greater than write bandwidth, even when the page content is zero.

[0050] According to a second aspect of the present invention, an apparatus for implementing the above-described method is provided.

[0051] Figure 5 This is a schematic diagram of the main modules of the memory allocation and management device according to an embodiment of the present invention. Figure 5 As shown, the memory allocation management device 500 includes:

[0052] The memory allocation module 501, in response to a page fault exception generated when a virtual machine process accesses user space, allocates physical memory to the user space and obtains the memory type identifier of the physical memory;

[0053] The memory clearing module 502 determines whether the physical memory is free when the memory type identifier is a preset identifier, and performs a clearing operation on the physical memory when the physical memory is not free, so as to make the physical memory free; wherein, the read bandwidth of the physical memory with the preset identifier is greater than the write bandwidth.

[0054] Optionally, the apparatus further includes an initialization module for: setting a memory type field for a physical memory node before allocating physical memory to the user space, and writing a memory type identifier in the memory type field according to the memory type of the physical memory during the kernel driver initialization phase.

[0055] Optionally, the memory clearing module is further configured to: clear the physical memory when the memory type identifier is not a preset identifier, so as to make the physical memory free memory.

[0056] Optionally, the memory allocation module uses a buddy system to allocate physical memory to the user space.

[0057] Optionally, the virtual machine process uses a data plane development kit to process data packets.

[0058] According to a third aspect of the present invention, an electronic device for memory allocation management is provided, comprising: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in the first aspect of the present invention.

[0059] According to a fourth aspect of the present invention, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method provided in the first aspect of the present invention.

[0060] Figure 6An exemplary system architecture 600 is shown, to which the memory allocation management method or apparatus of embodiments of the present invention can be applied.

[0061] like Figure 6 As shown, system architecture 600 may include terminal devices 601, 602, and 603, a network 604, and a server 605. Network 604 serves as the medium for providing communication links between terminal devices 601, 602, and 603 and server 605. Network 604 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.

[0062] Users can use terminal devices 601, 602, and 603 to interact with server 605 via network 604 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 601, 602, and 603, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).

[0063] Terminal devices 601, 602, and 603 can be various electronic devices with displays and web browsing capabilities, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0064] Server 605 can be a server that provides various services, such as a backend management server that supports shopping websites browsed by users using terminal devices 601, 602, and 603 (for example only). The backend management server can analyze and process data such as received product information query requests, and feed back the processing results (such as target push information, product information - for example only) to the terminal devices.

[0065] It should be noted that the memory allocation and management method provided in this embodiment of the invention is generally executed by server 605, and correspondingly, the memory allocation and management device is generally located in server 605.

[0066] It should be understood that Figure 6 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0067] The following is for reference. Figure 7 It shows a schematic diagram of the structure of a computer system 700 suitable for implementing a terminal device of the present invention. Figure 7 The terminal device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.

[0068] like Figure 7As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 702 or programs loaded from storage section 708 into random access memory (RAM) 703. The RAM 703 also stores various programs and data required for the operation of the system 700. The CPU 701, ROM 702, and RAM 703 are interconnected via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0069] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, mouse, etc.; an output section 707 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 710 as needed so that computer programs read from it can be installed into the storage section 708 as needed.

[0070] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 709, and / or installed from removable medium 711. When the computer program is executed by central processing unit (CPU) 701, it performs the functions defined above in the system of this invention.

[0071] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0072] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0073] The modules described in the embodiments of the present invention can be implemented in software or hardware. The described modules can also be located in a processor; for example, a processor can be described as including a memory allocation module and a memory clearing module. The names of these modules do not necessarily limit the module itself; for example, the memory allocation module can also be described as "a module that performs a clearing operation on the physical memory".

[0074] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, which, when executed by the device, cause the device to include: in response to a page fault occurring when a virtual machine process accesses user space, allocating physical memory for the user space and obtaining a memory type identifier of the physical memory; if the memory type identifier is a preset identifier, determining whether the physical memory is free memory, and if the physical memory is not free memory, performing a zeroing operation on the physical memory to make the physical memory free memory; wherein the read bandwidth of the physical memory with the preset identifier is greater than the write bandwidth.

[0075] According to the technical solution of the present invention, by setting a memory type identifier, it is possible to determine whether the allocated physical memory is memory with read bandwidth greater than write bandwidth; by further determining whether the allocated physical memory is free memory when the allocated physical memory is memory with a preset identifier, and by performing a zeroing operation on the physical memory when the allocated physical memory is not free memory, and not performing a zeroing operation when the allocated physical memory is free memory, the creation and startup speed of virtual machines based on memory with read bandwidth greater than write bandwidth can be greatly improved.

[0076] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method for memory allocation management, characterized in that, include: In response to a page fault exception occurring when a virtual machine process accesses user space, physical memory is allocated to the user space, and the memory type identifier of the physical memory is obtained; If the memory type identifier is a preset identifier, determine whether the physical memory is free memory, and if the physical memory is not free memory, perform a zeroing operation on the physical memory to make the physical memory free memory, and do not perform a zeroing operation if the physical memory is free memory; wherein, the read bandwidth of the physical memory with the preset identifier is greater than the write bandwidth.

2. The method as described in claim 1, characterized in that, The method further includes: setting a memory type field for the physical memory node before allocating physical memory to the user space, and writing the memory type identifier in the memory type field according to the memory type of the physical memory during the kernel driver initialization phase.

3. The method as described in claim 1, characterized in that, The method further includes: when the memory type identifier is not a preset identifier, performing a zeroing operation on the physical memory to make the physical memory free memory.

4. The method as described in claim 1, characterized in that, A buddy system is used to allocate physical memory for the user space.

5. The method as described in claim 1, characterized in that, The virtual machine process uses the Data Plane Development Kit to process data packets.

6. A memory allocation management apparatus, characterized in that, include: The memory allocation module, in response to a page fault exception generated when a virtual machine process accesses user space, allocates physical memory to the user space and obtains the memory type identifier of the physical memory; The memory clearing module determines whether the physical memory is free when the memory type identifier is a preset identifier, and performs a clearing operation on the physical memory to make it free when the physical memory is not free, and does not perform a clearing operation when the physical memory is free; wherein, the read bandwidth of the physical memory with the preset identifier is greater than the write bandwidth.

7. The apparatus as claimed in claim 6, characterized in that, The device further includes an initialization module for: setting a memory type field for a physical memory node before allocating physical memory to the user space, and writing a memory type identifier in the memory type field according to the memory type of the physical memory during the kernel driver initialization phase.

8. An electronic device for memory allocation management, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-5.

9. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Virtual machine shared memory allocation method and device and electronic equipment

    CN112363796A

  • Virtual machine memory space processing method and device, equipment and medium

    CN112965789A