WO2016119618A1 - Remote memory allocation method, device and system - Google Patents

Remote memory allocation method, device and system Download PDF

Info

Publication number
WO2016119618A1
WO2016119618A1 PCT/CN2016/071483 CN2016071483W WO2016119618A1 WO 2016119618 A1 WO2016119618 A1 WO 2016119618A1 CN 2016071483 W CN2016071483 W CN 2016071483W WO 2016119618 A1 WO2016119618 A1 WO 2016119618A1
Authority
WO
WIPO (PCT)
Prior art keywords
memory
node
remote
computing node
storage space
Prior art date
Application number
PCT/CN2016/071483
Other languages
French (fr)
Chinese (zh)
Inventor
李辉
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2016119618A1 publication Critical patent/WO2016119618A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a remote memory allocation method, apparatus, and system.
  • Physical memory is one of the important components in a computer, and it is a bridge to communicate with the CPU. All programs in the computer run in memory, so the performance of physical memory has a huge impact on the computer.
  • the first terminal device when the physical memory of the first terminal device is too small to meet the requirement, the first terminal device usually requests remote memory from other terminal devices to expand the physical memory of the first terminal device.
  • other terminal devices for the sake of convenience, the following "second terminal device” replaces “other terminal device"
  • a terminal device to serve as the remote memory of the first terminal device A terminal device to serve as the remote memory of the first terminal device.
  • the disadvantage of this scheme is that since the physical memory size of the second terminal device is fixed, the remote memory allocated to the computing node cannot exceed the upper limit of the free physical memory in the second terminal device.
  • the present invention provides a remote memory allocation method, which is used to limit the allocation of remote memory to a computing node without being limited by the upper limit of physical memory in the memory node.
  • an embodiment of the present invention provides a remote memory allocation method, where the method includes:
  • the memory node receives a request sent by the computing node, the request instructing the computing node to apply for remote memory of the XB to the memory node, where the memory node and the computing node are connected by network communication, the X Greater than zero and less than 2 n , the n is the data width of the memory node CPU general purpose register;
  • the memory node allocates the said node from the free kernel memory of the memory node The first kernel memory of XB;
  • the method After the memory node allocates the first kernel memory of the XB from the free kernel memory of the memory node for the computing node, and before the computing node reads and writes data to the remote memory, the method also includes:
  • the memory node maps the first kernel memory to the first storage space of the memory node, so as to allocate the remote memory to the computing node, so that the computing node is to the first storage space Read and write data, the size of the first storage space is the XB; the first storage space is physical memory, or the first storage space is virtual memory, or the first storage space is physical memory And virtual memory.
  • the request further indicates that the remote memory is a remote physical memory
  • the request further indicates that the remote memory is a remote virtual memory
  • the request further indicates that the remote memory is remote physical memory and remote virtual memory.
  • the memory node maps the first kernel memory to the first storage space of the memory node, so as to allocate the remote memory to the computing node, so that the computing node is to the first storage space Reading and writing data, the size of the first storage space is the XB, and specifically includes:
  • the memory node maps the first kernel memory to a first physical memory of the memory node to implement allocating the remote physical memory to the computing node, thereby causing the computing node to the first physical
  • the memory reads and writes data, and the size of the first physical memory is the XB.
  • the first embodiment of the first aspect or the second embodiment of the first aspect in a third embodiment of the first aspect,
  • the request further indicates a first start address, where the first start address refers to an address of the remote memory start location facing the computing node;
  • the method further includes:
  • the memory node establishes a mapping relationship between the first start address and a second start address, where the second start address refers to an address of the first kernel memory start position in the free core memory.
  • the first embodiment of the first aspect or the third embodiment of the first aspect in a fourth implementation manner of the first aspect,
  • the memory node allocates the first kernel memory of the XB to the computing node from the free kernel memory of the memory node, and specifically includes:
  • the memory node allocates the first kernel memory from the free core memory to the computing node.
  • an embodiment of the present invention provides a remote memory allocation method, where the method includes:
  • the memory node receives a request sent by the computing node, where the request indicates that the computing node requests the remote memory of the XB from the memory node, where the X is greater than zero and less than 2 n , and the n is the memory node CPU a data width of the general purpose register, wherein the memory node and the computing node are connected by a network communication;
  • the memory node allocates, according to the request, the first logical memory of the XB from the idle logical memory of the first target process to the computing node, where the first target process refers to running in the memory node, a first interface that interacts with the computing node and can allocate a logical memory to the computing node through the first interface, where the idle logical memory of the first target process is greater than or equal to the XB;
  • the method also includes:
  • the memory node Mapping, by the memory node, the first logical memory to a first storage space of the memory node, to implement allocating the remote memory to the computing node, thereby causing the computing node to move to the first storage space Reading and writing data; wherein the size of the first storage space is the XB, the first storage space is physical memory and virtual memory, or the first storage space is physical memory, or the first The storage space is virtual memory.
  • the method After the memory node receives the request sent by the computing node, and the memory node allocates the first logical memory of the XB from the idle logical memory of the first target process to the computing node according to the request, the method also includes:
  • the memory node selects the first target process from among all processes running on the memory node.
  • the method After the memory node receives the request sent by the computing node, and the memory node allocates the first logical memory of the XB from the idle logical memory of the first target process to the computing node according to the request, the method also includes:
  • the memory node creates the first target process and allocates logical memory for the first target process.
  • the request further indicates that the remote memory is a remote physical memory
  • the request further indicates that the remote memory is a remote virtual memory
  • the request further indicates that the remote memory is remote physical memory and remote virtual memory.
  • a fourth implementation manner of the second aspect in the case that the request further indicates that the remote memory is a remote physical memory,
  • Mapping by the memory node, the first logical memory to a first storage space of the memory node, to implement allocating the remote memory to the computing node, thereby causing the computing node to move to the first storage space
  • Read and write data including:
  • the memory node maps the first logical memory to a first physical memory of the memory node to implement allocating the remote physical memory to the computing node, thereby causing the computing node to the first physical
  • the memory reads and writes data, and the size of the first physical memory is the XB.
  • the request further indicates a first start address, where the first start address refers to an address of the remote memory start location facing the computing node;
  • the method further includes:
  • the memory node establishes a mapping relationship between the first start address and a second start address, where the second start address refers to an address of the first logical memory start position in the idle logical memory .
  • the number of cores of the memory node is greater than the number of processes running the memory node before the first target process is created
  • the number of processes running on the memory node does not exceed The number of cores of the memory node.
  • an embodiment of the present invention provides a remote memory allocation device, where the device includes:
  • a receiving unit configured to receive a request sent by the computing node, where the request instructs the computing node to apply for a remote memory of the XB to the memory node, where the X is greater than zero and less than 2 n , and the n is the CPU of the memory node
  • the data width of the register
  • An allocating unit configured to allocate, by the free kernel memory of the memory node, the first kernel memory of the XB to the computing node;
  • the allocating unit allocates the first kernel memory of the XB from the free kernel memory of the memory node to the computing node, and before the computing node reads and writes data to the remote memory,
  • mapping unit configured to map the first kernel memory to a first storage space of the memory node, to implement allocating the remote memory to the computing node, thereby causing the computing node to the first storage Spatially reading and writing data, the size of the first storage space is the XB; the first storage space is physical memory, or the first storage space is virtual memory, or the first storage space is physical Memory and virtual memory.
  • the request further indicates that the remote memory is a remote physical memory
  • the request further indicates that the remote memory is a remote virtual memory
  • the request further indicates that the remote memory is remote physical memory and remote virtual memory.
  • the mapping unit is specifically configured to map the first kernel memory to the first physical memory of the memory node, so as to implement allocating the remote physical memory to the computing node, thereby causing the computing node to
  • the first physical memory reads and writes data, and the size of the first physical memory is the XB.
  • the request further indicates a first start address, where A starting address is an address of the remote memory starting location facing the computing node;
  • the device also includes:
  • the establishing unit is configured to establish a mapping relationship between the first starting address and the second starting address, where the second starting address is an address of the first kernel memory starting position in the free core memory.
  • an embodiment of the present invention provides a remote memory allocation device, where the device includes:
  • a receiving unit configured to receive a request sent by the computing node, where the request instructs the computing node to apply for a remote memory of the XB to the memory node, where the X is greater than zero and less than 2 n , and the n is the memory node a data width of a CPU general purpose register, wherein the memory node and the computing node are connected by a network communication;
  • An allocating unit configured to allocate, according to the request, the first logical memory of the XB from the idle logical memory of the first target process, where the first target process refers to running in the memory node, a process having a first interface that interacts with the computing node and capable of allocating logical memory to the computing node through the first interface, the idle logical memory of the first target process is greater than or equal to the XB;
  • the allocating unit allocates the first logical memory of the XB from the idle logical memory of the first target process to the computing node, and before the computing node reads and writes data to the remote memory,
  • mapping unit configured to map the first logical memory to a first storage space of the memory node, to implement allocating the remote memory to the computing node, so that the computing node is to the first storage Spatially reading and writing data, the size of the first storage space is the XB; the first storage space is physical memory and virtual memory, or the first storage space is physical memory, or the first storage The space is virtual memory.
  • the device After the receiving unit receives the request sent by the computing node, and the allocating unit allocates the first logical memory of the XB from the idle logical memory of the first target process to the computing node according to the request,
  • the device also includes:
  • a selection unit for selecting the first target process from among all processes running on the memory node.
  • the device After the receiving unit receives the request sent by the computing node, and the allocating unit allocates the first logical memory of the XB from the idle logical memory of the first target process to the computing node according to the request,
  • the device also includes:
  • the request further indicates that the remote memory is a remote physical memory
  • the request further indicates that the remote memory is a remote virtual memory
  • the request further indicates that the remote memory is remote physical memory and remote virtual memory.
  • the mapping unit is specifically configured to map the first logical memory to the first physical memory of the memory node, so as to implement allocating the remote physical memory to the computing node, thereby causing the computing node to
  • the first physical memory reads and writes data, and the size of the first physical memory is the XB.
  • the request further indicates a first start address, where the first start address refers to an address of the remote memory start location facing the computing node;
  • the device also includes:
  • a establishing unit configured to establish a mapping relationship between the first starting address and a second starting address, where the second starting address refers to a starting position of the first logical memory in the idle logical memory address.
  • the number of cores of the memory node is greater than the number of processes running the memory node before the first target process is created
  • the number of processes running on the memory node does not exceed the number of cores of the memory node.
  • an embodiment of the present invention provides a remote memory allocation system, where the system includes a computing node, a memory node, and a third implementation manner of the first to third aspects of the third aspect or the third aspect.
  • the computing node is configured to send the request received by the remote memory allocation device
  • the memory node is configured to provide the first storage space
  • the computing node is further configured to acquire the first storage space as the remote memory.
  • the remote memory allocation device is integrated in the memory node.
  • an embodiment of the present invention provides a remote memory allocation system, where the system includes a computing node, a memory node, and a sixth implementation manner of the first to fourth aspects of the fourth aspect or the fourth aspect.
  • the computing node is configured to send the request received by the remote memory allocation device
  • the memory node is configured to provide the first storage space
  • the computing node is further configured to acquire the first storage space as the remote memory.
  • the remote memory allocation device is integrated in the memory node. It can be seen that, in the remote memory allocation method provided by the embodiment of the present invention, the memory node allocates the first kernel memory from the free kernel memory of the memory node according to the request of the computing node, and then maps the first kernel memory to The first storage space is configured to allocate remote memory for the compute node.
  • the kernel memory is the memory allocated by the operating system for the kernel object, and is the logical memory.
  • the size of the kernel memory is 2 n B, where n is the data width of the general-purpose register of the memory node CPU. That is, the kernel memory is much larger than the physical memory of the memory node.
  • the kernel memory can be mapped not only to physical memory but also to virtual memory (ie, virtual memory expanded from external memory). Therefore, with the technical solution provided by the embodiment of the present invention, when the computing node applies for the remote memory to the memory node, the computing node can apply for a larger remote memory to the memory node without being limited by the upper limit of the free physical memory in the memory node.
  • FIG. 1 is a schematic diagram of an application scenario of a remote memory allocation method according to an embodiment of the present disclosure
  • FIG. 1b is a schematic flowchart of a remote memory allocation method according to an embodiment of the present invention.
  • 1c is a schematic flowchart of a remote memory allocation method according to an embodiment of the present invention.
  • FIG. 2a is a schematic structural diagram of a remote memory allocation device according to an embodiment of the present invention.
  • FIG. 2b is a schematic structural diagram of another remote memory allocation device according to an embodiment of the present invention.
  • 2c is a schematic structural diagram of still another remote memory allocation device according to an embodiment of the present invention.
  • FIG. 2d (1) is a schematic structural diagram of still another remote memory allocation device according to an embodiment of the present invention.
  • 2d (2) is a schematic structural diagram of still another remote memory allocation device according to an embodiment of the present invention.
  • 2 e is a schematic structural diagram of still another remote memory allocation device according to an embodiment of the present invention.
  • FIG. 3a is a schematic structural diagram of a remote memory allocation system according to an embodiment of the present invention.
  • FIG. 3b is a schematic structural diagram of another remote memory allocation system according to an embodiment of the present invention.
  • each process can obtain an independent logical address space, thereby accessing the physical address through a logical address, and can provide protection of the logical address space.
  • the general processor includes a Memeory Management Unit (MMU) and a Translation Lookside Buffer (TLB) to optimize memory access performance.
  • MMU Memeory Management Unit
  • TLB Translation Lookside Buffer
  • virtual memory It refers to the dynamic expansion of physical memory based on virtual memory technology. Specifically, the expansion of physical memory is realized by using an external storage device (HDD/SDD/NVM, etc.).
  • an external storage device HDD/SDD/NVM, etc.
  • a schematic diagram of an application scenario of a remote memory allocation method includes a memory node 11 and a computing node 13, and a high-speed interconnect interface between the memory node 11 and the computing node 13 Connected to implement information interaction between the memory node 11 and the compute node 13.
  • FIG. 1b a flowchart of a remote memory allocation method according to an embodiment of the present invention is applied to the application scenario shown in FIG. 1a. Specifically, the following steps are included:
  • the memory node receives a request sent by a computing node, where the request indicates that the computing node requests the remote memory of the XB from the memory node, where the memory node and the computing node are connected by using a network communication.
  • X is greater than zero and less than 2 n
  • n is the data width of the memory node CPU general purpose register
  • the memory node in the embodiment of the present invention refers to a node having a physical storage space and a network communication function.
  • the memory node is referred to as a memory node in the embodiment of the present invention for convenience of description, and should not be construed as a limitation. Provisions.
  • the computing node described in the embodiment of the present invention refers to a node having a computing capability and a network communication function.
  • the computing node is also referred to as a computing node in the embodiment of the present invention, and should not be construed as a limitation.
  • the request further indicates that the remote memory is a remote physical memory; or the request further indicates that the remote memory is a remote virtual memory; or the request further indicates The remote memory is remote physical memory and remote virtual memory.
  • the request further indicates that the first start address is further indicated, and the first start address refers to an address of the remote memory start location facing the computing node.
  • the memory node allocates the first kernel memory of the XB from the free core memory of the memory node to the computing node.
  • the technical solution described in the embodiment of the present invention is directed to the case where the CPU of the memory node operates in a kernel mode.
  • the memory node allocates the first kernel memory of the XB to the computing node from the free kernel memory of the memory node, and specifically includes: the memory node determining whether the free kernel memory of the memory node is If the free memory is greater than or equal to the remote memory, and the memory node allocates the XB to the computing node from the free core memory.
  • a kernel memory It should be understood that in the case where the free kernel memory is smaller than the remote memory, the following steps are not continued, that is, the memory node does not allocate the remote memory for the computing node.
  • the operating system of the memory node provides sufficient kernel memory for the kernel of the memory node when setting parameters for the kernel.
  • the kernel memory can be configured to 8EB, which provides sufficient kernel memory for allocation to compute nodes.
  • the method also includes:
  • the memory node maps the first kernel memory to a first storage space of the memory node to
  • the computing device allocates the remote memory, and the computing node reads and writes data to the first storage space, where the size of the first storage space is the XB; the first storage space is Physical memory, or the first storage space is virtual memory, or the first storage space is physical memory and virtual memory.
  • the computing node After the memory node allocates the first kernel memory of the XB from the free kernel memory of the memory node to the computing node, the computing node is allocated a logical memory of size XB because Before the real storage space of the first kernel memory map, it is only a piece of logical memory. Since the logical memory cannot be used to read data, the computing node cannot read data into the first kernel memory. Referring to step S105, after the computing node is allocated the first kernel memory, and before the first kernel memory is mapped to the first storage space, the computing node does not have the first kernel memory. Read and write data. The computing node reads and writes data to the first storage space after the first kernel is memory mapped to the first storage space. It should be understood that the "memory node maps the first kernel memory to the first storage space of the memory node" in step S105 is a mapping of a logical address to a physical address based on a memory paging mechanism.
  • the memory node maps the first kernel memory to a first storage space of the memory node to implement Allocating the remote memory to the computing node, so that the computing node reads and writes data to the first storage space, where the size of the first storage space is the XB, specifically: the memory node will The first core memory is mapped to the first physical memory of the memory node, so as to allocate the remote physical memory to the computing node, so that the computing node reads and writes data to the first physical memory.
  • the size of the first physical memory is the XB.
  • the method of the embodiment of the present invention further includes: the memory node determining the memory node Whether the free physical memory is greater than or equal to the remote memory, and if the free physical memory is greater than or equal to the remote memory, the memory node allocates the calculated node from the free physical memory.
  • the first physical memory It should be understood that, in the case that the free physical memory is smaller than the remote memory, the following steps are not continued, that is, the memory node does not allocate the remote memory to the computing node.
  • the request further indicates that the remote memory is a remote physical memory and a remote virtual memory, and the size of the remote physical memory is KB, and the size of the remote virtual memory is XB.
  • the memory node maps the first kernel memory to the first storage space of the memory node to implement allocation of the remote memory to the computing node, thereby causing the computing node to The first storage space reads and writes data, and the size of the first storage space is the XB, specifically: the memory node maps a portion of the first kernel memory with a size of KB to the memory node.
  • the memory node mapping a portion of the first kernel memory having an size of XB-KB to the virtual memory of the memory node, thereby causing the computing node to the physical memory of the KB and the XB- Read and write data in KB's virtual memory.
  • the memory node further determines whether the free physical memory of the memory node is greater than or equal to The KB, and in a case where the free physical memory is greater than or equal to the KB, the memory node maps a portion of the first kernel memory having a size of KB to a physical memory of the memory node.
  • the technical solution provided by the embodiment of the present invention further includes: the memory node establishing between the first start address and the second start address Mapping relationship, the second starting address is an address of the first kernel memory starting position in the free core memory.
  • the address of the computing node A 1 is sent to the memory a node, the memory node determining, according to the mapping relationship, an address A 2 in the free kernel memory of the starting position of the data A, and mapping the A 2 to the storage space A of the memory node 3, to write the data to the A 3 in A.
  • the A 3 may be physical memory or virtual memory, or part of the A 3 is physical memory, and the other part is virtual memory.
  • the memory node allocates the first kernel memory from the free kernel memory of the memory node according to the request of the computing node, and then maps the first kernel memory to the first storage space.
  • the kernel memory is the memory allocated by the operating system for the kernel object, the logical memory, the kernel memory is much larger than the physical memory of the memory node, and based on the virtual memory technology, the kernel memory can not only map.
  • virtual memory that is, virtual memory that is extended from external memory
  • FIG. 1c a flowchart of a remote memory allocation method according to an embodiment of the present invention is applied to the application scenario shown in FIG. 1a. Specifically, the following steps are included:
  • the memory node receives a request sent by the computing node, where the request indicates that the computing node requests the remote memory of the XB from the memory node, where the X is greater than zero and less than 2 n , and the n is the memory.
  • a data width of a node CPU general purpose register wherein the memory node and the computing node are connected by a network communication;
  • the memory node in the embodiment of the present invention refers to a node having a physical storage space and a network communication function.
  • the memory node is referred to as a memory node in the embodiment of the present invention for convenience of description, and should not be construed as a limitation. Provisions.
  • the computing node described in the embodiment of the present invention refers to a node having a computing capability and a network communication function.
  • the computing node is also referred to as a computing node in the embodiment of the present invention, and should not be construed as a limitation.
  • the request further indicates that the remote memory is a remote physical memory; or the request further indicates that the remote memory is a remote virtual memory; or the request further indicates The remote memory is remote physical memory and remote virtual memory.
  • the request further indicates a first start address, where the first start address refers to an address of the remote memory start location facing the computing node.
  • the memory node allocates, according to the request, the first logical memory of the XB from the idle logical memory of the first target process, where the first target process refers to running in the memory node. a process having a first interface that interacts with the computing node and capable of allocating logical memory to the computing node through the first interface, the idle logical memory of the first target process is greater than or equal to the XB;
  • the operating system allocates certain resources (such as logical memory, etc.) to the program, and then performs a series of complicated operations to make the program become a process for the system to call.
  • resources such as logical memory, etc.
  • the relationship between its logical memory and the number of bits of the CPU is usually: the logical memory of the process is 2 r B, where r is the number of bits of the CPU.
  • the logical memory of a process is much larger than physical memory, and a large part of the logical memory of a process is often idle.
  • the first target process described in the embodiment of the present invention is selected from multiple processes running on the memory node, or the first target process is created by the memory node. That is, after the memory node receives the request sent by the computing node, and the memory node allocates the first logical memory of the XB from the idle logical memory of the first target process to the computing node according to the request, The method further includes: the memory node selecting the first target process from all processes running in the memory node; or the memory node creating the first target process and being the first The target process allocates logical memory.
  • the memory node creates the first target process in a case where the first target process does not exist in all processes running in the memory node.
  • the method further includes: after the first target process is created, the number of processes running on the memory node does not exceed The number of cores of the memory node. This is to ensure the speed of the process. It should be known that if the number of processes running on the memory node exceeds the number of cores of the memory node, the process runs slower.
  • the method further includes:
  • the memory node Mapping, by the memory node, the first logical memory to a first storage space of the memory node, to implement allocating the remote memory to the computing node, thereby causing the computing node to move to the first storage space Reading and writing data; wherein the size of the first storage space is the XB, the first storage space is physical memory and virtual memory, or the first storage space is physical memory, or the first The storage space is virtual memory.
  • the computing node is allocated a logical memory of size XB. Because the virtual memory is only a piece of logical memory before the real storage space of the first logical memory map, since the logical memory cannot be used to read data, the computing node cannot read data to the first logical memory. . Referring to step S115, the computing node is assigned the first After a logical memory, and before the first logical memory is mapped to the first storage space, the computing node does not read or write data to the first logical memory.
  • the computing node reads and writes data to the first storage space after the first logical memory is mapped to the first storage space.
  • the “memory node maps the first logical memory to the first storage space of the memory node” in step S115 is a mapping of a logical address to a physical address based on a memory paging mechanism.
  • the memory node maps the first logical memory to a first storage space of the memory node to implement Allocating the remote memory to the computing node, so that the computing node reads and writes data to the first storage space, specifically, the memory node mapping the first logical memory to the memory node
  • the first physical memory is configured to allocate the remote physical memory to the computing node, so that the computing node reads and writes data to the first physical memory, and the size of the first physical memory is the XB.
  • the method of the embodiment of the present invention further includes: the memory node determining the memory node Whether the free physical memory is greater than or equal to the remote memory, and if the free physical memory is greater than or equal to the remote memory, the memory node allocates the calculated node from the free physical memory.
  • the first physical memory It should be understood that, in the case that the free physical memory is smaller than the remote memory, the following steps are not continued, that is, the memory node does not allocate the remote memory to the computing node.
  • the technical solution provided by the embodiment of the present invention further includes: the memory node establishing between the first start address and the second start address a mapping relationship, where the second starting address refers to an address of the first logical memory starting position in the idle logical memory.
  • the computing node to the distal end of the memory read data A the data will be a starting position for the A and the data A
  • the address of the computing node A 1 is sent to the memory a node
  • the memory node determining, according to the mapping relationship, an address A 2 in the free kernel memory of the starting position of the data A, and mapping the A 2 to the storage space A of the memory node 3, to write the data to the A 3 in A.
  • the A 3 may be physical memory or virtual memory, or part of the A 3 is physical memory, and the other part is virtual memory.
  • the memory node is requested according to the computing node. Allocating first logical memory to the computing node from idle logical memory of the first target process, the first target process running in the memory node; mapping the first logical memory to the first of the memory node Storage space to enable allocation of remote memory to the compute node.
  • the logical memory of a process is much larger than the physical memory of a memory node. Based on the virtual memory technology, the logical memory of a process can be mapped not only to physical memory but also to virtual memory (ie, extended from external memory). Virtual memory).
  • the computing node when the computing node applies for the remote memory to the memory node, the computing node can apply for a larger remote memory to the memory node without being limited by the upper limit of the free physical memory in the memory node.
  • FIG. 2a is a schematic structural diagram of a remote memory allocation device 200 according to an embodiment of the present invention.
  • the remote memory allocation device 200 according to the embodiment of the present invention is integrated into the memory node shown in FIG. 1a.
  • the remote memory allocation device 200 of the embodiment of the present invention is an execution body of the method described in the first embodiment, and can be used to perform the method described in the first embodiment.
  • the remote memory allocation device 200 includes:
  • the receiving unit 201 is configured to receive a request sent by the computing node, where the request instructs the computing node to apply for a remote memory of the XB to the memory node, where the X is greater than zero and less than 2 n , and the n is the memory node CPU
  • the request further indicates that the remote memory is a remote physical memory; or the request further indicates that the remote memory is a remote virtual memory; or the request further indicates The remote memory is the remote physical memory and the remote virtual memory.
  • the request further indicates a first start address, where the first start address refers to an address of the remote memory start location facing the computing node.
  • the allocating unit 203 is configured to allocate, by the free kernel memory of the memory node, the first kernel memory of the XB to the computing node;
  • the allocating unit allocates the first kernel memory of the XB from the free kernel memory of the memory node to the computing node, and before the computing node reads and writes data to the remote memory,
  • mapping unit 205 configured to map the first kernel memory to the first storage space of the memory node And allocating the remote memory to the computing node, so that the computing node reads and writes data to the first storage space; wherein the size of the first storage space is the XB,
  • the first storage space is physical memory, or the first storage space is virtual memory, or the first storage space is physical memory and virtual memory.
  • the mapping unit 205 is specifically configured to map the first kernel memory to the first physical memory of the memory node.
  • the remote physical memory is allocated to the computing node, so that the computing node reads and writes data to the first physical memory, and the size of the first physical memory is the XB.
  • the remote memory allocation device 210 further includes an establishing unit 212, wherein the establishing unit 212 is configured to establish a mapping relationship between the first start address and the second start address, where the second start address refers to an address of the first kernel memory start position in the free core memory.
  • the memory node allocates the first kernel memory from the free kernel memory of the memory node according to the request of the computing node, and then maps the first kernel memory to The first storage space is configured to allocate remote memory for the compute node.
  • the kernel memory is the memory allocated by the operating system for the kernel object, the logical memory, the kernel memory is much larger than the physical memory of the memory node, and based on the virtual memory technology, the kernel memory can not only map. To physical memory, you can also map to virtual memory (that is, virtual memory that is extended from external memory).
  • the remote memory allocation device when the computing node applies for the remote memory to the memory node, is not limited by the upper limit of the free physical memory in the memory node, and the computing node can apply for a greater distance to the memory node. Side memory.
  • FIG. 2c is a schematic structural diagram of a remote memory allocation device 220 according to an embodiment of the present invention.
  • the remote memory allocation device 220 according to the embodiment of the present invention is integrated into the memory node shown in FIG. 1a.
  • the remote memory allocation device 220 of the embodiment of the present invention is an execution body of the method described in the second embodiment, and can be used to perform the method described in the second embodiment.
  • the remote memory allocation device 220 includes:
  • the receiving unit 221 is configured to receive a request sent by the computing node, where the request instructs the computing node to apply to the memory node for the remote memory of the XB, where the X is greater than zero and less than 2 n , and the n is the memory a data width of a node CPU general purpose register, wherein the memory node and the computing node are connected by a network communication;
  • the request further indicates that the remote memory is a remote physical memory; or the request further indicates that the remote memory is a remote virtual memory; or the request further indicates The remote memory is the remote physical memory and the remote virtual memory.
  • the request further indicates a first start address, where the first start address refers to an address of the remote memory start location facing the computing node.
  • the allocating unit 223 is configured to allocate, according to the request, the first logical memory of the XB from the idle logical memory of the first target process, where the first target process refers to running in the memory node. a process having a first interface that interacts with the computing node and capable of allocating logical memory to the computing node through the first interface, the idle logical memory of the first target process is greater than or equal to the XB;
  • the first target process described in the embodiment of the present invention is selected from multiple processes running on the memory node, or the first target process is created by the memory node.
  • the remote memory allocation device 230 further includes a selecting unit 232, after the receiving unit 231 receives the request sent by the computing node, and the allocating unit 233 according to the Requesting, before the first logical memory of the first target process allocates the first logical memory of the XB to the computing node, the selecting unit 232 is configured to select the first target from all processes running in the memory node process.
  • the remote memory allocation device 240 further includes a creating unit 242, after the receiving unit 241 receives the request sent by the computing node, and the allocating unit 243 according to the request Before the first logical memory of the first target process allocates the first logical memory of the XB to the computing node, the creating unit 242 is configured to create the first target process and allocate logical memory for the first target process .
  • the creating unit 242 creates the first target process and runs in the The number of processes on the memory node does not exceed the number of cores of the memory node. This is to ensure the speed of the process, it should be known that if the process running on the memory node The number of threads exceeds the number of cores in the memory node, and the process runs slower.
  • the allocating unit allocates the first logical memory of the XB from the idle logical memory of the first target process to the computing node, and before the computing node reads and writes data to the remote memory,
  • the mapping unit 225 is configured to map the first logical memory to the first storage space of the memory node, so as to implement allocating the remote memory to the computing node, so that the computing node is to the first
  • the first storage space is the physical memory and the virtual memory, or the first storage space is physical memory, or the first The storage space is virtual memory.
  • the mapping unit 225 is specifically configured to map the first logical memory to the first physical memory of the memory node, The remote physical memory is allocated to the computing node, so that the computing node reads and writes data to the first physical memory, and the size of the first physical memory is the XB.
  • the remote memory allocation device 250 further includes an establishing unit 252.
  • the establishing unit 252 is configured to use Establishing a mapping relationship between the first start address and a second start address, where the second start address refers to an address of the first logical memory start position in the idle logical memory.
  • the memory node allocates the first logical memory to the computing node from the idle logical memory of the first target process according to the request of the computing node, where the first target process Running in the memory node; mapping the first logical memory to the first storage space of the memory node to implement allocating remote memory to the computing node.
  • the logical memory of a process is much larger than the physical memory of a memory node. Based on the virtual memory technology, the logical memory of a process can be mapped not only to physical memory but also to virtual memory (ie, extended from external memory). Virtual memory).
  • the remote memory allocation device when the computing node applies for the remote memory to the memory node, is not limited by the upper limit of the free physical memory in the memory node, and the computing node can apply for a greater distance to the memory node. Side memory.
  • a computing node 301 a memory node 305, and a remote memory allocation device 303 as described in the third embodiment are included.
  • the computing node 301 is configured to send the request received by the remote memory allocation device 303;
  • the memory node 305 is configured to provide the first storage space
  • the computing node 301 is further configured to acquire the first storage space as the remote memory.
  • the remote memory allocation device 303 is integrated in the memory node 305.
  • the remote memory allocation system according to the embodiment of the present invention is used, and the computing node 301 is not required to apply for the remote memory to the memory node 305.
  • the memory node 305 can limit the upper limit of the free physical memory, and the compute node 301 can apply for a larger remote memory to the memory node 305.
  • a computing node 311, a memory node 315, and a remote memory allocation device 313 as described in the fourth embodiment are included.
  • the computing node 311 is configured to send the request received by the remote memory allocation device 313.
  • the memory node 315 is configured to provide the first storage space
  • the computing node 311 is further configured to acquire the first storage space as the remote memory.
  • the remote memory allocation device 313 is integrated in the memory node 315.
  • the remote memory allocation system according to the embodiment of the present invention is used.
  • the computing node 311 requests the remote memory from the memory node 315, the memory is not affected by the memory.
  • the limit of the upper limit of the free physical memory in the node 315 the compute node 311 can apply for a larger remote memory to the memory node 315.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in the network device provided by each embodiment of the present invention 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.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium.
  • the technical solution of the present invention which is essential or contributes to the prior art, or all or part of the technical solution, may be embodied in the form of a software product stored in a storage medium.
  • a number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .

Abstract

A remote memory allocation method, and a corresponding device and system, the method comprising: receiving, by a memory node (305), a request transmitted by a computing node (301); allocating, by the memory node (305), a first kernel memory of XB to the computing node (301) from an idle kernel memory of the memory node (305); after the memory node (305) allocates the first kernel memory of XB to the computing node (301) from the idle kernel memory of the memory node (305), and before the computing node (301) reads and writes data from the remote memory, the method further comprising: mapping, by the memory node (305), the first kernel memory to a first storage space of the memory node (305), so as to allocate the remote memory to the computing node (301). The technical solution is free from a physical memory upper limit of the memory node (305) when allocating remote memory to the computing node (301), and allocates a larger remote memory to the computing node (301).

Description

一种远端内存分配方法、装置和系统Remote memory allocation method, device and system
本申请要求于2015年01月27日提交中国专利局、申请号为201510041110.7、发明名称为“一种远端内存分配方法、装置和系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to Chinese Patent Application No. 201510041110.7, entitled "A Remote Memory Allocation Method, Apparatus and System", filed on January 27, 2015, the entire contents of which are incorporated by reference. In this application.
技术领域Technical field
本发明涉及计算机技术领域,尤其涉及一种远端内存分配方法、装置和系统。The present invention relates to the field of computer technologies, and in particular, to a remote memory allocation method, apparatus, and system.
背景技术Background technique
物理内存是计算机中重要的部件之一,它是与CPU进行沟通的桥梁。计算机中所有程序的运行都是在内存中进行的,因此物理内存的性能对计算机的影响非常大。Physical memory is one of the important components in a computer, and it is a bridge to communicate with the CPU. All programs in the computer run in memory, so the performance of physical memory has a huge impact on the computer.
当前,在第一终端设备的物理内存太小,不能满足需求的情况下,该第一终端设备通常会向其他终端设备申请远端内存,以扩展该第一终端设备的物理内存。现有技术中,其他终端设备(为便于陈述,下面以“第二终端设备”取代“其他终端设备”)会根据第一终端设备的请求,将第二终端设备的物理内存分出一部分给第一终端设备,以作为该第一终端设备的远端内存。这种方案的缺陷在于:由于第二终端设备的物理内存大小是固定的,所以分配给计算节点的远端内存不能超出该第二终端设备中空闲物理内存的上限。Currently, when the physical memory of the first terminal device is too small to meet the requirement, the first terminal device usually requests remote memory from other terminal devices to expand the physical memory of the first terminal device. In the prior art, other terminal devices (for the sake of convenience, the following "second terminal device" replaces "other terminal device") will divide the physical memory of the second terminal device into a part according to the request of the first terminal device. A terminal device to serve as the remote memory of the first terminal device. The disadvantage of this scheme is that since the physical memory size of the second terminal device is fixed, the remote memory allocated to the computing node cannot exceed the upper limit of the free physical memory in the second terminal device.
发明内容Summary of the invention
本发明提供一种远端内存分配方法,用于实现对计算节点分配远端内存时不受内存节点中物理内存上限的限制。The present invention provides a remote memory allocation method, which is used to limit the allocation of remote memory to a computing node without being limited by the upper limit of physical memory in the memory node.
第一方面,本发明实施例提供一种远端内存分配方法,该方法包括:In a first aspect, an embodiment of the present invention provides a remote memory allocation method, where the method includes:
内存节点接收计算节点发送的请求,所述请求指示所述计算节点向所述内存节点申请XB的远端内存,其中,所述内存节点和所述计算节点之间通过网络通信连接,所述X大于零且小于2n,所述n为所述内存节点CPU通用寄存器的数据宽度;The memory node receives a request sent by the computing node, the request instructing the computing node to apply for remote memory of the XB to the memory node, where the memory node and the computing node are connected by network communication, the X Greater than zero and less than 2 n , the n is the data width of the memory node CPU general purpose register;
所述内存节点从所述内存节点的空闲内核内存为所述计算节点分配所述 XB的第一内核内存;The memory node allocates the said node from the free kernel memory of the memory node The first kernel memory of XB;
在所述内存节点从所述内存节点的空闲内核内存为所述计算节点分配所述XB的第一内核内存之后,且在所述计算节点向所述远端内存读写数据之前,所述方法还包括:After the memory node allocates the first kernel memory of the XB from the free kernel memory of the memory node for the computing node, and before the computing node reads and writes data to the remote memory, the method Also includes:
所述内存节点将所述第一内核内存映射到所述内存节点的第一存储空间,以实现为所述计算节点分配所述远端内存,进而使得所述计算节点向所述第一存储空间读写数据,所述第一存储空间的大小为所述XB;所述第一存储空间为物理内存,或,所述第一存储空间为虚拟内存,或,所述第一存储空间为物理内存和虚拟内存。The memory node maps the first kernel memory to the first storage space of the memory node, so as to allocate the remote memory to the computing node, so that the computing node is to the first storage space Read and write data, the size of the first storage space is the XB; the first storage space is physical memory, or the first storage space is virtual memory, or the first storage space is physical memory And virtual memory.
结合第一方面,在第一方面的第一种实施方式下,In conjunction with the first aspect, in a first embodiment of the first aspect,
所述请求还指示所述远端内存为远端物理内存;或者,The request further indicates that the remote memory is a remote physical memory; or
所述请求还指示所述远端内存为远端虚拟内存;或者,The request further indicates that the remote memory is a remote virtual memory; or
所述请求还指示所述远端内存为远端物理内存和远端虚拟内存。The request further indicates that the remote memory is remote physical memory and remote virtual memory.
结合第一方面的第一种实施方式,在第一方面的第二种实施方式下,In conjunction with the first embodiment of the first aspect, in the second embodiment of the first aspect,
在所述请求还指示所述远端内存为远端物理内存的情况下,In the case where the request further indicates that the remote memory is remote physical memory,
所述内存节点将所述第一内核内存映射到所述内存节点的第一存储空间,以实现为所述计算节点分配所述远端内存,进而使得所述计算节点向所述第一存储空间读写数据,所述第一存储空间的大小为所述XB,具体包括:The memory node maps the first kernel memory to the first storage space of the memory node, so as to allocate the remote memory to the computing node, so that the computing node is to the first storage space Reading and writing data, the size of the first storage space is the XB, and specifically includes:
所述内存节点将所述第一内核内存映射到所述内存节点的第一物理内存,以实现为所述计算节点分配所述远端物理内存,进而使得所述计算节点向所述第一物理内存读写数据,所述第一物理内存的大小为所述XB。The memory node maps the first kernel memory to a first physical memory of the memory node to implement allocating the remote physical memory to the computing node, thereby causing the computing node to the first physical The memory reads and writes data, and the size of the first physical memory is the XB.
结合第一方面、第一方面的第一种实施方式或第一方面的第二种实施方式,在第一方面的第三种实施方式下,With reference to the first aspect, the first embodiment of the first aspect or the second embodiment of the first aspect, in a third embodiment of the first aspect,
所述请求还指示第一起始地址,所述第一起始地址是指所述远端内存起始位置面向所述计算节点的地址;The request further indicates a first start address, where the first start address refers to an address of the remote memory start location facing the computing node;
所述方法还包括:The method further includes:
所述内存节点建立所述第一起始地址和第二起始地址之间的映射关系,所述第二起始地址是指所述空闲内核内存中所述第一内核内存起始位置的地址。The memory node establishes a mapping relationship between the first start address and a second start address, where the second start address refers to an address of the first kernel memory start position in the free core memory.
结合第一方面、第一方面的第一种实施方式或第一方面的第三种实施方式,在第一方面的第四种实施方式下, With reference to the first aspect, the first embodiment of the first aspect or the third embodiment of the first aspect, in a fourth implementation manner of the first aspect,
所述内存节点从所述内存节点的空闲内核内存中为所述计算节点分配XB的第一内核内存,具体包括:The memory node allocates the first kernel memory of the XB to the computing node from the free kernel memory of the memory node, and specifically includes:
在所述内存节点的空闲内核内存大于或者等于所述XB的情况下,所述内存节点从所述空闲内核内存中为所述计算节点分配所述第一内核内存。In a case where the free kernel memory of the memory node is greater than or equal to the XB, the memory node allocates the first kernel memory from the free core memory to the computing node.
第二方面,本发明实施例提供一种远端内存分配方法,该方法包括:In a second aspect, an embodiment of the present invention provides a remote memory allocation method, where the method includes:
内存节点接收计算节点发送的请求,所述请求指示所述计算节点向所述内存节点申请XB的远端内存,其中,所述X大于零且小于2n,所述n为所述内存节点CPU通用寄存器的数据宽度,所述内存节点和所述计算节点之间通过网络通信连接;The memory node receives a request sent by the computing node, where the request indicates that the computing node requests the remote memory of the XB from the memory node, where the X is greater than zero and less than 2 n , and the n is the memory node CPU a data width of the general purpose register, wherein the memory node and the computing node are connected by a network communication;
所述内存节点根据所述请求,从第一目标进程的空闲逻辑内存为所述计算节点分配所述XB的第一逻辑内存,所述第一目标进程是指运行在所述内存节点中、具有与所述计算节点交互的第一接口且能通过所述第一接口为所述计算节点分配逻辑内存的进程,所述第一目标进程的空闲逻辑内存大于或者等于所述XB;The memory node allocates, according to the request, the first logical memory of the XB from the idle logical memory of the first target process to the computing node, where the first target process refers to running in the memory node, a first interface that interacts with the computing node and can allocate a logical memory to the computing node through the first interface, where the idle logical memory of the first target process is greater than or equal to the XB;
在所述内存节点从所述第一目标进程的空闲逻辑内存为所述计算节点分配所述XB的第一逻辑内存之后,且在所述计算节点向所述远端内存读写数据之前,所述方法还包括:After the memory node allocates the first logical memory of the XB from the idle logical memory of the first target process to the computing node, and before the computing node reads and writes data to the remote memory, The method also includes:
所述内存节点将所述第一逻辑内存映射到所述内存节点的第一存储空间,以实现为所述计算节点分配所述远端内存,进而使得所述计算节点向所述第一存储空间读写数据;其中,所述第一存储空间的大小为所述XB,所述第一存储空间为物理内存和虚拟内存,或,所述第一存储空间为物理内存,或,所述第一存储空间为虚拟内存。Mapping, by the memory node, the first logical memory to a first storage space of the memory node, to implement allocating the remote memory to the computing node, thereby causing the computing node to move to the first storage space Reading and writing data; wherein the size of the first storage space is the XB, the first storage space is physical memory and virtual memory, or the first storage space is physical memory, or the first The storage space is virtual memory.
结合第二方面,在第二方面的第一种实施方式下,In conjunction with the second aspect, in a first embodiment of the second aspect,
所述内存节点接收计算节点发送的请求之后,以及所述内存节点根据所述请求,从第一目标进程的空闲逻辑内存为所述计算节点分配所述XB的第一逻辑内存之前,所述方法还包括:After the memory node receives the request sent by the computing node, and the memory node allocates the first logical memory of the XB from the idle logical memory of the first target process to the computing node according to the request, the method Also includes:
所述内存节点从运行在所述内存节点的所有进程中选择出所述第一目标进程。The memory node selects the first target process from among all processes running on the memory node.
结合第二方面,在第二方面的第二种实施方式下, In conjunction with the second aspect, in a second embodiment of the second aspect,
所述内存节点接收计算节点发送的请求之后,以及所述内存节点根据所述请求,从第一目标进程的空闲逻辑内存为所述计算节点分配所述XB的第一逻辑内存之前,所述方法还包括:After the memory node receives the request sent by the computing node, and the memory node allocates the first logical memory of the XB from the idle logical memory of the first target process to the computing node according to the request, the method Also includes:
所述内存节点创建所述第一目标进程,并为所述第一目标进程分配逻辑内存。The memory node creates the first target process and allocates logical memory for the first target process.
结合第二方面、第二方面的第一种实施方式或第二方面的第二种实施方式,在第二方面的第三种实施方式下,With reference to the second aspect, the first embodiment of the second aspect, or the second embodiment of the second aspect, in the third embodiment of the second aspect,
所述请求还指示所述远端内存为远端物理内存;或者,The request further indicates that the remote memory is a remote physical memory; or
所述请求还指示所述远端内存为远端虚拟内存;或者,The request further indicates that the remote memory is a remote virtual memory; or
所述请求还指示所述远端内存为远端物理内存和远端虚拟内存。The request further indicates that the remote memory is remote physical memory and remote virtual memory.
结合第二方面的第三种实施方式,在第二方面的第四种实施方式下,在所述请求还指示所述远端内存为远端物理内存的情况下,With reference to the third implementation manner of the second aspect, in a fourth implementation manner of the second aspect, in the case that the request further indicates that the remote memory is a remote physical memory,
所述内存节点将所述第一逻辑内存映射到所述内存节点的第一存储空间,以实现为所述计算节点分配所述远端内存,进而使得所述计算节点向所述第一存储空间读写数据,具体包括:Mapping, by the memory node, the first logical memory to a first storage space of the memory node, to implement allocating the remote memory to the computing node, thereby causing the computing node to move to the first storage space Read and write data, including:
所述内存节点将所述第一逻辑内存映射到所述内存节点的第一物理内存,以实现为所述计算节点分配所述远端物理内存,进而使得所述计算节点向所述第一物理内存读写数据,所述第一物理内存的大小为所述XB。The memory node maps the first logical memory to a first physical memory of the memory node to implement allocating the remote physical memory to the computing node, thereby causing the computing node to the first physical The memory reads and writes data, and the size of the first physical memory is the XB.
结合第二方面或第二方面的第一种实施方式至第二方面的第四种实施方式中任一种实施方式,在第二方面的第五种实施方式下,In combination with the second aspect or the first embodiment of the second aspect to the fourth embodiment of the second aspect, in the fifth embodiment of the second aspect,
所述请求还指示第一起始地址,所述第一起始地址是指所述远端内存起始位置面向所述计算节点的地址;The request further indicates a first start address, where the first start address refers to an address of the remote memory start location facing the computing node;
所述方法还包括:The method further includes:
所述内存节点建立所述第一起始地址和第二起始地址之间的映射关系,所述第二起始地址是指在所述空闲逻辑内存中所述第一逻辑内存起始位置的地址。The memory node establishes a mapping relationship between the first start address and a second start address, where the second start address refers to an address of the first logical memory start position in the idle logical memory .
结合第二方面的第二种实施方式至第二方面的第五种实施方式中任一种实施方式,在第二方面的第六种实施方式下,With reference to any one of the second embodiment of the second aspect to the fifth embodiment of the second aspect, in the sixth embodiment of the second aspect,
所述内存节点的内核数量大于创建所述第一目标进程之前运行所述内存节点上的进程的数量的情况下,The number of cores of the memory node is greater than the number of processes running the memory node before the first target process is created,
创建的所述第一目标进程之后,运行在所述内存节点上的进程的数量不超过 所述内存节点的内核数量。After the first target process is created, the number of processes running on the memory node does not exceed The number of cores of the memory node.
第三方面,本发明实施例提供一种远端内存分配装置,该装置包括:In a third aspect, an embodiment of the present invention provides a remote memory allocation device, where the device includes:
接收单元,用于接收计算节点发送的请求,所述请求指示所述计算节点向内存节点申请XB的远端内存,所述X大于零且小于2n,所述n为所述内存节点CPU通用寄存器的数据宽度;a receiving unit, configured to receive a request sent by the computing node, where the request instructs the computing node to apply for a remote memory of the XB to the memory node, where the X is greater than zero and less than 2 n , and the n is the CPU of the memory node The data width of the register;
分配单元,用于从所述内存节点的空闲内核内存为所述计算节点分配所述XB的第一内核内存;An allocating unit, configured to allocate, by the free kernel memory of the memory node, the first kernel memory of the XB to the computing node;
在所述分配单元从所述内存节点的空闲内核内存为所述计算节点分配所述XB的第一内核内存之后,且在所述计算节点向所述远端内存读写数据之前,After the allocating unit allocates the first kernel memory of the XB from the free kernel memory of the memory node to the computing node, and before the computing node reads and writes data to the remote memory,
映射单元,用于将所述第一内核内存映射到所述内存节点的第一存储空间,以实现为所述计算节点分配所述远端内存,进而使得所述计算节点向所述第一存储空间读写数据,所述第一存储空间的大小为所述XB;所述第一存储空间为物理内存,或,所述第一存储空间为虚拟内存,或,所述第一存储空间为物理内存和虚拟内存。a mapping unit, configured to map the first kernel memory to a first storage space of the memory node, to implement allocating the remote memory to the computing node, thereby causing the computing node to the first storage Spatially reading and writing data, the size of the first storage space is the XB; the first storage space is physical memory, or the first storage space is virtual memory, or the first storage space is physical Memory and virtual memory.
结合第三方面,在第三方面的第一种实施方式下,In conjunction with the third aspect, in a first embodiment of the third aspect,
所述请求还指示所述远端内存为远端物理内存;或者,The request further indicates that the remote memory is a remote physical memory; or
所述请求还指示所述远端内存为远端虚拟内存;或者,The request further indicates that the remote memory is a remote virtual memory; or
所述请求还指示所述远端内存为远端物理内存和远端虚拟内存。The request further indicates that the remote memory is remote physical memory and remote virtual memory.
结合第三方面的第一种实施方式,在第三方面的第二种实施方式下,In conjunction with the first embodiment of the third aspect, in the second embodiment of the third aspect,
在所述请求还指示所述远端内存为远端物理内存的情况下,In the case where the request further indicates that the remote memory is remote physical memory,
所述映射单元具体用于将所述第一内核内存映射到所述内存节点的第一物理内存,以实现为所述计算节点分配所述远端物理内存,进而使得所述计算节点向所述第一物理内存读写数据,所述第一物理内存的大小为所述XB。The mapping unit is specifically configured to map the first kernel memory to the first physical memory of the memory node, so as to implement allocating the remote physical memory to the computing node, thereby causing the computing node to The first physical memory reads and writes data, and the size of the first physical memory is the XB.
结合第三方面、第三方面的第一种实施方式或第三方面的第二种实施方式,在第三方面的第三种实施方式下,所述请求还指示第一起始地址,所述第一起始地址是指所述远端内存起始位置面向所述计算节点的地址;With reference to the third aspect, the first implementation manner of the third aspect, or the second implementation manner of the third aspect, in the third implementation manner of the third aspect, the request further indicates a first start address, where A starting address is an address of the remote memory starting location facing the computing node;
所述装置还包括:The device also includes:
建立单元用于建立所述第一起始地址和第二起始地址之间的映射关系,所述第二起始地址是指所述空闲内核内存中所述第一内核内存起始位置的地址。 The establishing unit is configured to establish a mapping relationship between the first starting address and the second starting address, where the second starting address is an address of the first kernel memory starting position in the free core memory.
第四方面,本发明实施例提供一种远端内存分配装置,该装置包括:In a fourth aspect, an embodiment of the present invention provides a remote memory allocation device, where the device includes:
接收单元,用于接收计算节点发送的请求,所述请求指示所述计算节点向内存节点申请XB的远端内存,其中,所述X大于零且小于2n,所述n为所述内存节点CPU通用寄存器的数据宽度,所述内存节点和所述计算节点之间通过网络通信连接;a receiving unit, configured to receive a request sent by the computing node, where the request instructs the computing node to apply for a remote memory of the XB to the memory node, where the X is greater than zero and less than 2 n , and the n is the memory node a data width of a CPU general purpose register, wherein the memory node and the computing node are connected by a network communication;
分配单元,用于根据所述请求,从第一目标进程的空闲逻辑内存为所述计算节点分配所述XB的第一逻辑内存,所述第一目标进程是指运行在所述内存节点中、具有与所述计算节点交互的第一接口且能通过所述第一接口为所述计算节点分配逻辑内存的进程,所述第一目标进程的空闲逻辑内存大于或者等于所述XB;An allocating unit, configured to allocate, according to the request, the first logical memory of the XB from the idle logical memory of the first target process, where the first target process refers to running in the memory node, a process having a first interface that interacts with the computing node and capable of allocating logical memory to the computing node through the first interface, the idle logical memory of the first target process is greater than or equal to the XB;
在所述分配单元从所述第一目标进程的空闲逻辑内存为所述计算节点分配所述XB的第一逻辑内存之后,且在所述计算节点向所述远端内存读写数据之前,After the allocating unit allocates the first logical memory of the XB from the idle logical memory of the first target process to the computing node, and before the computing node reads and writes data to the remote memory,
映射单元,用于将所述第一逻辑内存映射到所述内存节点的第一存储空间,以实现为所述计算节点分配所述远端内存,进而使得所述计算节点向所述第一存储空间读写数据,所述第一存储空间的大小为所述XB;所述第一存储空间为物理内存和虚拟内存,或,所述第一存储空间为物理内存,或,所述第一存储空间为虚拟内存。a mapping unit, configured to map the first logical memory to a first storage space of the memory node, to implement allocating the remote memory to the computing node, so that the computing node is to the first storage Spatially reading and writing data, the size of the first storage space is the XB; the first storage space is physical memory and virtual memory, or the first storage space is physical memory, or the first storage The space is virtual memory.
结合第四方面,在第四方面的第一种实施方式下,In conjunction with the fourth aspect, in a first embodiment of the fourth aspect,
在所述接收单元接收计算节点发送的请求之后,以及所述分配单元根据所述请求,从第一目标进程的空闲逻辑内存为所述计算节点分配所述XB的第一逻辑内存之前,所述装置还包括:After the receiving unit receives the request sent by the computing node, and the allocating unit allocates the first logical memory of the XB from the idle logical memory of the first target process to the computing node according to the request, The device also includes:
选择单元,用于从运行在所述内存节点的所有进程中选择出所述第一目标进程。a selection unit for selecting the first target process from among all processes running on the memory node.
结合第四方面,在第四方面的第二种实施方式下,With reference to the fourth aspect, in a second implementation manner of the fourth aspect,
在所述接收单元接收计算节点发送的请求之后,以及所述分配单元根据所述请求,从第一目标进程的空闲逻辑内存为所述计算节点分配所述XB的第一逻辑内存之前,所述装置还包括:After the receiving unit receives the request sent by the computing node, and the allocating unit allocates the first logical memory of the XB from the idle logical memory of the first target process to the computing node according to the request, The device also includes:
创建单元,用于创建所述第一目标进程,并为所述第一目标进程分配逻辑 内存。Creating a unit for creating the first target process and assigning logic to the first target process RAM.
结合第四方面、第四方面的第一种实施方式或第四方面的第二种实施方式,在第四方面的第三种实施方式下,With reference to the fourth aspect, the first embodiment of the fourth aspect, or the second embodiment of the fourth aspect, in the third embodiment of the fourth aspect,
所述请求还指示所述远端内存为远端物理内存;或者,The request further indicates that the remote memory is a remote physical memory; or
所述请求还指示所述远端内存为远端虚拟内存;或者,The request further indicates that the remote memory is a remote virtual memory; or
所述请求还指示所述远端内存为远端物理内存和远端虚拟内存。The request further indicates that the remote memory is remote physical memory and remote virtual memory.
结合第四方面的第三种实施方式,在第四方面的第四种实施方式下,在所述请求还指示所述远端内存为远端物理内存的情况下,With the third implementation manner of the fourth aspect, in a fourth implementation manner of the fourth aspect, in the case that the request further indicates that the remote memory is a remote physical memory,
所述映射单元具体用于将所述第一逻辑内存映射到所述内存节点的第一物理内存,以实现为所述计算节点分配所述远端物理内存,进而使得所述计算节点向所述第一物理内存读写数据,所述第一物理内存的大小为所述XB。The mapping unit is specifically configured to map the first logical memory to the first physical memory of the memory node, so as to implement allocating the remote physical memory to the computing node, thereby causing the computing node to The first physical memory reads and writes data, and the size of the first physical memory is the XB.
结合第四方面或第四方面的第一种实施方式至第四方面的第四种实施方式中任一种实施方式,在第四方面的第五种实施方式下,In combination with the fourth aspect or the fourth embodiment of the fourth aspect to the fourth embodiment of the fourth aspect, in the fifth embodiment of the fourth aspect,
所述请求还指示第一起始地址,所述第一起始地址是指所述远端内存起始位置面向所述计算节点的地址;The request further indicates a first start address, where the first start address refers to an address of the remote memory start location facing the computing node;
所述装置还包括:The device also includes:
建立单元,用于建立所述第一起始地址和第二起始地址之间的映射关系,所述第二起始地址是指在所述空闲逻辑内存中所述第一逻辑内存起始位置的地址。a establishing unit, configured to establish a mapping relationship between the first starting address and a second starting address, where the second starting address refers to a starting position of the first logical memory in the idle logical memory address.
结合第四方面的第二种实施方式至第四方面的第五种实施方式中任一种实施方式,在第四方面的第六种实施方式下,With reference to any one of the second embodiment of the fourth aspect to the fifth embodiment of the fourth aspect, in the sixth embodiment of the fourth aspect,
所述内存节点的内核数量大于创建所述第一目标进程之前运行所述内存节点上的进程的数量的情况下,The number of cores of the memory node is greater than the number of processes running the memory node before the first target process is created,
所述创建单元创建的所述第一目标进程之后,运行在所述内存节点上的进程的数量不超过所述内存节点的内核数量。After the first target process created by the creation unit, the number of processes running on the memory node does not exceed the number of cores of the memory node.
第五方面,本发明实施例提供一种远端内存分配系统,该系统包括计算节点、内存节点和如第三方面或第三方面的第一种实施方式至第三方面的第三种实施方式中任一种实施方式所述的远端内存分配装置:In a fifth aspect, an embodiment of the present invention provides a remote memory allocation system, where the system includes a computing node, a memory node, and a third implementation manner of the first to third aspects of the third aspect or the third aspect. The remote memory allocation device of any one of the embodiments:
所述计算节点用于发送所述远端内存分配装置接收的所述请求;The computing node is configured to send the request received by the remote memory allocation device;
所述内存节点用于提供所述第一存储空间;The memory node is configured to provide the first storage space;
所述计算节点还用于获取所述第一存储空间为所述远端内存。 The computing node is further configured to acquire the first storage space as the remote memory.
结合第五方面,在第五方面的第一种实施方式下,所述远端内存分配装置集成在所述内存节点。In conjunction with the fifth aspect, in a first implementation of the fifth aspect, the remote memory allocation device is integrated in the memory node.
第六方面,本发明实施例提供一种远端内存分配系统,该系统包括计算节点、内存节点和如第四方面或第四方面的第一种实施方式至第四方面的第六种实施方式中任一种实施方式所述的远端内存分配装置:In a sixth aspect, an embodiment of the present invention provides a remote memory allocation system, where the system includes a computing node, a memory node, and a sixth implementation manner of the first to fourth aspects of the fourth aspect or the fourth aspect. The remote memory allocation device of any one of the embodiments:
所述计算节点用于发送所述远端内存分配装置接收的所述请求;The computing node is configured to send the request received by the remote memory allocation device;
所述内存节点用于提供所述第一存储空间;The memory node is configured to provide the first storage space;
所述计算节点还用于获取所述第一存储空间为所述远端内存。The computing node is further configured to acquire the first storage space as the remote memory.
结合第六方面,在第六方面的第一种实施方式下,In conjunction with the sixth aspect, in a first embodiment of the sixth aspect,
所述远端内存分配装置集成在所述内存节点。可知,在本发明实施例提供的远端内存分配方法中,内存节点根据计算节点的请求,从内存节点的空闲内核内存中为计算节点分配第一内核内存,再将该第一内核内存映射到第一存储空间,以实现为计算节点分配远端内存。作为本领域的公知常识,在内存节点中,内核内存是操作系统为内核对象分配的内存,是逻辑内存,内核内存的大小为2nB,n为所述内存节点CPU通用寄存器的数据宽度,也即内核内存要远远大于内存节点的物理内存,基于虚拟内存技术,内核内存不仅可以映射到物理内存,也可以映射到虚拟内存(即从外存上扩展的虚拟内存)。所以,采用本发明实施例提供的技术方案,计算节点向内存节点申请远端内存时,不受该内存节点中空闲物理内存上限的限制,计算节点可以向内存节点申请更大的远端内存。The remote memory allocation device is integrated in the memory node. It can be seen that, in the remote memory allocation method provided by the embodiment of the present invention, the memory node allocates the first kernel memory from the free kernel memory of the memory node according to the request of the computing node, and then maps the first kernel memory to The first storage space is configured to allocate remote memory for the compute node. As a common knowledge in the art, in the memory node, the kernel memory is the memory allocated by the operating system for the kernel object, and is the logical memory. The size of the kernel memory is 2 n B, where n is the data width of the general-purpose register of the memory node CPU. That is, the kernel memory is much larger than the physical memory of the memory node. Based on the virtual memory technology, the kernel memory can be mapped not only to physical memory but also to virtual memory (ie, virtual memory expanded from external memory). Therefore, with the technical solution provided by the embodiment of the present invention, when the computing node applies for the remote memory to the memory node, the computing node can apply for a larger remote memory to the memory node without being limited by the upper limit of the free physical memory in the memory node.
附图说明DRAWINGS
为了更清楚地说明本发明实施例的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the embodiments or the prior art description will be briefly described below. Obviously, the drawings in the following description are only some of the present invention. For the embodiments, those skilled in the art can obtain other drawings according to the drawings without any creative work.
图1a为本发明实施例提供的远端内存分配方法的应用场景示意图;FIG. 1 is a schematic diagram of an application scenario of a remote memory allocation method according to an embodiment of the present disclosure;
图1b为本发明实施例提供的远端内存分配方法的流程示意图;1b is a schematic flowchart of a remote memory allocation method according to an embodiment of the present invention;
图1c为本发明实施例提供的远端内存分配方法的流程示意图;1c is a schematic flowchart of a remote memory allocation method according to an embodiment of the present invention;
图2a为本发明实施例提供的远端内存分配装置的结构示意图; 2a is a schematic structural diagram of a remote memory allocation device according to an embodiment of the present invention;
图2b为本发明实施例提供的另一种远端内存分配装置的结构示意图;2b is a schematic structural diagram of another remote memory allocation device according to an embodiment of the present invention;
图2c为本发明实施例提供的再一种远端内存分配装置的结构示意图;2c is a schematic structural diagram of still another remote memory allocation device according to an embodiment of the present invention;
图2d(1)为本发明实施例提供的再一种远端内存分配装置的结构示意图;FIG. 2d (1) is a schematic structural diagram of still another remote memory allocation device according to an embodiment of the present invention;
图2d(2)为本发明实施例提供的再一种远端内存分配装置的结构示意图;2d (2) is a schematic structural diagram of still another remote memory allocation device according to an embodiment of the present invention;
图2e为本发明实施例提供的再一种远端内存分配装置的结构示意图;2 e is a schematic structural diagram of still another remote memory allocation device according to an embodiment of the present invention;
图3a为本发明实施例提供的一种远端内存分配系统的结构示意图;3a is a schematic structural diagram of a remote memory allocation system according to an embodiment of the present invention;
图3b为本发明实施例提供的另一种远端内存分配系统的结构示意图。FIG. 3b is a schematic structural diagram of another remote memory allocation system according to an embodiment of the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are a part of the embodiments of the present invention, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
在对本发明所述的技术方案进行解释之前,先明确两个成熟的现有技术:Before explaining the technical solution described in the present invention, two mature prior art technologies are clarified:
1、基于内存分页机制实现逻辑地址到物理地址的映射。具体是指,基于分页机制,每个进程能够获得独立的逻辑地址空间,进而通过逻辑地址访问物理地址,并且能够提供逻辑地址空间的保护。为了提升地址转换性能,一般处理器中都包括内存管理单元(MMU,Memeory Management Unit)和传输后备缓存器(TLB,Translation Lookside Buffer)来优化内存访问性能。1. Implementing a mapping of logical addresses to physical addresses based on a memory paging mechanism. Specifically, based on the paging mechanism, each process can obtain an independent logical address space, thereby accessing the physical address through a logical address, and can provide protection of the logical address space. In order to improve the address translation performance, the general processor includes a Memeory Management Unit (MMU) and a Translation Lookside Buffer (TLB) to optimize memory access performance.
2、虚拟内存。是指基于虚拟内存技术实现对物理内存的动态扩展,具体的,通过使用外部存储设备(HDD/SDD/NVM等),实现对物理内存的扩展。2, virtual memory. It refers to the dynamic expansion of physical memory based on virtual memory technology. Specifically, the expansion of physical memory is realized by using an external storage device (HDD/SDD/NVM, etc.).
如图1a所示,为本发明实施例所述的远端内存分配方法的应用场景示意图,具体的,包括内存节点11和计算节点13,内存节点11和计算节点13之间通过高速互连接口连接,以实现内存节点11和计算节点13之间的信息交互。As shown in FIG. 1a, a schematic diagram of an application scenario of a remote memory allocation method according to an embodiment of the present invention includes a memory node 11 and a computing node 13, and a high-speed interconnect interface between the memory node 11 and the computing node 13 Connected to implement information interaction between the memory node 11 and the compute node 13.
实施例一Embodiment 1
参阅附图1b,本发明实施例所述的远端内存分配方法的流程图,本发明实施例所述的方法应用于图1a所示的应用场景中。具体的,包括下述步骤:Referring to FIG. 1b, a flowchart of a remote memory allocation method according to an embodiment of the present invention is applied to the application scenario shown in FIG. 1a. Specifically, the following steps are included:
S101、内存节点接收计算节点发送的请求,所述请求指示所述计算节点向所述内存节点申请XB的远端内存,其中,所述内存节点和所述计算节点之间通过 网络通信连接,所述X大于零且小于2n,所述n为所述内存节点CPU通用寄存器的数据宽度;S101. The memory node receives a request sent by a computing node, where the request indicates that the computing node requests the remote memory of the XB from the memory node, where the memory node and the computing node are connected by using a network communication. Where X is greater than zero and less than 2 n , and n is the data width of the memory node CPU general purpose register;
需要说明的是,本发明实施例中所述的内存节点是指具有物理存储空间和网络通信功能的节点,在本发明实施例中称之为内存节点是为了便于表述,不应理解为限制性规定。同样的,本发明实施例中所述的计算节点是指具有运算能力和网络通信功能的节点,在本发明实施例中称之为计算节点也是为了便于表述,不应理解为限制性规定。It should be noted that the memory node in the embodiment of the present invention refers to a node having a physical storage space and a network communication function. The memory node is referred to as a memory node in the embodiment of the present invention for convenience of description, and should not be construed as a limitation. Provisions. Similarly, the computing node described in the embodiment of the present invention refers to a node having a computing capability and a network communication function. The computing node is also referred to as a computing node in the embodiment of the present invention, and should not be construed as a limitation.
作为本发明的另一个实施例,所述请求还指示所述远端内存为远端物理内存;或者,所述请求还指示所述远端内存为远端虚拟内存;或者,所述请求还指示所述远端内存为远端物理内存和远端虚拟内存。In another embodiment of the present invention, the request further indicates that the remote memory is a remote physical memory; or the request further indicates that the remote memory is a remote virtual memory; or the request further indicates The remote memory is remote physical memory and remote virtual memory.
作为本发明的再一个实施例,所述请求还指示还指示第一起始地址,所述第一起始地址是指所述远端内存起始位置面向所述计算节点的地址。In still another embodiment of the present invention, the request further indicates that the first start address is further indicated, and the first start address refers to an address of the remote memory start location facing the computing node.
S103、所述内存节点从所述内存节点的空闲内核内存为所述计算节点分配所述XB的第一内核内存;S103. The memory node allocates the first kernel memory of the XB from the free core memory of the memory node to the computing node.
需要说明的是,本发明实施例所述的技术方案针对的是所述内存节点的CPU运行在内核态的情况下。应当理解的是,所述内存节点从所述内存节点的空闲内核内存为所述计算节点分配所述XB的第一内核内存,具体包括:所述内存节点判断所述内存节点的空闲内核内存是否大于或者等于所述远端内存,并在所述空闲内核内存大于或者等于所述远端内存的情况下,所述内存节点从所述空闲内核内存中为所述计算节点分配所述XB的第一内核内存。应当理解的是,在所述空闲内核内存小于所述远端内存的情况下,则不再继续进行下述步骤,也即所述内存节点不为所述计算节点分配所述远端内存。It should be noted that the technical solution described in the embodiment of the present invention is directed to the case where the CPU of the memory node operates in a kernel mode. It should be understood that, the memory node allocates the first kernel memory of the XB to the computing node from the free kernel memory of the memory node, and specifically includes: the memory node determining whether the free kernel memory of the memory node is If the free memory is greater than or equal to the remote memory, and the memory node allocates the XB to the computing node from the free core memory. A kernel memory. It should be understood that in the case where the free kernel memory is smaller than the remote memory, the following steps are not continued, that is, the memory node does not allocate the remote memory for the computing node.
需要说明的是,为了更好的实现本方案,所述内存节点的操作系统在为内核设置参数时,为该内存节点的内核配备足够的内核内存。例如,对于64位CPU,可以将内核内存配置为8EB,这样可以提供充足的内核内存以分配给计算节点。It should be noted that, in order to better implement the solution, the operating system of the memory node provides sufficient kernel memory for the kernel of the memory node when setting parameters for the kernel. For example, for a 64-bit CPU, the kernel memory can be configured to 8EB, which provides sufficient kernel memory for allocation to compute nodes.
S105、在所述内存节点从所述内存节点的空闲内核内存为所述计算节点分配所述XB的第一内核内存之后,且在所述计算节点向所述远端内存读写数据之前,所述方法还包括:S105. After the memory node allocates the first kernel memory of the XB from the free kernel memory of the memory node to the computing node, and before the computing node reads and writes data to the remote memory, The method also includes:
所述内存节点将所述第一内核内存映射到所述内存节点的第一存储空间,以 实现为所述计算节点分配所述远端内存,进而使得所述计算节点向所述第一存储空间读写数据,所述第一存储空间的大小为所述XB;所述第一存储空间为物理内存,或,所述第一存储空间为虚拟内存,或,所述第一存储空间为物理内存和虚拟内存。The memory node maps the first kernel memory to a first storage space of the memory node to The computing device allocates the remote memory, and the computing node reads and writes data to the first storage space, where the size of the first storage space is the XB; the first storage space is Physical memory, or the first storage space is virtual memory, or the first storage space is physical memory and virtual memory.
值得注意的是,所述内存节点从所述内存节点的空闲内核内存为所述计算节点分配所述XB的第一内核内存之后,所述计算节点被分配的是大小为XB的逻辑内存,因为在第一内核内存映射的真正的存储空间之前,它只是一段逻辑内存,由于逻辑内存不能用来读取数据,所以所述计算节点不能将数据读取到所述第一内核内存。结合步骤S105可知,在所述计算节点被分配所述第一内核内存之后,且在所述第一内核内存映射到所述第一存储空间之前,所述计算节点没有向所述第一内核内存读写数据。所述计算节点是在所述第一内核内存映射到所述第一存储空间之后,向所述第一存储空间读写数据的。应当理解的是,步骤S105所说的“所述内存节点将所述第一内核内存映射到所述内存节点的第一存储空间”是基于内存分页机制实现逻辑地址到物理地址的映射。It is noted that after the memory node allocates the first kernel memory of the XB from the free kernel memory of the memory node to the computing node, the computing node is allocated a logical memory of size XB because Before the real storage space of the first kernel memory map, it is only a piece of logical memory. Since the logical memory cannot be used to read data, the computing node cannot read data into the first kernel memory. Referring to step S105, after the computing node is allocated the first kernel memory, and before the first kernel memory is mapped to the first storage space, the computing node does not have the first kernel memory. Read and write data. The computing node reads and writes data to the first storage space after the first kernel is memory mapped to the first storage space. It should be understood that the "memory node maps the first kernel memory to the first storage space of the memory node" in step S105 is a mapping of a logical address to a physical address based on a memory paging mechanism.
需要说明的是,在所述请求还指示所述远端内存为远端物理内存的情况下,所述内存节点将所述第一内核内存映射到所述内存节点的第一存储空间,以实现为所述计算节点分配所述远端内存,进而使得所述计算节点向所述第一存储空间读写数据,所述第一存储空间的大小为所述XB,具体包括:所述内存节点将所述第一内核内存映射到所述内存节点的第一物理内存,以实现为所述计算节点分配所述远端物理内存,进而使得所述计算节点向所述第一物理内存读写数据,所述第一物理内存的大小为所述XB。应当理解的是,在所述内存节点将所述第一内核内存映射到所述内存节点的第一物理内存之前,本发明实施例所述的方法还包括:所述内存节点判断所述内存节点的空闲物理内存是否大于或者等于所述远端内存,并在所述空闲物理内存大于或者等于所述远端内存的情况下,所述内存节点从所述空闲物理内存中为所述计算节点分配所述第一物理内存。应当理解的是,在所述空闲物理内存小于所述远端内存的情况下,则不再继续进行下述步骤,也即所述内存节点不为所述计算节点分配所述远端内存。It should be noted that, in a case that the request further indicates that the remote memory is a remote physical memory, the memory node maps the first kernel memory to a first storage space of the memory node to implement Allocating the remote memory to the computing node, so that the computing node reads and writes data to the first storage space, where the size of the first storage space is the XB, specifically: the memory node will The first core memory is mapped to the first physical memory of the memory node, so as to allocate the remote physical memory to the computing node, so that the computing node reads and writes data to the first physical memory. The size of the first physical memory is the XB. It should be understood that, before the memory node maps the first kernel memory to the first physical memory of the memory node, the method of the embodiment of the present invention further includes: the memory node determining the memory node Whether the free physical memory is greater than or equal to the remote memory, and if the free physical memory is greater than or equal to the remote memory, the memory node allocates the calculated node from the free physical memory. The first physical memory. It should be understood that, in the case that the free physical memory is smaller than the remote memory, the following steps are not continued, that is, the memory node does not allocate the remote memory to the computing node.
进一步需要说明的是,在所述请求还指示所述远端内存为远端物理内存和远端虚拟内存,且所述远端物理内存的大小为KB,所述远端虚拟内存的大小为 XB-KB的情况下,所述内存节点将所述第一内核内存映射到所述内存节点的第一存储空间,以实现为所述计算节点分配所述远端内存,进而使得所述计算节点向所述第一存储空间读写数据,所述第一存储空间的大小为所述XB,具体包括:所述内存节点将所述第一内核内存中大小为KB的部分映射到所述内存节点的物理内存,所述内存节点将所述第一内核内存中大小为XB-KB的部分映射到所述内存节点的虚拟内存,进而使得所述计算节点向所述KB的物理内存和所述XB-KB的虚拟内存中读写数据。类似的,在所述内存节点将所述第一内核内存中大小为KB的部分映射到所述内存节点的物理内存之前,所述内存节点还判断所述内存节点的空闲物理内存是否大于或者等于所述KB,并在所述空闲物理内存大于或者等于所述KB的情况下,所述内存节点将所述第一内核内存中大小为KB的部分映射到所述内存节点的物理内存。值得注意的是,在所述请求还指示第一起始地址的情况下,本发明实施例提供的技术方案还包括:所述内存节点建立所述第一起始地址和第二起始地址之间的映射关系,所述第二起始地址是指所述空闲内核内存中所述第一内核内存起始位置的地址。需要说明的是,所述计算节点向所述远端内存读取数据A时,会将所述数据A和所述数据A的起始位置面向所述计算节点的地址A1发送给所述内存节点,所述内存节点根据所述映射关系,判断出所述数据A的起始位置在所述空闲内核内存中的地址A2,在将所述A2映射到所述内存节点的存储空间A3,以将所述数据A读写到所述A3中。其中所述A3可以是物理内存,也可以是虚拟内存,或者所述A3的一部分为物理内存,另一部分为虚拟内存。It is further noted that the request further indicates that the remote memory is a remote physical memory and a remote virtual memory, and the size of the remote physical memory is KB, and the size of the remote virtual memory is XB. In the case of -KB, the memory node maps the first kernel memory to the first storage space of the memory node to implement allocation of the remote memory to the computing node, thereby causing the computing node to The first storage space reads and writes data, and the size of the first storage space is the XB, specifically: the memory node maps a portion of the first kernel memory with a size of KB to the memory node. a physical memory, the memory node mapping a portion of the first kernel memory having an size of XB-KB to the virtual memory of the memory node, thereby causing the computing node to the physical memory of the KB and the XB- Read and write data in KB's virtual memory. Similarly, before the memory node maps a portion of the first kernel memory with a size of KB to the physical memory of the memory node, the memory node further determines whether the free physical memory of the memory node is greater than or equal to The KB, and in a case where the free physical memory is greater than or equal to the KB, the memory node maps a portion of the first kernel memory having a size of KB to a physical memory of the memory node. It is noted that, in a case that the request further indicates the first start address, the technical solution provided by the embodiment of the present invention further includes: the memory node establishing between the first start address and the second start address Mapping relationship, the second starting address is an address of the first kernel memory starting position in the free core memory. It should be noted that, when the computing node to the distal end of the memory read data A, the data will be a starting position for the A and the data A, the address of the computing node A 1 is sent to the memory a node, the memory node determining, according to the mapping relationship, an address A 2 in the free kernel memory of the starting position of the data A, and mapping the A 2 to the storage space A of the memory node 3, to write the data to the A 3 in A. The A 3 may be physical memory or virtual memory, or part of the A 3 is physical memory, and the other part is virtual memory.
可知,本发明实施例提供的技术方案中,内存节点根据计算节点的请求,从内存节点的空闲内核内存中为计算节点分配第一内核内存,再将该第一内核内存映射到第一存储空间,以实现为计算节点分配远端内存。作为本领域的公知常识,在内存节点中,内核内存是操作系统为内核对象分配的内存,是逻辑内存,内核内存要远远大于内存节点的物理内存,基于虚拟内存技术,内核内存不仅可以映射到物理内存,也可以映射到虚拟内存(即从外存上扩展的虚拟内存)。所以,采用本发明实施例提供的技术方案,计算节点向内存节点申请远端内存时,不受该内存节点中空闲物理内存上限的限制,计算节点可以向内存节点申请更大 的远端内存。It can be seen that, in the technical solution provided by the embodiment of the present invention, the memory node allocates the first kernel memory from the free kernel memory of the memory node according to the request of the computing node, and then maps the first kernel memory to the first storage space. To achieve allocation of remote memory for compute nodes. As a common knowledge in the field, in the memory node, the kernel memory is the memory allocated by the operating system for the kernel object, the logical memory, the kernel memory is much larger than the physical memory of the memory node, and based on the virtual memory technology, the kernel memory can not only map. To physical memory, you can also map to virtual memory (that is, virtual memory that is extended from external memory). Therefore, when the computing node requests the remote memory from the memory node, the computing node is not limited by the upper limit of the free physical memory in the memory node, and the computing node can apply for a larger memory node. Remote memory.
实施例二Embodiment 2
参阅附图1c,本发明实施例所述的远端内存分配方法的流程图,本发明实施例所述的方法应用于图1a所示的应用场景中。具体的,包括下述步骤:Referring to FIG. 1c, a flowchart of a remote memory allocation method according to an embodiment of the present invention is applied to the application scenario shown in FIG. 1a. Specifically, the following steps are included:
S111、内存节点接收计算节点发送的请求,所述请求指示所述计算节点向所述内存节点申请XB的远端内存,其中,所述X大于零且小于2n,所述n为所述内存节点CPU通用寄存器的数据宽度,所述内存节点和所述计算节点之间通过网络通信连接;S111. The memory node receives a request sent by the computing node, where the request indicates that the computing node requests the remote memory of the XB from the memory node, where the X is greater than zero and less than 2 n , and the n is the memory. a data width of a node CPU general purpose register, wherein the memory node and the computing node are connected by a network communication;
需要说明的是,本发明实施例中所述的内存节点是指具有物理存储空间和网络通信功能的节点,在本发明实施例中称之为内存节点是为了便于表述,不应理解为限制性规定。同样的,本发明实施例中所述的计算节点是指具有运算能力和网络通信功能的节点,在本发明实施例中称之为计算节点也是为了便于表述,不应理解为限制性规定。It should be noted that the memory node in the embodiment of the present invention refers to a node having a physical storage space and a network communication function. The memory node is referred to as a memory node in the embodiment of the present invention for convenience of description, and should not be construed as a limitation. Provisions. Similarly, the computing node described in the embodiment of the present invention refers to a node having a computing capability and a network communication function. The computing node is also referred to as a computing node in the embodiment of the present invention, and should not be construed as a limitation.
作为本发明的另一个实施例,所述请求还指示所述远端内存为远端物理内存;或者,所述请求还指示所述远端内存为远端虚拟内存;或者,所述请求还指示所述远端内存为远端物理内存和远端虚拟内存。In another embodiment of the present invention, the request further indicates that the remote memory is a remote physical memory; or the request further indicates that the remote memory is a remote virtual memory; or the request further indicates The remote memory is remote physical memory and remote virtual memory.
作为本发明的再一个实施例,所述请求还指示第一起始地址,所述第一起始地址是指所述远端内存起始位置面向所述计算节点的地址。In still another embodiment of the present invention, the request further indicates a first start address, where the first start address refers to an address of the remote memory start location facing the computing node.
S113、所述内存节点根据所述请求,从第一目标进程的空闲逻辑内存为所述计算节点分配所述XB的第一逻辑内存,所述第一目标进程是指运行在所述内存节点中、具有与所述计算节点交互的第一接口且能通过所述第一接口为所述计算节点分配逻辑内存的进程,所述第一目标进程的空闲逻辑内存大于或者等于所述XB;S113. The memory node allocates, according to the request, the first logical memory of the XB from the idle logical memory of the first target process, where the first target process refers to running in the memory node. a process having a first interface that interacts with the computing node and capable of allocating logical memory to the computing node through the first interface, the idle logical memory of the first target process is greater than or equal to the XB;
值得注意的是,当程序被操作系统调用到内存以后,操作系统会给程序分配一定的资源(例如逻辑内存等),然后进行一系列的复杂操作,使程序变成进程以供系统调用。对于一个进程来说,它的逻辑内存和CPU的位数之间的关系通常为:进程的逻辑内存为2rB,其中r为CPU的位数。通常的,进程的逻辑内存远大于物理内存,且进程的逻辑内存中往往有很大一部分是空闲的。 It is worth noting that when the program is called into memory by the operating system, the operating system allocates certain resources (such as logical memory, etc.) to the program, and then performs a series of complicated operations to make the program become a process for the system to call. For a process, the relationship between its logical memory and the number of bits of the CPU is usually: the logical memory of the process is 2 r B, where r is the number of bits of the CPU. Usually, the logical memory of a process is much larger than physical memory, and a large part of the logical memory of a process is often idle.
需要说明的是,本发明实施例所述的第一目标进程是从运行在所述内存节点的多个进程中选择出来的,或者,所述第一目标进程是有所述内存节点创建的。也即,所述内存节点接收计算节点发送的请求之后,以及所述内存节点根据所述请求,从第一目标进程的空闲逻辑内存为所述计算节点分配所述XB的第一逻辑内存之前,所述方法还包括:所述内存节点从运行在所述内存节点的所有进程中选择出所述第一目标进程;或者,所述内存节点创建所述第一目标进程,并为所述第一目标进程分配逻辑内存。优选的,所述内存节点创建所述第一目标进程,是在运行在所述内存节点的所有进程中不存在所述第一目标进程的情况下。It should be noted that the first target process described in the embodiment of the present invention is selected from multiple processes running on the memory node, or the first target process is created by the memory node. That is, after the memory node receives the request sent by the computing node, and the memory node allocates the first logical memory of the XB from the idle logical memory of the first target process to the computing node according to the request, The method further includes: the memory node selecting the first target process from all processes running in the memory node; or the memory node creating the first target process and being the first The target process allocates logical memory. Preferably, the memory node creates the first target process in a case where the first target process does not exist in all processes running in the memory node.
在有多个计算节点向所述内存节点请求远端内存,且所述内存节点需要创建两个以上所述第一目标进程的情况下,需要说明的是,所述内存节点的内核数量大于创建所述第一目标进程之前运行所述内存节点上的进程的数量的情况下,所述方法还包括:创建的所述第一目标进程之后,运行在所述内存节点上的进程的数量不超过所述内存节点的内核数量。这是为了保证进程的运行速度,应当知道的是,若运行在所述内存节点上的进程的数量超过所述内存节点的内核数量,则进程的运行速度要慢一些。In the case that a plurality of computing nodes request remote memory from the memory node, and the memory node needs to create two or more of the first target processes, it should be noted that the number of cores of the memory node is greater than that of the creation. In the case that the first target process runs the number of processes on the memory node, the method further includes: after the first target process is created, the number of processes running on the memory node does not exceed The number of cores of the memory node. This is to ensure the speed of the process. It should be known that if the number of processes running on the memory node exceeds the number of cores of the memory node, the process runs slower.
S115、在所述内存节点从所述第一目标进程的空闲逻辑内存为所述计算节点分配所述XB的第一逻辑内存之后,且在所述计算节点向所述远端内存读写数据之前,所述方法还包括:S115, after the memory node allocates the first logical memory of the XB from the idle logical memory of the first target process to the computing node, and before the computing node reads and writes data to the remote memory The method further includes:
所述内存节点将所述第一逻辑内存映射到所述内存节点的第一存储空间,以实现为所述计算节点分配所述远端内存,进而使得所述计算节点向所述第一存储空间读写数据;其中,所述第一存储空间的大小为所述XB,所述第一存储空间为物理内存和虚拟内存,或,所述第一存储空间为物理内存,或,所述第一存储空间为虚拟内存。Mapping, by the memory node, the first logical memory to a first storage space of the memory node, to implement allocating the remote memory to the computing node, thereby causing the computing node to move to the first storage space Reading and writing data; wherein the size of the first storage space is the XB, the first storage space is physical memory and virtual memory, or the first storage space is physical memory, or the first The storage space is virtual memory.
值得注意的是,所述内存节点从所述第一目标进程的空闲逻辑内存为所述计算节点分配所述XB的第一逻辑内存之后,所述计算节点被分配的是大小为XB的逻辑内存,因为在所述第一逻辑内存映射的真正的存储空间之前,它只是一段逻辑内存,由于逻辑内存不能用来读取数据,所以所述计算节点不能将数据读取到所述第一逻辑内存。结合步骤S115可知,在所述计算节点被分配所述第 一逻辑内存之后,且在所述第一逻辑内存映射到所述第一存储空间之前,所述计算节点没有向所述第一逻辑内存读写数据。所述计算节点是在所述第一逻辑内存映射到所述第一存储空间之后,向所述第一存储空间读写数据的。应当理解的是,步骤S115所说的“所述内存节点将所述第一逻辑内存映射到所述内存节点的第一存储空间”是基于内存分页机制实现逻辑地址到物理地址的映射。It is noted that, after the memory node allocates the first logical memory of the XB from the idle logical memory of the first target process to the computing node, the computing node is allocated a logical memory of size XB. Because the virtual memory is only a piece of logical memory before the real storage space of the first logical memory map, since the logical memory cannot be used to read data, the computing node cannot read data to the first logical memory. . Referring to step S115, the computing node is assigned the first After a logical memory, and before the first logical memory is mapped to the first storage space, the computing node does not read or write data to the first logical memory. The computing node reads and writes data to the first storage space after the first logical memory is mapped to the first storage space. It should be understood that the “memory node maps the first logical memory to the first storage space of the memory node” in step S115 is a mapping of a logical address to a physical address based on a memory paging mechanism.
需要说明的是,在所述请求还指示所述远端内存为远端物理内存的情况下,所述内存节点将所述第一逻辑内存映射到所述内存节点的第一存储空间,以实现为所述计算节点分配所述远端内存,进而使得所述计算节点向所述第一存储空间读写数据,具体包括:所述内存节点将所述第一逻辑内存映射到所述内存节点的第一物理内存,以实现为所述计算节点分配所述远端物理内存,进而使得所述计算节点向所述第一物理内存读写数据,所述第一物理内存的大小为所述XB。应当理解的是,在所述内存节点将所述第一逻辑内存映射到所述内存节点的第一物理内存之前,本发明实施例所述的方法还包括:所述内存节点判断所述内存节点的空闲物理内存是否大于或者等于所述远端内存,并在所述空闲物理内存大于或者等于所述远端内存的情况下,所述内存节点从所述空闲物理内存中为所述计算节点分配所述第一物理内存。应当理解的是,在所述空闲物理内存小于所述远端内存的情况下,则不再继续进行下述步骤,也即所述内存节点不为所述计算节点分配所述远端内存。It should be noted that, in a case that the request further indicates that the remote memory is a remote physical memory, the memory node maps the first logical memory to a first storage space of the memory node to implement Allocating the remote memory to the computing node, so that the computing node reads and writes data to the first storage space, specifically, the memory node mapping the first logical memory to the memory node The first physical memory is configured to allocate the remote physical memory to the computing node, so that the computing node reads and writes data to the first physical memory, and the size of the first physical memory is the XB. It should be understood that, before the memory node maps the first logical memory to the first physical memory of the memory node, the method of the embodiment of the present invention further includes: the memory node determining the memory node Whether the free physical memory is greater than or equal to the remote memory, and if the free physical memory is greater than or equal to the remote memory, the memory node allocates the calculated node from the free physical memory. The first physical memory. It should be understood that, in the case that the free physical memory is smaller than the remote memory, the following steps are not continued, that is, the memory node does not allocate the remote memory to the computing node.
值得注意的是,在所述请求还指示第一起始地址的情况下,本发明实施例提供的技术方案还包括:所述内存节点建立所述第一起始地址和第二起始地址之间的映射关系,所述第二起始地址是指在所述空闲逻辑内存中所述第一逻辑内存起始位置的地址。需要说明的是,所述计算节点向所述远端内存读取数据A时,会将所述数据A和所述数据A的起始位置面向所述计算节点的地址A1发送给所述内存节点,所述内存节点根据所述映射关系,判断出所述数据A的起始位置在所述空闲内核内存中的地址A2,在将所述A2映射到所述内存节点的存储空间A3,以将所述数据A读写到所述A3中。其中所述A3可以是物理内存,也可以是虚拟内存,或者所述A3的一部分为物理内存,另一部分为虚拟内存。It is noted that, in a case that the request further indicates the first start address, the technical solution provided by the embodiment of the present invention further includes: the memory node establishing between the first start address and the second start address a mapping relationship, where the second starting address refers to an address of the first logical memory starting position in the idle logical memory. It should be noted that, when the computing node to the distal end of the memory read data A, the data will be a starting position for the A and the data A, the address of the computing node A 1 is sent to the memory a node, the memory node determining, according to the mapping relationship, an address A 2 in the free kernel memory of the starting position of the data A, and mapping the A 2 to the storage space A of the memory node 3, to write the data to the A 3 in A. The A 3 may be physical memory or virtual memory, or part of the A 3 is physical memory, and the other part is virtual memory.
可知,本发明实施例提供的技术方案中,内存节点根据计算节点的请求, 从第一目标进程的空闲逻辑内存为所述计算节点分配第一逻辑内存,所述第一目标进程运行在所述内存节点中;再将该第一逻辑内存映射到所述内存节点的第一存储空间,以实现为所述计算节点分配远端内存。作为本领域的公知常识,进程的逻辑内存要远远大于内存节点的物理内存,基于虚拟内存技术,进程的逻辑内存不仅可以映射到物理内存,也可以映射到虚拟内存(即从外存上扩展的虚拟内存)。所以,采用本发明实施例提供的技术方案,计算节点向内存节点申请远端内存时,不受该内存节点中空闲物理内存上限的限制,计算节点可以向内存节点申请更大的远端内存。It can be seen that, in the technical solution provided by the embodiment of the present invention, the memory node is requested according to the computing node. Allocating first logical memory to the computing node from idle logical memory of the first target process, the first target process running in the memory node; mapping the first logical memory to the first of the memory node Storage space to enable allocation of remote memory to the compute node. As a common knowledge in the art, the logical memory of a process is much larger than the physical memory of a memory node. Based on the virtual memory technology, the logical memory of a process can be mapped not only to physical memory but also to virtual memory (ie, extended from external memory). Virtual memory). Therefore, with the technical solution provided by the embodiment of the present invention, when the computing node applies for the remote memory to the memory node, the computing node can apply for a larger remote memory to the memory node without being limited by the upper limit of the free physical memory in the memory node.
实施例三Embodiment 3
参见附图2a,为本发明实施例提供的一种远端内存分配装置200的结构示意图,优选的,本发明实施例所述的远端内存分配装置200集成在图1a所示的内存节点中。需要说明的是,本发明实施例所述的远端内存分配装置200是实施例一所述的方法的执行主体,可用于执行实施例一所述的方法。具体的,远端内存分配装置200包括:FIG. 2a is a schematic structural diagram of a remote memory allocation device 200 according to an embodiment of the present invention. Preferably, the remote memory allocation device 200 according to the embodiment of the present invention is integrated into the memory node shown in FIG. 1a. . It should be noted that the remote memory allocation device 200 of the embodiment of the present invention is an execution body of the method described in the first embodiment, and can be used to perform the method described in the first embodiment. Specifically, the remote memory allocation device 200 includes:
接收单元201,用于接收计算节点发送的请求,所述请求指示所述计算节点向内存节点申请XB的远端内存,所述X大于零且小于2n,所述n为所述内存节点CPU通用寄存器的数据宽度;The receiving unit 201 is configured to receive a request sent by the computing node, where the request instructs the computing node to apply for a remote memory of the XB to the memory node, where the X is greater than zero and less than 2 n , and the n is the memory node CPU The data width of the general purpose register;
作为本发明的一个实施例,所述请求还指示所述远端内存为远端物理内存;或者,所述请求还指示所述远端内存为远端虚拟内存;或者,所述请求还指示所述远端内存为远端物理内存和远端虚拟内存。As an embodiment of the present invention, the request further indicates that the remote memory is a remote physical memory; or the request further indicates that the remote memory is a remote virtual memory; or the request further indicates The remote memory is the remote physical memory and the remote virtual memory.
作为本发明的另一个实施例,所述请求还指示第一起始地址,所述第一起始地址是指所述远端内存起始位置面向所述计算节点的地址。As another embodiment of the present invention, the request further indicates a first start address, where the first start address refers to an address of the remote memory start location facing the computing node.
分配单元203,用于从所述内存节点的空闲内核内存为所述计算节点分配所述XB的第一内核内存;The allocating unit 203 is configured to allocate, by the free kernel memory of the memory node, the first kernel memory of the XB to the computing node;
需要说明的是,本发明实施例所述的技术方案针对的是所述内存节点的CPU运行在内核态的情况下。It should be noted that the technical solution described in the embodiment of the present invention is directed to the case where the CPU of the memory node operates in a kernel mode.
在所述分配单元从所述内存节点的空闲内核内存为所述计算节点分配所述XB的第一内核内存之后,且在所述计算节点向所述远端内存读写数据之前,After the allocating unit allocates the first kernel memory of the XB from the free kernel memory of the memory node to the computing node, and before the computing node reads and writes data to the remote memory,
映射单元205,用于将所述第一内核内存映射到所述内存节点的第一存储空 间,以实现为所述计算节点分配所述远端内存,进而使得所述计算节点向所述第一存储空间读写数据;其中,所述第一存储空间的大小为所述XB,所述第一存储空间为物理内存,或,所述第一存储空间为虚拟内存,或,所述第一存储空间为物理内存和虚拟内存。a mapping unit 205, configured to map the first kernel memory to the first storage space of the memory node And allocating the remote memory to the computing node, so that the computing node reads and writes data to the first storage space; wherein the size of the first storage space is the XB, The first storage space is physical memory, or the first storage space is virtual memory, or the first storage space is physical memory and virtual memory.
需要说明的是,在所述请求还指示所述远端内存为远端物理内存的情况下,映射单元205具体用于将所述第一内核内存映射到所述内存节点的第一物理内存,以实现为所述计算节点分配所述远端物理内存,进而使得所述计算节点向所述第一物理内存读写数据,所述第一物理内存的大小为所述XB。It should be noted that, in the case that the request further indicates that the remote memory is the remote physical memory, the mapping unit 205 is specifically configured to map the first kernel memory to the first physical memory of the memory node. The remote physical memory is allocated to the computing node, so that the computing node reads and writes data to the first physical memory, and the size of the first physical memory is the XB.
在所述请求还指示第一起始地址的情况下,参见附图2b所述的远端内存分配装置210,所述远端内存分配装置210还包括建立单元212,其中,建立单元212用于建立所述第一起始地址和第二起始地址之间的映射关系,所述第二起始地址是指所述空闲内核内存中所述第一内核内存起始位置的地址。In the case where the request further indicates the first start address, referring to the remote memory allocation device 210 described in FIG. 2b, the remote memory allocation device 210 further includes an establishing unit 212, wherein the establishing unit 212 is configured to establish a mapping relationship between the first start address and the second start address, where the second start address refers to an address of the first kernel memory start position in the free core memory.
需要说明的是,本实施例和实施例一所述的内容可互相参见,重复的内容不再赘述。It should be noted that the content described in this embodiment and the first embodiment can be referred to each other, and the duplicated content is not described again.
可知,在本发明实施例提供的远端内存分配装置中,内存节点根据计算节点的请求,从内存节点的空闲内核内存中为计算节点分配第一内核内存,再将该第一内核内存映射到第一存储空间,以实现为计算节点分配远端内存。作为本领域的公知常识,在内存节点中,内核内存是操作系统为内核对象分配的内存,是逻辑内存,内核内存要远远大于内存节点的物理内存,基于虚拟内存技术,内核内存不仅可以映射到物理内存,也可以映射到虚拟内存(即从外存上扩展的虚拟内存)。所以,采用本发明实施例提供的远端内存分配装置,计算节点向内存节点申请远端内存时,不受该内存节点中空闲物理内存上限的限制,计算节点可以向内存节点申请更大的远端内存。It can be seen that, in the remote memory allocation device provided by the embodiment of the present invention, the memory node allocates the first kernel memory from the free kernel memory of the memory node according to the request of the computing node, and then maps the first kernel memory to The first storage space is configured to allocate remote memory for the compute node. As a common knowledge in the field, in the memory node, the kernel memory is the memory allocated by the operating system for the kernel object, the logical memory, the kernel memory is much larger than the physical memory of the memory node, and based on the virtual memory technology, the kernel memory can not only map. To physical memory, you can also map to virtual memory (that is, virtual memory that is extended from external memory). Therefore, the remote memory allocation device provided by the embodiment of the present invention, when the computing node applies for the remote memory to the memory node, is not limited by the upper limit of the free physical memory in the memory node, and the computing node can apply for a greater distance to the memory node. Side memory.
实施例四Embodiment 4
参见附图2c,为本发明实施例提供的一种远端内存分配装置220的结构示意图,优选的,本发明实施例所述的远端内存分配装置220集成在图1a所示的内存节点中。需要说明的是,本发明实施例所述的远端内存分配装置220是实施例二所述的方法的执行主体,可用于执行实施例二所述的方法。具体的,远端内存分配装置220包括:2c is a schematic structural diagram of a remote memory allocation device 220 according to an embodiment of the present invention. Preferably, the remote memory allocation device 220 according to the embodiment of the present invention is integrated into the memory node shown in FIG. 1a. . It should be noted that the remote memory allocation device 220 of the embodiment of the present invention is an execution body of the method described in the second embodiment, and can be used to perform the method described in the second embodiment. Specifically, the remote memory allocation device 220 includes:
接收单元221,用于接收计算节点发送的请求,所述请求指示所述计算节点 向内存节点申请XB的远端内存,其中,所述X大于零且小于2n,所述n为所述内存节点CPU通用寄存器的数据宽度,所述内存节点和所述计算节点之间通过网络通信连接;The receiving unit 221 is configured to receive a request sent by the computing node, where the request instructs the computing node to apply to the memory node for the remote memory of the XB, where the X is greater than zero and less than 2 n , and the n is the memory a data width of a node CPU general purpose register, wherein the memory node and the computing node are connected by a network communication;
作为本发明的一个实施例,所述请求还指示所述远端内存为远端物理内存;或者,所述请求还指示所述远端内存为远端虚拟内存;或者,所述请求还指示所述远端内存为远端物理内存和远端虚拟内存。As an embodiment of the present invention, the request further indicates that the remote memory is a remote physical memory; or the request further indicates that the remote memory is a remote virtual memory; or the request further indicates The remote memory is the remote physical memory and the remote virtual memory.
作为本发明的另一个实施例,所述请求还指示第一起始地址,所述第一起始地址是指所述远端内存起始位置面向所述计算节点的地址。As another embodiment of the present invention, the request further indicates a first start address, where the first start address refers to an address of the remote memory start location facing the computing node.
分配单元223,用于根据所述请求,从第一目标进程的空闲逻辑内存为所述计算节点分配所述XB的第一逻辑内存,所述第一目标进程是指运行在所述内存节点中、具有与所述计算节点交互的第一接口且能通过所述第一接口为所述计算节点分配逻辑内存的进程,所述第一目标进程的空闲逻辑内存大于或者等于所述XB;The allocating unit 223 is configured to allocate, according to the request, the first logical memory of the XB from the idle logical memory of the first target process, where the first target process refers to running in the memory node. a process having a first interface that interacts with the computing node and capable of allocating logical memory to the computing node through the first interface, the idle logical memory of the first target process is greater than or equal to the XB;
需要说明的是,本发明实施例所述的第一目标进程是从运行在所述内存节点的多个进程中选择出来的,或者,所述第一目标进程是有所述内存节点创建的。It should be noted that the first target process described in the embodiment of the present invention is selected from multiple processes running on the memory node, or the first target process is created by the memory node.
具体的,参见图2d(1)所示的远端内存分配装置230,远端内存分配装置230还包括选择单元232,在接收单元231接收计算节点发送的请求之后,以及分配单元233根据所述请求,从第一目标进程的空闲逻辑内存为所述计算节点分配所述XB的第一逻辑内存之前,选择单元232用于从运行在所述内存节点的所有进程中选择出所述第一目标进程。Specifically, referring to the remote memory allocation device 230 shown in FIG. 2d (1), the remote memory allocation device 230 further includes a selecting unit 232, after the receiving unit 231 receives the request sent by the computing node, and the allocating unit 233 according to the Requesting, before the first logical memory of the first target process allocates the first logical memory of the XB to the computing node, the selecting unit 232 is configured to select the first target from all processes running in the memory node process.
或者,参见图2d(2)所示的远端内存分配装置240,远端内存分配装置240还包括创建单元242,在接收单元241接收计算节点发送的请求之后,以及分配单元243根据所述请求,从第一目标进程的空闲逻辑内存为所述计算节点分配所述XB的第一逻辑内存之前,创建单元242用于创建所述第一目标进程,并为所述第一目标进程分配逻辑内存。Alternatively, referring to the remote memory allocation device 240 shown in FIG. 2d (2), the remote memory allocation device 240 further includes a creating unit 242, after the receiving unit 241 receives the request sent by the computing node, and the allocating unit 243 according to the request Before the first logical memory of the first target process allocates the first logical memory of the XB to the computing node, the creating unit 242 is configured to create the first target process and allocate logical memory for the first target process .
需要说明的是,在所述内存节点的内核数量大于创建所述第一目标进程之前运行所述内存节点上的进程的数量的情况下,创建单元242创建所述第一目标进程之后,运行在所述内存节点上的进程的数量不超过所述内存节点的内核数量。这是为了保证进程的运行速度,应当知道的是,若运行在所述内存节点上的进程 的数量超过所述内存节点的内核数量,则进程的运行速度要慢一些。It should be noted that, in a case where the number of kernels of the memory node is greater than the number of processes running the memory node before the first target process is created, the creating unit 242 creates the first target process and runs in the The number of processes on the memory node does not exceed the number of cores of the memory node. This is to ensure the speed of the process, it should be known that if the process running on the memory node The number of threads exceeds the number of cores in the memory node, and the process runs slower.
在所述分配单元从所述第一目标进程的空闲逻辑内存为所述计算节点分配所述XB的第一逻辑内存之后,且在所述计算节点向所述远端内存读写数据之前,After the allocating unit allocates the first logical memory of the XB from the idle logical memory of the first target process to the computing node, and before the computing node reads and writes data to the remote memory,
映射单元225,用于将所述第一逻辑内存映射到所述内存节点的第一存储空间,以实现为所述计算节点分配所述远端内存,进而使得所述计算节点向所述第一存储空间读写数据,所述第一存储空间的大小为所述XB;所述第一存储空间为物理内存和虚拟内存,或,所述第一存储空间为物理内存,或,所述第一存储空间为虚拟内存。The mapping unit 225 is configured to map the first logical memory to the first storage space of the memory node, so as to implement allocating the remote memory to the computing node, so that the computing node is to the first The first storage space is the physical memory and the virtual memory, or the first storage space is physical memory, or the first The storage space is virtual memory.
需要说明的是,在所述请求还指示所述远端内存为远端物理内存的情况下,映射单元225具体用于将所述第一逻辑内存映射到所述内存节点的第一物理内存,以实现为所述计算节点分配所述远端物理内存,进而使得所述计算节点向所述第一物理内存读写数据,所述第一物理内存的大小为所述XB。It should be noted that, in a case that the request further indicates that the remote memory is the remote physical memory, the mapping unit 225 is specifically configured to map the first logical memory to the first physical memory of the memory node, The remote physical memory is allocated to the computing node, so that the computing node reads and writes data to the first physical memory, and the size of the first physical memory is the XB.
值得注意的是,参见附图2e所示的远端内存分配装置250,远端内存分配装置250还包括建立单元252,在所述请求还指示第一起始地址的情况下,建立单元252用于建立所述第一起始地址和第二起始地址之间的映射关系,所述第二起始地址是指在所述空闲逻辑内存中所述第一逻辑内存起始位置的地址。It should be noted that, referring to the remote memory allocation device 250 shown in FIG. 2e, the remote memory allocation device 250 further includes an establishing unit 252. In the case where the request further indicates the first starting address, the establishing unit 252 is configured to use Establishing a mapping relationship between the first start address and a second start address, where the second start address refers to an address of the first logical memory start position in the idle logical memory.
需要说明的是,本实施例和实施例二所述的内容可互相参见,重复的内容不再赘述。It should be noted that the content described in this embodiment and the second embodiment can be referred to each other, and the duplicated content is not described again.
可知,在本发明实施例提供的远端内存分配装置中,内存节点根据计算节点的请求,从第一目标进程的空闲逻辑内存为所述计算节点分配第一逻辑内存,所述第一目标进程运行在所述内存节点中;再将该第一逻辑内存映射到所述内存节点的第一存储空间,以实现为所述计算节点分配远端内存。作为本领域的公知常识,进程的逻辑内存要远远大于内存节点的物理内存,基于虚拟内存技术,进程的逻辑内存不仅可以映射到物理内存,也可以映射到虚拟内存(即从外存上扩展的虚拟内存)。所以,采用本发明实施例提供的远端内存分配装置,计算节点向内存节点申请远端内存时,不受该内存节点中空闲物理内存上限的限制,计算节点可以向内存节点申请更大的远端内存。It can be seen that, in the remote memory allocation device provided by the embodiment of the present invention, the memory node allocates the first logical memory to the computing node from the idle logical memory of the first target process according to the request of the computing node, where the first target process Running in the memory node; mapping the first logical memory to the first storage space of the memory node to implement allocating remote memory to the computing node. As a common knowledge in the art, the logical memory of a process is much larger than the physical memory of a memory node. Based on the virtual memory technology, the logical memory of a process can be mapped not only to physical memory but also to virtual memory (ie, extended from external memory). Virtual memory). Therefore, the remote memory allocation device provided by the embodiment of the present invention, when the computing node applies for the remote memory to the memory node, is not limited by the upper limit of the free physical memory in the memory node, and the computing node can apply for a greater distance to the memory node. Side memory.
实施例五 Embodiment 5
参见附图3a所示的远端内存分配系统,包括计算节点301、内存节点305和如实施例三所述的远端内存分配装置303。Referring to the remote memory allocation system shown in FIG. 3a, a computing node 301, a memory node 305, and a remote memory allocation device 303 as described in the third embodiment are included.
具体的,计算节点301用于发送远端内存分配装置303接收的所述请求;Specifically, the computing node 301 is configured to send the request received by the remote memory allocation device 303;
内存节点305用于提供所述第一存储空间;The memory node 305 is configured to provide the first storage space;
计算节点301还用于获取所述第一存储空间为所述远端内存。The computing node 301 is further configured to acquire the first storage space as the remote memory.
优选的,远端内存分配装置303集成在内存节点305中。Preferably, the remote memory allocation device 303 is integrated in the memory node 305.
需要说明的是,远端内存分配装置303的功能参见实施例三的解释说明,此处不再赘述。It should be noted that the function of the remote memory allocation device 303 is described in the explanation of the third embodiment, and details are not described herein again.
可知,基于实施例三中所述的远端内存分配装置303的有益效果,采用本发明实施例所述的远端内存分配系统,计算节点301向内存节点305申请远端内存时,不受该内存节点305中空闲物理内存上限的限制,计算节点301可以向内存节点305申请更大的远端内存。It can be seen that, based on the beneficial effects of the remote memory allocation device 303 described in the third embodiment, the remote memory allocation system according to the embodiment of the present invention is used, and the computing node 301 is not required to apply for the remote memory to the memory node 305. The memory node 305 can limit the upper limit of the free physical memory, and the compute node 301 can apply for a larger remote memory to the memory node 305.
实施例六Embodiment 6
参见附图3b所示的远端内存分配系统,包括计算节点311、内存节点315和如实施例四所述的远端内存分配装置313。Referring to the remote memory allocation system shown in FIG. 3b, a computing node 311, a memory node 315, and a remote memory allocation device 313 as described in the fourth embodiment are included.
具体的,计算节点311用于发送远端内存分配装置313接收的所述请求;Specifically, the computing node 311 is configured to send the request received by the remote memory allocation device 313.
内存节点315用于提供所述第一存储空间;The memory node 315 is configured to provide the first storage space;
计算节点311还用于获取所述第一存储空间为所述远端内存。The computing node 311 is further configured to acquire the first storage space as the remote memory.
优选的,远端内存分配装置313集成在内存节点315中。Preferably, the remote memory allocation device 313 is integrated in the memory node 315.
需要说明的是,远端内存分配装置313的功能参见实施例四的解释说明,此处不再赘述。It should be noted that the function of the remote memory allocation device 313 is described in the explanation of Embodiment 4, and details are not described herein again.
可知,基于实施例四中所述的远端内存分配装置313的效果,采用本发明实施例所述的远端内存分配系统,计算节点311向内存节点315申请远端内存时,不受该内存节点315中空闲物理内存上限的限制,计算节点311可以向内存节点315申请更大的远端内存。It can be seen that, based on the effect of the remote memory allocation device 313 described in the fourth embodiment, the remote memory allocation system according to the embodiment of the present invention is used. When the computing node 311 requests the remote memory from the memory node 315, the memory is not affected by the memory. The limit of the upper limit of the free physical memory in the node 315, the compute node 311 can apply for a larger remote memory to the memory node 315.
其中上述实施例之间可以相互参见。The above embodiments can be referred to each other.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。 The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
另外,在本发明各个实施例提供的网络设备中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in the network device provided by each embodiment of the present invention 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. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit, if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, or all or part of the technical solution, may be embodied in the form of a software product stored in a storage medium. A number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the various examples described in connection 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 solution. A person skilled in the art can use different methods for implementing the described functions for each particular application, but such implementation should not be considered to be beyond the scope of the present invention.
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。The various embodiments in the specification are described in a progressive manner, and the same or similar parts between the various embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
以上所述的本发明实施方式,并不构成对本发明保护范围的限定。任何在本发明的精神和原则之内所作的修改、等同替换和改进等,均应包含在本发明的保护范围之内。 The embodiments of the invention described above are not intended to limit the scope of the invention. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the invention are intended to be included within the scope of the invention.

Claims (26)

  1. 一种远端内存分配方法,其特征在于,包括:A remote memory allocation method, comprising:
    内存节点接收计算节点发送的请求,所述请求指示所述计算节点向所述内存节点申请XB的远端内存,其中,所述内存节点和所述计算节点之间通过网络通信连接,所述X大于零且小于2n,所述n为所述内存节点CPU通用寄存器的数据宽度;The memory node receives a request sent by the computing node, the request instructing the computing node to apply for remote memory of the XB to the memory node, where the memory node and the computing node are connected by network communication, the X Greater than zero and less than 2 n , the n is the data width of the memory node CPU general purpose register;
    所述内存节点从所述内存节点的空闲内核内存为所述计算节点分配所述XB的第一内核内存;The memory node allocates the first kernel memory of the XB to the computing node from the free kernel memory of the memory node;
    在所述内存节点从所述内存节点的空闲内核内存为所述计算节点分配所述XB的第一内核内存之后,且在所述计算节点向所述远端内存读写数据之前,所述方法还包括:After the memory node allocates the first kernel memory of the XB from the free kernel memory of the memory node for the computing node, and before the computing node reads and writes data to the remote memory, the method Also includes:
    所述内存节点将所述第一内核内存映射到所述内存节点的第一存储空间,以实现为所述计算节点分配所述远端内存,进而使得所述计算节点向所述第一存储空间读写数据,所述第一存储空间的大小为所述XB;所述第一存储空间为物理内存,或,所述第一存储空间为虚拟内存,或,所述第一存储空间为物理内存和虚拟内存。The memory node maps the first kernel memory to the first storage space of the memory node, so as to allocate the remote memory to the computing node, so that the computing node is to the first storage space Read and write data, the size of the first storage space is the XB; the first storage space is physical memory, or the first storage space is virtual memory, or the first storage space is physical memory And virtual memory.
  2. 根据权利要求1所述的方法,其特征在于:The method of claim 1 wherein:
    所述请求还指示所述远端内存为远端物理内存;或者,The request further indicates that the remote memory is a remote physical memory; or
    所述请求还指示所述远端内存为远端虚拟内存;或者,The request further indicates that the remote memory is a remote virtual memory; or
    所述请求还指示所述远端内存为远端物理内存和远端虚拟内存。The request further indicates that the remote memory is remote physical memory and remote virtual memory.
  3. 根据权利要求2所述的方法,其特征在于:The method of claim 2 wherein:
    在所述请求还指示所述远端内存为远端物理内存的情况下,In the case where the request further indicates that the remote memory is remote physical memory,
    所述内存节点将所述第一内核内存映射到所述内存节点的第一存储空间,以实现为所述计算节点分配所述远端内存,进而使得所述计算节点向所述第一存储空间读写数据,所述第一存储空间的大小为所述XB,具体包括:The memory node maps the first kernel memory to the first storage space of the memory node, so as to allocate the remote memory to the computing node, so that the computing node is to the first storage space Reading and writing data, the size of the first storage space is the XB, and specifically includes:
    所述内存节点将所述第一内核内存映射到所述内存节点的第一物理内存,以实现为所述计算节点分配所述远端物理内存,进而使得所述计算节点向所述第一物理内存读写数据,所述第一物理内存的大小为所述XB。The memory node maps the first kernel memory to a first physical memory of the memory node to implement allocating the remote physical memory to the computing node, thereby causing the computing node to the first physical The memory reads and writes data, and the size of the first physical memory is the XB.
  4. 根据权利要求1至3任一项所述的方法,其特征在于,所述请求还指示第一 起始地址,所述第一起始地址是指所述远端内存起始位置面向所述计算节点的地址;The method according to any one of claims 1 to 3, wherein the request further indicates the first a starting address, where the first starting address is an address of the remote memory starting location facing the computing node;
    所述方法还包括:The method further includes:
    所述内存节点建立所述第一起始地址和第二起始地址之间的映射关系,所述第二起始地址是指所述空闲内核内存中所述第一内核内存起始位置的地址。The memory node establishes a mapping relationship between the first start address and a second start address, where the second start address refers to an address of the first kernel memory start position in the free core memory.
  5. 一种远端内存分配方法,其特征在于,包括:A remote memory allocation method, comprising:
    内存节点接收计算节点发送的请求,所述请求指示所述计算节点向所述内存节点申请XB的远端内存,其中,所述X大于零且小于2n,所述n为所述内存节点CPU通用寄存器的数据宽度,所述内存节点和所述计算节点之间通过网络通信连接;The memory node receives a request sent by the computing node, where the request indicates that the computing node requests the remote memory of the XB from the memory node, where the X is greater than zero and less than 2 n , and the n is the memory node CPU a data width of the general purpose register, wherein the memory node and the computing node are connected by a network communication;
    所述内存节点根据所述请求,从第一目标进程的空闲逻辑内存为所述计算节点分配所述XB的第一逻辑内存,所述第一目标进程是指运行在所述内存节点中、具有与所述计算节点交互的第一接口且能通过所述第一接口为所述计算节点分配逻辑内存的进程,所述第一目标进程的空闲逻辑内存大于或者等于所述XB;The memory node allocates, according to the request, the first logical memory of the XB from the idle logical memory of the first target process to the computing node, where the first target process refers to running in the memory node, a first interface that interacts with the computing node and can allocate a logical memory to the computing node through the first interface, where the idle logical memory of the first target process is greater than or equal to the XB;
    在所述内存节点从所述第一目标进程的空闲逻辑内存为所述计算节点分配所述XB的第一逻辑内存之后,且在所述计算节点向所述远端内存读写数据之前,所述方法还包括:After the memory node allocates the first logical memory of the XB from the idle logical memory of the first target process to the computing node, and before the computing node reads and writes data to the remote memory, The method also includes:
    所述内存节点将所述第一逻辑内存映射到所述内存节点的第一存储空间,以实现为所述计算节点分配所述远端内存,进而使得所述计算节点向所述第一存储空间读写数据;其中,所述第一存储空间的大小为所述XB,所述第一存储空间为物理内存和虚拟内存,或,所述第一存储空间为物理内存,或,所述第一存储空间为虚拟内存。Mapping, by the memory node, the first logical memory to a first storage space of the memory node, to implement allocating the remote memory to the computing node, thereby causing the computing node to move to the first storage space Reading and writing data; wherein the size of the first storage space is the XB, the first storage space is physical memory and virtual memory, or the first storage space is physical memory, or the first The storage space is virtual memory.
  6. 根据权利要求5所述的方法,其特征在于,The method of claim 5 wherein:
    所述内存节点接收计算节点发送的请求之后,以及所述内存节点根据所述请求,从第一目标进程的空闲逻辑内存为所述计算节点分配所述XB的第一逻辑内存之前,所述方法还包括:After the memory node receives the request sent by the computing node, and the memory node allocates the first logical memory of the XB from the idle logical memory of the first target process to the computing node according to the request, the method Also includes:
    所述内存节点从运行在所述内存节点的所有进程中选择出所述第一目标进程。 The memory node selects the first target process from among all processes running on the memory node.
  7. 根据权利要求5所述的方法,其特征在于,The method of claim 5 wherein:
    所述内存节点接收计算节点发送的请求之后,以及所述内存节点根据所述请求,从第一目标进程的空闲逻辑内存为所述计算节点分配所述XB的第一逻辑内存之前,所述方法还包括:After the memory node receives the request sent by the computing node, and the memory node allocates the first logical memory of the XB from the idle logical memory of the first target process to the computing node according to the request, the method Also includes:
    所述内存节点创建所述第一目标进程,并为所述第一目标进程分配逻辑内存。The memory node creates the first target process and allocates logical memory for the first target process.
  8. 根据权利要求5至7任一项所述的方法,其特征在于:A method according to any one of claims 5 to 7, wherein:
    所述请求还指示所述远端内存为远端物理内存;或者,The request further indicates that the remote memory is a remote physical memory; or
    所述请求还指示所述远端内存为远端虚拟内存;或者,The request further indicates that the remote memory is a remote virtual memory; or
    所述请求还指示所述远端内存为远端物理内存和远端虚拟内存。The request further indicates that the remote memory is remote physical memory and remote virtual memory.
  9. 根据权利要求8所述的方法,其特征在于:The method of claim 8 wherein:
    在所述请求还指示所述远端内存为远端物理内存的情况下,In the case where the request further indicates that the remote memory is remote physical memory,
    所述内存节点将所述第一逻辑内存映射到所述内存节点的第一存储空间,以实现为所述计算节点分配所述远端内存,进而使得所述计算节点向所述第一存储空间读写数据,具体包括:Mapping, by the memory node, the first logical memory to a first storage space of the memory node, to implement allocating the remote memory to the computing node, thereby causing the computing node to move to the first storage space Read and write data, including:
    所述内存节点将所述第一逻辑内存映射到所述内存节点的第一物理内存,以实现为所述计算节点分配所述远端物理内存,进而使得所述计算节点向所述第一物理内存读写数据,所述第一物理内存的大小为所述XB。The memory node maps the first logical memory to a first physical memory of the memory node to implement allocating the remote physical memory to the computing node, thereby causing the computing node to the first physical The memory reads and writes data, and the size of the first physical memory is the XB.
  10. 根据权利要求5至9任一项所述的方法,其特征在于,A method according to any one of claims 5 to 9, wherein
    所述请求还指示第一起始地址,所述第一起始地址是指所述远端内存起始位置面向所述计算节点的地址;The request further indicates a first start address, where the first start address refers to an address of the remote memory start location facing the computing node;
    所述方法还包括:The method further includes:
    所述内存节点建立所述第一起始地址和第二起始地址之间的映射关系,所述第二起始地址是指在所述空闲逻辑内存中所述第一逻辑内存起始位置的地址。The memory node establishes a mapping relationship between the first start address and a second start address, where the second start address refers to an address of the first logical memory start position in the idle logical memory .
  11. 根据权利要求7至10任一项所述的方法,其特征在于:A method according to any one of claims 7 to 10, characterized in that:
    所述内存节点的内核数量大于创建所述第一目标进程之前运行所述内存节点上的进程的数量的情况下,The number of cores of the memory node is greater than the number of processes running the memory node before the first target process is created,
    创建的所述第一目标进程之后,运行在所述内存节点上的进程的数量不超过所述内存节点的内核数量。After the first target process is created, the number of processes running on the memory node does not exceed the number of cores of the memory node.
  12. 一种远端内存分配装置,其特征在于,包括: A remote memory allocation device, comprising:
    接收单元,用于接收计算节点发送的请求,所述请求指示所述计算节点向内存节点申请XB的远端内存,所述X大于零且小于2n,所述n为所述内存节点CPU通用寄存器的数据宽度;a receiving unit, configured to receive a request sent by the computing node, where the request instructs the computing node to apply for a remote memory of the XB to the memory node, where the X is greater than zero and less than 2 n , and the n is the CPU of the memory node The data width of the register;
    分配单元,用于从所述内存节点的空闲内核内存为所述计算节点分配所述XB的第一内核内存;An allocating unit, configured to allocate, by the free kernel memory of the memory node, the first kernel memory of the XB to the computing node;
    在所述分配单元从所述内存节点的空闲内核内存为所述计算节点分配所述XB的第一内核内存之后,且在所述计算节点向所述远端内存读写数据之前,After the allocating unit allocates the first kernel memory of the XB from the free kernel memory of the memory node to the computing node, and before the computing node reads and writes data to the remote memory,
    映射单元,用于将所述第一内核内存映射到所述内存节点的第一存储空间,以实现为所述计算节点分配所述远端内存,进而使得所述计算节点向所述第一存储空间读写数据,所述第一存储空间的大小为所述XB;所述第一存储空间为物理内存,或,所述第一存储空间为虚拟内存,或,所述第一存储空间为物理内存和虚拟内存。a mapping unit, configured to map the first kernel memory to a first storage space of the memory node, to implement allocating the remote memory to the computing node, thereby causing the computing node to the first storage Spatially reading and writing data, the size of the first storage space is the XB; the first storage space is physical memory, or the first storage space is virtual memory, or the first storage space is physical Memory and virtual memory.
  13. 根据权利要求12所述的装置,其特征在于:The device of claim 12 wherein:
    所述请求还指示所述远端内存为远端物理内存;或者,The request further indicates that the remote memory is a remote physical memory; or
    所述请求还指示所述远端内存为远端虚拟内存;或者,The request further indicates that the remote memory is a remote virtual memory; or
    所述请求还指示所述远端内存为远端物理内存和远端虚拟内存。The request further indicates that the remote memory is remote physical memory and remote virtual memory.
  14. 根据权利要求13所述的装置,其特征在于:The device of claim 13 wherein:
    在所述请求还指示所述远端内存为远端物理内存的情况下,In the case where the request further indicates that the remote memory is remote physical memory,
    所述映射单元具体用于将所述第一内核内存映射到所述内存节点的第一物理内存,以实现为所述计算节点分配所述远端物理内存,进而使得所述计算节点向所述第一物理内存读写数据,所述第一物理内存的大小为所述XB。The mapping unit is specifically configured to map the first kernel memory to the first physical memory of the memory node, so as to implement allocating the remote physical memory to the computing node, thereby causing the computing node to The first physical memory reads and writes data, and the size of the first physical memory is the XB.
  15. 根据权利要求12至14任一项所述的装置,其特征在于,所述请求还指示第一起始地址,所述第一起始地址是指所述远端内存起始位置面向所述计算节点的地址;The apparatus according to any one of claims 12 to 14, wherein the request further indicates a first start address, and the first start address is that the remote memory start position is facing the computing node. address;
    所述装置还包括:The device also includes:
    建立单元用于建立所述第一起始地址和第二起始地址之间的映射关系,所述第二起始地址是指所述空闲内核内存中所述第一内核内存起始位置的地址。The establishing unit is configured to establish a mapping relationship between the first starting address and the second starting address, where the second starting address is an address of the first kernel memory starting position in the free core memory.
  16. 一种远端内存分配装置,其特征在于,包括:A remote memory allocation device, comprising:
    接收单元,用于接收计算节点发送的请求,所述请求指示所述计算节点向 内存节点申请XB的远端内存,其中,所述X大于零且小于2n,所述n为所述内存节点CPU通用寄存器的数据宽度,所述内存节点和所述计算节点之间通过网络通信连接;a receiving unit, configured to receive a request sent by the computing node, where the request instructs the computing node to apply for a remote memory of the XB to the memory node, where the X is greater than zero and less than 2 n , and the n is the memory node a data width of a CPU general purpose register, wherein the memory node and the computing node are connected by a network communication;
    分配单元,用于根据所述请求,从第一目标进程的空闲逻辑内存为所述计算节点分配所述XB的第一逻辑内存,所述第一目标进程是指运行在所述内存节点中、具有与所述计算节点交互的第一接口且能通过所述第一接口为所述计算节点分配逻辑内存的进程,所述第一目标进程的空闲逻辑内存大于或者等于所述XB;An allocating unit, configured to allocate, according to the request, the first logical memory of the XB from the idle logical memory of the first target process, where the first target process refers to running in the memory node, a process having a first interface that interacts with the computing node and capable of allocating logical memory to the computing node through the first interface, the idle logical memory of the first target process is greater than or equal to the XB;
    在所述分配单元从所述第一目标进程的空闲逻辑内存为所述计算节点分配所述XB的第一逻辑内存之后,且在所述计算节点向所述远端内存读写数据之前,After the allocating unit allocates the first logical memory of the XB from the idle logical memory of the first target process to the computing node, and before the computing node reads and writes data to the remote memory,
    映射单元,用于将所述第一逻辑内存映射到所述内存节点的第一存储空间,以实现为所述计算节点分配所述远端内存,进而使得所述计算节点向所述第一存储空间读写数据,所述第一存储空间的大小为所述XB;所述第一存储空间为物理内存和虚拟内存,或,所述第一存储空间为物理内存,或,所述第一存储空间为虚拟内存。a mapping unit, configured to map the first logical memory to a first storage space of the memory node, to implement allocating the remote memory to the computing node, so that the computing node is to the first storage Spatially reading and writing data, the size of the first storage space is the XB; the first storage space is physical memory and virtual memory, or the first storage space is physical memory, or the first storage The space is virtual memory.
  17. 根据权利要求16所述的装置,其特征在于,The device of claim 16 wherein:
    在所述接收单元接收计算节点发送的请求之后,以及所述分配单元根据所述请求,从第一目标进程的空闲逻辑内存为所述计算节点分配所述XB的第一逻辑内存之前,所述装置还包括:After the receiving unit receives the request sent by the computing node, and the allocating unit allocates the first logical memory of the XB from the idle logical memory of the first target process to the computing node according to the request, The device also includes:
    选择单元,用于从运行在所述内存节点的所有进程中选择出所述第一目标进程。a selection unit for selecting the first target process from among all processes running on the memory node.
  18. 根据权利要求16所述的装置,其特征在于,The device of claim 16 wherein:
    在所述接收单元接收计算节点发送的请求之后,以及所述分配单元根据所述请求,从第一目标进程的空闲逻辑内存为所述计算节点分配所述XB的第一逻辑内存之前,所述装置还包括:After the receiving unit receives the request sent by the computing node, and the allocating unit allocates the first logical memory of the XB from the idle logical memory of the first target process to the computing node according to the request, The device also includes:
    创建单元,用于创建所述第一目标进程,并为所述第一目标进程分配逻辑内存。Creating a unit for creating the first target process and allocating logical memory for the first target process.
  19. 根据权利要求16至18任一项所述的装置,其特征在于: Apparatus according to any one of claims 16 to 18, wherein:
    所述请求还指示所述远端内存为远端物理内存;或者,The request further indicates that the remote memory is a remote physical memory; or
    所述请求还指示所述远端内存为远端虚拟内存;或者,The request further indicates that the remote memory is a remote virtual memory; or
    所述请求还指示所述远端内存为远端物理内存和远端虚拟内存。The request further indicates that the remote memory is remote physical memory and remote virtual memory.
  20. 根据权利要求19所述的装置,其特征在于:The device of claim 19 wherein:
    在所述请求还指示所述远端内存为远端物理内存的情况下,In the case where the request further indicates that the remote memory is remote physical memory,
    所述映射单元具体用于将所述第一逻辑内存映射到所述内存节点的第一物理内存,以实现为所述计算节点分配所述远端物理内存,进而使得所述计算节点向所述第一物理内存读写数据,所述第一物理内存的大小为所述XB。The mapping unit is specifically configured to map the first logical memory to the first physical memory of the memory node, so as to implement allocating the remote physical memory to the computing node, thereby causing the computing node to The first physical memory reads and writes data, and the size of the first physical memory is the XB.
  21. 根据权利要求16至20任一项所述的装置,其特征在于,Apparatus according to any one of claims 16 to 20, wherein
    所述请求还指示第一起始地址,所述第一起始地址是指所述远端内存起始位置面向所述计算节点的地址;The request further indicates a first start address, where the first start address refers to an address of the remote memory start location facing the computing node;
    所述装置还包括:The device also includes:
    建立单元,用于建立所述第一起始地址和第二起始地址之间的映射关系,所述第二起始地址是指在所述空闲逻辑内存中所述第一逻辑内存起始位置的地址。a establishing unit, configured to establish a mapping relationship between the first starting address and a second starting address, where the second starting address refers to a starting position of the first logical memory in the idle logical memory address.
  22. 根据权利要求18至21任一项所述的装置,其特征在于:Apparatus according to any one of claims 18 to 21, wherein:
    所述内存节点的内核数量大于创建所述第一目标进程之前运行所述内存节点上的进程的数量的情况下,The number of cores of the memory node is greater than the number of processes running the memory node before the first target process is created,
    所述创建单元创建的所述第一目标进程之后,运行在所述内存节点上的进程的数量不超过所述内存节点的内核数量。After the first target process created by the creation unit, the number of processes running on the memory node does not exceed the number of cores of the memory node.
  23. 一种远端内存分配系统,其特征在于,包括计算节点、内存节点和如权利要求12至15任一项所述的远端内存分配装置:A remote memory allocation system, comprising: a computing node, a memory node, and the remote memory allocation device according to any one of claims 12 to 15:
    所述计算节点用于发送所述远端内存分配装置接收的所述请求;The computing node is configured to send the request received by the remote memory allocation device;
    所述内存节点用于提供所述第一存储空间;The memory node is configured to provide the first storage space;
    所述计算节点还用于获取所述第一存储空间为所述远端内存。The computing node is further configured to acquire the first storage space as the remote memory.
  24. 根据权利要求23所述的系统,其特征在于:The system of claim 23 wherein:
    所述远端内存分配装置集成在所述内存节点。The remote memory allocation device is integrated in the memory node.
  25. 一种远端内存分配系统,其特征在于,包括计算节点、内存节点和如权利要求16至22任一项所述的远端内存分配装置:A remote memory allocation system, comprising: a computing node, a memory node, and the remote memory allocation device of any one of claims 16 to 22:
    所述计算节点用于发送所述远端内存分配装置接收的所述请求;The computing node is configured to send the request received by the remote memory allocation device;
    所述内存节点用于提供所述第一存储空间; The memory node is configured to provide the first storage space;
    所述计算节点还用于获取所述第一存储空间为所述远端内存。The computing node is further configured to acquire the first storage space as the remote memory.
  26. 根据权利要求25所述的系统,其特征在于:The system of claim 25 wherein:
    所述远端内存分配装置集成在所述内存节点。 The remote memory allocation device is integrated in the memory node.
PCT/CN2016/071483 2015-01-27 2016-01-20 Remote memory allocation method, device and system WO2016119618A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510041110.7 2015-01-27
CN201510041110.7A CN105988871B (en) 2015-01-27 2015-01-27 Remote memory allocation method, device and system

Publications (1)

Publication Number Publication Date
WO2016119618A1 true WO2016119618A1 (en) 2016-08-04

Family

ID=56542395

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/071483 WO2016119618A1 (en) 2015-01-27 2016-01-20 Remote memory allocation method, device and system

Country Status (2)

Country Link
CN (1) CN105988871B (en)
WO (1) WO2016119618A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107729145A (en) * 2017-10-11 2018-02-23 广东欧珀移动通信有限公司 Application program progress control method and device
CN111367461B (en) * 2018-12-25 2024-02-20 兆易创新科技集团股份有限公司 Storage space management method and device
CN112948149A (en) * 2021-03-29 2021-06-11 江苏为是科技有限公司 Remote memory sharing method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102110196A (en) * 2009-12-25 2011-06-29 中国长城计算机深圳股份有限公司 Method and system for safely transmitting data among parallel-running multiple user operating systems
CN103077120A (en) * 2012-12-31 2013-05-01 东软集团股份有限公司 Address conversion method and device of application shared memory
CN103942087A (en) * 2014-03-31 2014-07-23 华为技术有限公司 Virtual machine thermal migration method, related device and cluster computing system
CN104216835A (en) * 2014-08-25 2014-12-17 杨立群 Method and device for implementing memory fusion

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6785888B1 (en) * 1997-08-29 2004-08-31 International Business Machines Corporation Memory allocator for a multiprocessor computer system
CN101594309B (en) * 2009-06-30 2011-06-08 华为技术有限公司 Method and device for managing memory resources in cluster system, and network system
WO2012106908A1 (en) * 2011-07-20 2012-08-16 华为技术有限公司 Simulation method and simulator for remote memory access in multi-processor system
KR101355105B1 (en) * 2012-01-03 2014-01-23 서울대학교산학협력단 Shared virtual memory management apparatus for securing cache-coherent
CN104239227B (en) * 2013-06-20 2017-06-06 新华三技术有限公司 A kind of virtualization storage managing device, local virtual memory management unit and method
CN104102460A (en) * 2014-07-23 2014-10-15 浪潮(北京)电子信息产业有限公司 Cloud computing-based memory management method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102110196A (en) * 2009-12-25 2011-06-29 中国长城计算机深圳股份有限公司 Method and system for safely transmitting data among parallel-running multiple user operating systems
CN103077120A (en) * 2012-12-31 2013-05-01 东软集团股份有限公司 Address conversion method and device of application shared memory
CN103942087A (en) * 2014-03-31 2014-07-23 华为技术有限公司 Virtual machine thermal migration method, related device and cluster computing system
CN104216835A (en) * 2014-08-25 2014-12-17 杨立群 Method and device for implementing memory fusion

Also Published As

Publication number Publication date
CN105988871B (en) 2020-06-02
CN105988871A (en) 2016-10-05

Similar Documents

Publication Publication Date Title
US9678918B2 (en) Data processing system and data processing method
EP3214553B1 (en) Storage resource access method supporting sr-iov, storage controller and storage device
US9547535B1 (en) Method and system for providing shared memory access to graphics processing unit processes
CN110597451B (en) Method for realizing virtualized cache and physical machine
KR20200017363A (en) MANAGED SWITCHING BETWEEN ONE OR MORE HOSTS AND SOLID STATE DRIVES (SSDs) BASED ON THE NVMe PROTOCOL TO PROVIDE HOST STORAGE SERVICES
US10795599B2 (en) Data migration method, host and solid state disk
US20170004101A1 (en) Data copying method, direct memory access controller, and computer system
US8395631B1 (en) Method and system for sharing memory between multiple graphics processing units in a computer system
WO2015180598A1 (en) Method, apparatus and system for processing access information of storage device
CN111124951A (en) Method, apparatus and computer program product for managing data access
WO2016019566A1 (en) Memory management method, device and system and network-on-chip
WO2016065611A1 (en) File access method, system and host
US10761736B2 (en) Method and apparatus for integration of non-volatile memory
US20160085450A1 (en) System for providing remote memory and temporary page pool operating method for providing remote memory
WO2016119618A1 (en) Remote memory allocation method, device and system
US9575881B2 (en) Systems and methods for providing improved latency in a non-uniform memory architecture
EP3353664B1 (en) Method and apparatus for pinning memory pages in a multi-level system memory
US20130073779A1 (en) Dynamic memory reconfiguration to delay performance overhead
CN107250995B (en) Memory management device
JP2020502694A (en) Method and apparatus for accessing non-volatile memory as byte addressable memory
JP2013539111A (en) System and method for efficient sequential logging on a storage device that supports caching
CN112395220B (en) Processing method, device and system of shared storage controller and storage controller
JP2016522915A (en) Shared memory system
WO2021120843A1 (en) Cloud host memory allocation method, cloud host, device, and storage medium
US20200201691A1 (en) Enhanced message control banks

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16742680

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16742680

Country of ref document: EP

Kind code of ref document: A1