Memory allocation method and computing device
The management unit unifies the virtual address of the target memory space in cross-node server applications, which solves the problem that cross-node server applications cannot directly access the same memory space, and improves collaboration efficiency and memory access convenience between computing devices.
Patent Information
- Application Number
- CN202410608332.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-14
- Publication Date
- 2024-09-17
AI Technical Summary
Cross-node server applications cannot directly access the same memory space, resulting in inefficient collaboration. Data needs to be transmitted over the network for access and modification, which consumes a lot of bandwidth and reduces efficiency.
Determining the virtual address of the target memory space through the management unit allows different computing devices to directly access the shared memory space without passing the address offset, simplifying the access process and improving collaboration efficiency.
It achieves efficient memory space access between different computing devices, improves the collaboration efficiency of cross-node applications, and reduces data transmission and processing overhead.
Smart Images

Figure CN118656201A
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a memory allocation method and a computing device. Background Art
[0002] With the development of the Internet, the interactive collaboration between different applications has become more and more frequent, but not all applications are deployed on the same server. In fact, there are a large number of applications deployed on different servers. Applications deployed on different servers are also called cross-node server applications. These cross-node server applications cannot directly access the same memory space when collaborating.
[0003] Currently, if you want to enable cross-node server applications to access data in the same memory space, you need to first transfer the data from the server storing the data to another server that needs to access the data through the network. This is the only way to indirectly achieve the effect of accessing the data in the same memory space. Moreover, if the application modifies the data, the modified data needs to be transmitted back through the network. This method obviously reduces the collaboration efficiency between cross-node server applications. Summary of the invention
[0004] The embodiments of the present application provide a memory allocation method and a computing device, which can determine the address information of the target memory space according to the memory allocation request sent by the computing device, and unify the virtual address of the target memory space, so that different computing devices do not need to pass the address offset when accessing the target memory space, and thus do not need to calculate the address of the target data. Instead, access is directly achieved according to the virtual address of the target data, which simplifies the access process of the target memory space, improves the convenience of access, and thereby improves the collaboration efficiency between computing devices.
[0005] In a first aspect, an embodiment of the present application provides a memory allocation method, which is applied to a management unit, and the management unit is used to manage a computing quick link CXL memory space. The method includes: receiving a first memory allocation request sent by a first computing device, the aforementioned first memory allocation request is used to request the management unit to allocate a target memory space, and the aforementioned target memory space is a CXL memory space shared by the first computing device and the second computing device; the management unit determines address information of the target memory space according to the first memory allocation request, and the address information is used to indicate the position of the target memory space in the CXL memory space, wherein the address information includes a physical address and a virtual address corresponding to the physical address, and the aforementioned virtual address is generated by the management unit based on the physical address; the management unit sends the address information to the first computing device; the management unit sends the address information to the second computing device.
[0006] It can be understood that the management unit determines the address information, especially the virtual address, of the target memory space based on the first memory allocation request of the first computing device, thereby unifying the virtual addresses of the same shared memory space for different computing devices, simplifying the process of computing devices accessing the shared memory space, and improving collaboration efficiency.
[0007] In one possible implementation, the management unit sends address information to the second computing device, including: the management unit receives a second memory allocation request sent by the second computing device, the aforementioned second memory allocation request is used to request the management unit to allocate target memory space to the first computing device and the second computing device; the management unit sends address information to the second computing device according to the second memory allocation request.
[0008] It is understandable that, after the management unit determines that the second memory allocation request is received, the management unit sends the address information to the second computing device, which can effectively avoid the management unit sending the address information to the second computing device that is in a state where it cannot receive the information, thereby improving the accuracy of the timing of sending the address information. In addition, the management unit sends the corresponding address information according to the second memory allocation request, which can improve the accuracy of allocating the target memory space.
[0009] In a possible implementation, the management unit determines address information of the target memory space based on the first memory allocation request, including: determining the target memory space from the unallocated CXL memory space based on the capacity information in the first memory allocation request; obtaining the physical address of the target memory space; and generating a virtual address corresponding to the target memory space based on the physical address of the target memory space.
[0010] It can be understood that the management unit determines the target memory space based on the capacity information in the first memory allocation request, which can improve the accuracy of allocating CXL memory space, avoid waste caused by allocating too large memory space, and avoid data overflow caused by allocating too small memory space. The management unit generates a corresponding virtual address based on the physical address of the target memory space, thereby solving the problem that the physical address of the same target memory space corresponds to multiple different virtual addresses, and improving the convenience and efficiency of accessing the target memory space.
[0011] In a possible implementation, after the management unit determines the address information of the target memory space according to the first memory allocation request, the method further includes: saving the device identification of the first computing device, the device identification of the second computing device and the address information of the target memory space into a preset shared memory virtual address to physical address SMV2P mapping table; sending the address information to the second computing device, including: if a second memory allocation request sent by the second computing device is received, querying the SMV2P mapping table according to the device identification or virtual address in the second memory allocation request to obtain the address information of the target memory space corresponding to the device identification or virtual address; sending the address information to the second computing device. It can be understood that the management unit saves the device identification of the first computing device, the device identification of the second computing device and the address information of the target memory space into the SMV2P mapping table, which helps the management unit to manage the target memory space according to the SMV2P mapping table, and the management unit determines the address information of the target memory space according to the device identification or virtual address in the memory allocation request, thereby improving the accuracy and efficiency of allocating the target memory space, enabling different computing devices to access the same target memory space using the same virtual address, simplifying the access process, and improving the collaboration efficiency of computing devices.
[0012] In one possible implementation, the SMV2P mapping table includes a status message indicating whether the first computing device and the second computing device are each currently performing read and write operations on data in the target memory space. After sending address information to the second computing device, the method also includes: modifying the status information from a state indicating that the second computing device has not performed read and write operations on the data in the target memory space to a state where the second computing device has performed read and write operations on the data in the target memory space.
[0013] It is understandable that the management unit can improve the accuracy of the corresponding relationship by modifying the corresponding relationship after sending the address information to the second computing device, thereby improving the accuracy of the management unit when managing the target memory space according to the corresponding relationship.
[0014] In a possible implementation, the method further includes: the management unit determines the usage status of the target memory space based on the status information; if the target memory space is in an unused state, the management unit deletes the address information and device identification of the target memory space in the SMV2P mapping table.
[0015] It is understandable that when the management unit determines that the target memory space is not in use, it deletes the address information and device identification related to the target memory space recorded in the SMV2P mapping table. In this way, when the management unit receives a new memory allocation request, it cannot query the relevant information of the aforementioned target memory space through the SMV2P mapping table, and can then reallocate it to other computing devices, which can improve the utilization rate of the CXL memory space.
[0016] In a possible implementation, the address information of the target memory space includes the capacity of the target memory space, the physical address of the target memory space, and the virtual address of the target memory space.
[0017] It can be understood that the management unit records the capacity of the target memory space, the physical address of the target memory space or the virtual address of the target memory space, which improves the accuracy and efficiency of the management unit when sending the address information of the target memory space, and after the management unit sends the above-mentioned address information to the computing device, it can improve the collaboration efficiency between the computing devices.
[0018] In a second aspect, an embodiment of the present application provides a memory allocation method, which is applied to a first computing device, and the method includes: sending a first memory allocation request to a management unit, the management unit is used to manage the computing quick link CXL memory space, the first memory allocation request is used to request the management unit to allocate a target memory space, and the target memory space is the CXL memory space shared by the first computing device and the second computing device; receiving address information; the address information is determined by the management unit according to the first memory allocation request, the address information includes a physical address and a virtual address corresponding to the physical address, and the virtual address is generated by the management unit based on the physical address; according to the address information, performing data read and write operations on the target data in the target memory space; the target data is data for collaborative operations between the first computing device and the second computing device.
[0019] It can be understood that the first computing device performs data reading and writing operations on the target data in the target memory space based on the received address information, thereby avoiding the need for the computing device to calculate the virtual address of the target data through the offset of the virtual address before reading and writing the target data, thereby improving the efficiency of the first computing device in reading and writing the target data in the target memory space, and further improving the collaboration efficiency between different computing devices.
[0020] In one possible implementation, a computing device performs data read and write operations on target data in a target memory space based on address information, including: a first computing device determines a virtual address of the target data based on a virtual address of the target memory space; and a first computing device performs data read and write operations on the target data based on the virtual address of the target data.
[0021] It is understandable that the first computing device can directly read or write the target data according to its virtual address, which simplifies the process of reading and writing the target data in the CXL memory space and improves the collaboration efficiency.
[0022] In a possible implementation, the target data includes a pointer-type variable; the pointer-type variable is used to instruct the first computing device or the second computing device to access the data pointed to by the variable.
[0023] It is understandable that the first or second computing device can access the data pointed to by the target data of pointer type, which simplifies the access process of the pointer type data in the target memory space and improves the convenience of collaboration between different computing devices.
[0024] In a third aspect, an embodiment of the present application provides a memory allocation device, which is used to execute any one of the memory allocation methods provided in the first aspect above.
[0025] In a possible implementation, the embodiment of the present application can divide the memory allocation device into functional modules according to the method provided in the first aspect above. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. Exemplarily, the embodiment of the present application can divide the memory allocation device into a receiving module, a determining module, a sending module, etc. according to the function. The description of the possible technical solutions and beneficial effects executed by each of the functional modules divided above can refer to the technical solutions provided by the first aspect above or its corresponding possible implementation, which will not be repeated here.
[0026] In a fourth aspect, an embodiment of the present application provides a computing device, which includes a processor and a memory, wherein the processor is coupled to the memory; the memory is used to store computer instructions, which are loaded and executed by the processor to enable the computing device to implement the memory allocation method described in the above aspects.
[0027] In a fifth aspect, an embodiment of the present application provides a computing device cluster, which includes at least one computing device, each computing device includes a processor and a memory, and the processor is coupled to the memory; the processor of at least one computing device is used to execute computer instructions stored in the memory of at least one computing device, so that the computing device cluster executes the memory allocation method provided in various optional implementation methods of the above-mentioned first aspect.
[0028] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, in which at least one computer program instruction is stored, and the computer program instruction is loaded and executed by a processor to implement the memory allocation method as described in the above aspects.
[0029] In a seventh aspect, an embodiment of the present application provides a computer program product, the computer program product including computer instructions, the computer instructions stored in a computer-readable storage medium. A processor of a computing device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computing device executes the memory allocation method provided in various optional implementations of the first aspect above.
[0030] For the specific description of the third to seventh aspects and their various implementations in the embodiments of the present application, reference may be made to the detailed description in the first aspect and its various implementations; and for the beneficial effects of the third to seventh aspects and their various implementations, reference may be made to the beneficial effects analysis in the first aspect and its various implementations, which will not be repeated here.
[0031] These and other aspects of the embodiments of the present application will be more clearly understood in the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 It is a schematic diagram of an application scenario provided by an embodiment of the present application;
[0033] Figure 2 It is a schematic diagram of a shared memory access process in a related technology provided by an embodiment of the present application;
[0034] Figure 3 is a schematic diagram of the structure of a computing system provided in an embodiment of the present application;
[0035] Figure 4 is a schematic diagram of the structure of a computing system provided in an embodiment of the present application;
[0036] Figure 5 is a flowchart of a memory allocation method provided in an embodiment of the present application;
[0037] Figure 6 is a schematic diagram of a computing device provided in an embodiment of the present application;
[0038] Figure 7 is a flowchart of another memory allocation method provided in an embodiment of the present application;
[0039] Figure 8 This is a specific implementation flow chart of memory allocation provided by an embodiment of the present application;
[0040] Fig. 9 is another specific implementation flow chart of memory allocation provided by an embodiment of the present application;
[0041] Fig.10 It is a structural schematic diagram of a memory allocation device provided in an embodiment of the present application;
[0042] Fig.11 It is a structural diagram of another memory allocation device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] In order to make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0044] The term "multiple" as used herein refers to two or more than two. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.
[0045] Furthermore, in the description of the embodiments of the present application, unless otherwise specified, "multiple" refers to two or more than two. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0046] In addition, in order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "first", "second" and the like are used to distinguish the same items or similar items with substantially the same functions and effects. Those skilled in the art will understand that the words "first", "second" and the like do not limit the quantity and execution order, and the words "first", "second" and the like do not necessarily limit the differences. At the same time, in the embodiments of the present application, the words "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or design solutions. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete manner for ease of understanding.
[0047] First, the application scenarios of the embodiments of the present application are exemplarily introduced.
[0048] At present, with the development of computer technology, large-scale data has been generated, making more and more computing devices must be able to work together effectively to process complex data or complex tasks, and different computing devices are preferably able to share the same memory space, so as to avoid using disk storage with relatively poor performance, so as to achieve better collaboration. However, in traditional technology, two independent computing devices cannot access the same memory space, which leads to the need for applications on independent computing devices, such as cross-node server applications, to access data in the same memory space. The target data needs to be transferred to the target computing device through a network or other transmission method before the target computing device can read and write the target data. Moreover, if the target computing device modifies the data, it needs to send back the modified data to achieve synchronous data collaboration.
[0049] For example, computing device A and computing device B need to work together. When computing device B needs to modify target data A in the same memory space in a server, target data A needs to be transferred from the server to computing device B. After computing device B modifies the data, it transmits the modified target data A back to the server to synchronously update the data. Correspondingly, when computing device A needs to modify target data A, the above transmission process is also required.
[0050] Obviously, this method will cause the same data to be copied and transmitted multiple times, consuming a large amount of transmission bandwidth resources and resulting in extremely low collaboration efficiency between various computing devices.
[0051] To address the above issues, the relevant technology generally adopts connecting computing devices with multi-port compute express link (CXL) devices to achieve cross-node data transmission-free access. Specifically, CXL is an open computing device interconnection standard, such as Figure 1 As shown, Figure 1 is a schematic diagram of an application scenario provided by an embodiment of the present application, specifically a scenario in which a computing device accesses a CXL memory space. Figure 1 The multi-port CXL storage device 1000 includes two ports, which are respectively connected to a first computing device 1100 and a second computing device 1200. The multi-port CXL storage device 1000 includes a controller 1010 and a memory 1020. The memory 1020 further includes a plurality of memory spaces such as a memory space 1 and a memory space 2. The controller 1010 may be a CXL controller or a CXL expansion control chip.
[0052] The first computing device 1100 runs multiple processes such as process A and process B, and the second computing device 1200 runs multiple processes such as process M and process N. The process A on the first computing device 1100 and the process M on the second computing device 1200 can access the data in the multi-port CXL storage device 1000, including the memory space 1. Specifically, when the process A on the first computing device 1100 applies for a memory space shared with the process M on the second computing device 1200, for example, when the memory space 1 is applied for, the process A will receive the physical address and virtual address of the memory space 1, wherein the virtual address of the memory space 1 is randomly generated by the first computing device 1100 based on the physical address of the memory space 1, for example, 0x80000000. The process A records the mapping relationship between the physical address and the generated virtual address through its page table (PT), and completes the mapping of the memory space 1 to the virtual address space of the process A. At this point, the process A can read and write the data in the memory space 1 without transmission.
[0053] Among them, generating virtual addresses based on physical addresses of memory space is a commonly used method in modern computer operating systems. This method can avoid the process from directly operating the memory space through physical addresses, and to a certain extent expand the available memory space and simplify the coordination problems between multiple processes in an operating system.
[0054] Correspondingly, when process M on the second computing device 1200 applies for a memory space shared with process A on the first computing device 1100, for example, when the above-mentioned memory space 1 is applied for, process M will receive the physical address and virtual address of memory space 1, wherein the virtual address of memory space 1 is randomly generated by the second computing device 1200 based on the physical address of memory space 1, for example, 0x09990000. Process M records the mapping relationship between the physical address and the generated virtual address through its page table, and completes the mapping of memory space 1 to the virtual address space of process M. At this point, process M can also read and write data in memory space 1 without transmission.
[0055] Obviously, the above two virtual addresses are different. The shared memory access process based on the relevant technology is as follows: Figure 2 As shown, Figure 2 It is a schematic diagram of the shared memory access process in CXL in the related art, wherein process A running on the first computing device 10 and process M running on the second computing device 20 respectively access the same shared memory in the CXL memory pool through their respective page tables. From the difference in the page table positions pointed by the arrows, it can be known that process A and process M use different virtual addresses when accessing the shared memory.
[0056] Furthermore, the virtual addresses corresponding to the same target data in the shared memory are also different. For example, if the physical offset of the target data based on the starting address of the shared memory is a000, then the virtual address reflected in the page table of process A may be 0x8000a000, while the virtual address reflected in the page table of process B may be 0x0999a000.
[0057] This method has at least the following defects: First, the collaboration efficiency is low. Since the virtual addresses of processes across nodes are not unified, especially the starting addresses of the virtual addresses are not unified, when accessing the target data in the shared memory, process A cannot directly pass the virtual address corresponding to the target data to process B, but needs to pass an offset, and process B needs to perform calculations after receiving the offset to obtain the virtual address of the target data based on the starting address of the virtual address of the shared memory in process B, thereby enabling process B to access the target data in the shared memory.
[0058] Second, if the shared memory contains variables whose data structure is a pointer type, since the data stored in the pointer type variable is a virtual address, the data pointed to by the pointer type variable can only be accessed normally in one process but not in another process.
[0059] For example, the data stored in the pointer variable A in the shared memory is 0x8000a000, and the virtual address range of the shared memory in process A is 0x80000000-0x90000000; the virtual address range of the shared memory in process B is 0x99000000-0x99990000, so that process A can normally access the data pointed to by the pointer variable A, but because 0x8000a000 is not within the virtual address range of the shared memory in process B, process B cannot access the data pointed to by the pointer variable A.
[0060] Moreover, in some cases, even if the data stored in the pointer variable falls within the virtual address range of the shared memory in the process, due to the different starting addresses of the virtual addresses, the data accessed by the process may not be the target data that it needs to cooperate in reading and writing.
[0061] In summary, the relevant technologies limit the access efficiency and convenience of cross-node applications to the shared memory space in the CXL device, thereby reducing the collaboration efficiency of cross-node applications.
[0062] In view of this, the following embodiment of the present application provides a memory allocation method, which can determine the address information of the target memory space according to the memory allocation request sent by the process, and unify the virtual address of the target memory space, so that when processes on different computing devices access the target memory space, there is no need to pass the address offset, and thus there is no need to calculate the address of the target data. Instead, access is directly achieved based on the virtual address of the target data, which simplifies the access process of the target memory space, improves the convenience of access, and thereby improves the efficiency of collaboration between processes.
[0063] Secondly, the system architecture of the embodiment of the present application is exemplarily introduced.
[0064] The embodiments of the present application relate to at least two system architectures based on multi-port CXL storage devices.
[0065] The first one is Figure 3 As shown, Figure 3 A schematic diagram of the structure of a computing system provided in an embodiment of the present application.
[0066] The computing system includes multiple computing devices, and the computing device may be a multi-port CXL storage device, a first computing device, and a second computing device. Figure 3 Multiple multi-port CXL storage devices such as the multi-port CXL storage device 3000 and the multi-port CXL storage device 3300 are connected to the first computing device 3100 and the second computing device 3200. The number of computing devices connected to each multi-port CXL storage device depends on the number of ports it has and actual needs. For example, a four-port CXL storage device can be connected to at most four computing devices, and an eight-port CXL storage device can be connected to at most eight computing devices. Figure 3 Only the dual-port CXL memory device is shown to be connected to two computing devices.
[0067] Among them, multiple processes such as process A and process B are running on the first computing device 3100, and multiple processes such as process M and process N are running on the second computing device 3200. The multi-port CXL storage device 3000 includes a controller 3010 and a memory 3020, and the memory 3020 further includes multiple memory spaces such as memory space 1 and memory space 2. The multi-port CXL storage device 3300 includes a controller 3310 and a memory 3320, and the memory 3320 further includes multiple memory spaces such as memory space 8 and memory space 9. The above memory space can be a dual inline memory module (DIMM) or a dynamic random access memory (DRAM).
[0068] The management unit in the embodiment of the present application may be deployed in the controller of the multi-port CXL storage device in the form of firmware or process, for example Figure 3 The management unit 3030 is deployed in the controller 3010 , and the management unit 3330 is deployed in the controller 3310 .
[0069] The second type Figure 4 As shown, Figure 4 A schematic diagram of the structure of a computing system provided in an embodiment of the present application.
[0070] The computing system includes multiple computing devices, and the computing devices may be a CXL switch, a multi-port CXL storage device, a first computing device, and a second computing device. Figure 4 The CXL switch 4000 is connected to a plurality of computing devices such as a first computing device 4100 and a second computing device 4200, and a plurality of multi-port CXL storage devices such as a multi-port CXL storage device 4300 and a multi-port CXL storage device 4400. The first computing device 4100 runs a plurality of processes such as process A and process B, and the second computing device 4200 runs a plurality of processes such as process M and process N. The multi-port CXL storage device 4300 includes a controller 4310 and a memory 4320, and the memory 4320 further includes a plurality of memory spaces such as memory space 1 and memory space 2. The multi-port CXL storage device 4400 includes a controller 4410 and a memory 4420, and the memory 4420 further includes a plurality of memory spaces such as memory space 8 and memory space 9. The above memory space may be a DIMM or a DRAM.
[0071] The management unit in the embodiment of the present application may be deployed in the CXL switch in the form of firmware or process, for example Figure 4 The management unit 4010 is deployed in the CXL switch 4000 .
[0072] In some possible embodiments, the above Figure 3 and Figure 4 The management unit in the embodiment can also be deployed in the form of software on a computing device that can communicate with the first process and the second process. For example, the management unit can be deployed on a computing device that runs the first process and can communicate with the second process, and run in the form of a management process. For another example, the management unit can be deployed on a third computing device that can communicate with the first computing device that runs the first process and the second computing device that runs the second process. Alternatively, the management unit can also be an independent management device that can communicate with the first computing device that runs the first process and the second computing device that runs the second process.
[0073] It should be noted that the system architecture and application scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Ordinary technicians in this field can know that with the evolution of the system architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0074] For ease of understanding, the following is an exemplary introduction to the memory allocation method provided in the embodiment of the present application in conjunction with the accompanying drawings. The memory allocation method is applicable to Figure 3 or Figure 4 A multi-port CXL storage device is shown.
[0075] Figure 5 A flowchart of a memory allocation method provided by an embodiment of the present application is shown. The memory allocation method can be applied to a management unit, which is used to manage CXL memory space, and includes the following steps:
[0076] S101: A management unit receives a first memory allocation request sent by a first computing device.
[0077] Among them, the first memory allocation request is a memory allocation request sent by the first process of the first computing device, and the first memory allocation request is used to request the management unit to allocate a target memory space. The target memory space is the CXL memory space shared by the first computing device and the second computing device. Specifically, the target memory space is the CXL memory space shared by the first process of the first computing device and the second process of the second computing device.
[0078] For example, the first computing device and the second computing device may be Figure 3 The management unit may be a first computing device 3100 and a second computing device 3200. Figure 3 Alternatively, the first computing device and the second computing device may be respectively Figure 4 The first computing device 4100 and the second computing device 4200 in the embodiment of the present invention are shown in FIG. Figure 4 The firmware or management process of CXL switch 4000. Further, the first memory allocation request may include capacity information of the target memory space, a device identifier of the first computing device, and a device identifier of the second computing device.
[0079] For example, Figure 3As shown, the management unit can be deployed in the form of firmware on the controller 3010, and receive a first memory allocation request sent by the first computing device 3100, which includes the capacity information of the target memory space 100 megabytes, the device identifier "host1" of the first computing device, and the device identifier "host2" of the second computing device.
[0080] The management unit receives the first memory allocation request sent by the first process, and can provide a corresponding reference basis for determining the address information of the target memory space in the following step S102.
[0081] S102: The management unit determines address information of a target memory space according to a first memory allocation request.
[0082] The address information is used to indicate the location of the target memory space in the CXL memory space. The address information includes a physical address and a virtual address corresponding to the physical address, and the virtual address is generated by the management unit based on the physical address.
[0083] In a possible implementation, the management unit may determine the target memory space from the unallocated CXL memory space according to the capacity information in the first memory allocation request, and then obtain the physical address of the target memory space, and generate a virtual address corresponding to the target memory space based on the physical address of the target memory space.
[0084] For example, Figure 3 As shown, the management unit 3030 receives the capacity information of 100 megabytes in the first memory allocation request from the first computing device 3100, then the management unit 3030 will determine a target memory space with a capacity of 100 megabytes from multiple unallocated memory spaces in the memory 3020, and obtain the physical address of the target memory space as 0x90000000. Based on this physical address, the management unit 3030 can generate a virtual address of 0x99990000.
[0085] Furthermore, when the management unit generates a virtual address corresponding to the target memory space based on the physical address of the target memory space, it can use a random generation method to generate a virtual address within a preset address range. For example, if the preset address range is 0x90000000-0x95000000, the virtual address generated by the computing device can be 0x90090000.
[0086] In this way, the management unit determines the target memory space according to the capacity information in the memory allocation request, which can improve the accuracy of allocating the CXL memory space and improve the effective utilization of the CXL memory space.
[0087] In a possible implementation, the address information of the target memory space may include the capacity of the target memory space, the physical address of the target memory space, and the virtual address of the target memory space.
[0088] For example, the address information of the target memory space A may be: the capacity is 100 megabytes, the physical address is 0x90000000, and the virtual address is 0x99990000.
[0089] The management unit can improve the accuracy of managing the target memory space by determining address information including the capacity of the target memory space, the physical address of the target memory space, and the virtual address. For example, the management unit can further determine the address range included in the target memory space based on the physical address and capacity of the target memory space, thereby more accurately distinguishing different target memory spaces.
[0090] S103: The management unit sends address information to the first computing device.
[0091] Specifically, the management unit may be a first process that sends the physical address, virtual address, and capacity information of the target memory space to the first computing device, so that the first process can perform read and write operations on data in the target memory space based on the information.
[0092] In one possible implementation, when executing step S103, the management unit may also save the device identification of the first computing device, the device identification of the second computing device, and the corresponding address information of the two into a preset shared memory virtual address to physical address (SMV2P) mapping table.
[0093] In this way, the management unit can improve the accuracy of managing multiple target memory spaces by maintaining the SMV2P mapping table.
[0094] S104: The management unit sends address information to the second computing device.
[0095] In this step, after executing step S103, the management unit can immediately send the same address information to the second computing device. This method does not need to wait for the second computing device to send the second memory allocation request described below, thereby improving the efficiency of allocating the target memory space. However, since this method is actively sent by the management unit, it cannot guarantee that the second computing device is in a state where it can receive the address information. It is understandable that if the management unit sends the address information after receiving the second memory allocation request sent by the second computing device, the probability of the address information being successfully received by the second computing device can be increased.
[0096] Therefore, an embodiment of the present application provides a possible implementation method, where the management unit receives a second memory allocation request sent by the second computing device, where the second memory allocation request is used to request the management unit to allocate target memory space to the first computing device and the second computing device, and then the management unit sends address information to the second computing device based on the second memory allocation request.
[0097] Specifically, the second memory allocation request is a memory allocation request sent by the second process of the second computing device, requesting the management unit to allocate the target memory space to the first process of the first computing device and the second process of the second computing device. The second memory allocation request may include the device identification of the first computing device and the second computing device or the virtual address of the target memory space.
[0098] In a possible implementation, the SMV2P mapping table maintained by the management unit records the correspondence between the device identification of the first computing device, the device identification of the second computing device, and the address information of the target memory space.
[0099] If the second memory allocation request includes the device identification of the first computing device and the device identification of the second computing device, the management unit obtains the target memory space corresponding to the aforementioned device identification by querying the SMV2P mapping table, and the management unit sends the address information of the target memory space to the second process of the second computing device.
[0100] Alternatively, if the second memory allocation request includes the virtual address of the target memory space, the management unit queries the SMV2P mapping table to obtain the target memory space whose virtual address is consistent with the virtual address in the aforementioned memory allocation request, and then sends the physical address and capacity information of the target memory space to the second process of the second computing device.
[0101] Furthermore, when querying the SMV2P mapping table, the management unit can match the device identifier or virtual address included in the second memory allocation request sent by the second computing device with the record in the SMV2P mapping table by traversal matching, and send the address information of the successfully matched target memory space to the second process of the second computing device.
[0102] Exemplarily, the management unit saves the device identifier "host1" of the first computing device, the device identifier "host2" of the second computing device, and the address information corresponding to the two into the SMV2P mapping table, wherein the address information includes the physical address of the target memory space: 0x90000000, the virtual address: 0x80200000 and the capacity: 100 megabytes. Then, when receiving the second memory allocation request sent by the second computing device, if the device identifiers included in the aforementioned second memory allocation request are "host1" and "host2", the management unit will match the device identifiers corresponding to the address information of each target memory space recorded in the SMV2P mapping table. When the device identifiers corresponding to the target memory space are matched to "host1" and "host2", the matching result is successful, and the management unit sends the physical address of the target memory space: 0x90000000, the virtual address: 0x80200000 and the capacity: 100 megabytes to the second computing device.
[0103] In this way, the management unit sends the address information of the target memory space matching the second memory allocation request to the second computing device, thereby enabling processes on different computing devices to access the same target memory space using the same virtual address, simplifying the access process and thereby improving the collaboration efficiency between processes on different computing devices.
[0104] In a possible implementation, the SMV2P mapping table includes status information for indicating whether the first computing device and the second computing device are currently performing read and write operations on the data in the target memory space. After the management unit sends the address information to the second computing device, the status information can also be modified from a state indicating that the second computing device has not performed read and write operations on the data in the target memory space to a state that the second computing device has performed read and write operations on the data in the target memory space. Specifically, the aforementioned status information indicates whether the first process of the first computing device and the second process of the second computing device are currently performing read and write operations on the data in the target memory space.
[0105] Exemplarily, the SMV2P mapping table includes (virtual address, physical address, capacity, host1_on, host2_off), wherein "host1_on" and "host2_off" not only record the device identifications of the two computing devices that can share the target memory space, but also record the status information of whether the first process and the second process are currently performing read and write operations on the data in the target memory space through the keywords "on" and "off". "Host1_on" represents that the first process is currently performing read and write operations on the data in the target memory space. After the management unit sends the address information to the second process, it can modify "host2_off" to "host2_on".
[0106] In this way, the management unit can update the status information in the corresponding relationship recorded in the SMV2P mapping table, thereby improving the accuracy of the corresponding relationship.
[0107] In a possible implementation, the management unit may determine the usage status of the target memory space according to the status information; if the target memory space is in an unused state, the management unit deletes the address information and device identification of the target memory space in the SMV2P mapping table.
[0108] In this way, after the management unit deletes the address information and device identification of the target memory space in the SMV2P mapping table, when it receives a new memory allocation request, since the information of the aforementioned target memory space cannot be queried in the SMV2P mapping table, it can allocate it to the computing device indicated by the new memory allocation request, thereby improving the effective utilization of the CXL memory space.
[0109] In a possible implementation, after the management unit determines that the target memory space is in an unused state, the data in the target memory space can be cleared, or the data in the target memory space can be marked as overwriteable. In this way, the management unit can increase the proportion of available space of the multi-port CXL storage device, which helps to improve the effective utilization of the CXL memory space. Based on the above steps S101-S104, the management unit can determine the address information of the target memory space according to the memory allocation request sent by the first computing device, and implement the allocation of the same virtual address to different processes corresponding to the same target memory space, so that the computing device receiving the address information can access the target data in the target memory space without calculation, which simplifies the access process of the target memory space, improves the convenience of accessing the target data in the shared memory, and thus improves the efficiency of collaboration between processes.
[0110] The following describes the memory allocation method provided in the embodiment of the present application from the perspective of the computing device that issues the memory allocation request. The memory allocation method is also applicable to Figure 6 The computing device shown.
[0111] Figure 6 The schematic diagram of the structure of the computing device provided in the embodiment of the present application is shown. Figure 6As shown, in terms of hardware, the computing device 100 may include a processor 101, a memory 102, etc., wherein the processor 101 may include a central processing unit (CPU). In terms of software, the computing device 100 may have functions such as sending a first memory allocation request and receiving address information, that is, the computing device 100 may send a first memory allocation request to a management unit, wherein the management unit is used to manage the computing fast link CXL memory space, and the memory allocation request is used to request the management unit to allocate a target memory space to a corresponding process, and the target memory space is a CXL memory space shared by the first computing device and the second computing device; the computing device 100 receives the address information, and the aforementioned address information is determined by the management unit according to the memory allocation request, and is used to indicate the location of the target memory space in the CXL memory space; the computing device 100 performs data read and write operations on the target data in the target memory space according to the address information, and the aforementioned target data is data for collaborative operation between the first computing device and the second computing device.
[0112] The embodiment of the present application provides a memory allocation method applied to a first computing device, on which a first process is run. The first computing device can be the above-mentioned Figure 6 The computing device 100 in Figure 7 As shown, Figure 7 A flowchart of another memory allocation method provided in an embodiment of the present application is shown, comprising the following steps:
[0113] S201: A first computing device sends a first memory allocation request to a management unit.
[0114] Among them, the first memory allocation request is a request sent by the first process of the first computing device, the management unit is used to manage the computing quick link CXL memory space, the first memory allocation request is used to request the management unit to allocate a target memory space, and the target memory space is the CXL memory space shared by the first computing device and the second computing device. Specifically, the target memory space is the CXL memory space shared by the first process of the first computing device and the second process of the second computing device.
[0115] When the first computing device needs to read and write target data in collaboration with the second computing device, the first computing device can send a first memory allocation request to the management unit, wherein the first memory allocation request may include: the capacity of the target memory space, the device identification of the first computing device, and the device identification of the second computing device.
[0116] Exemplarily, the first memory allocation request sent by the first computing device to the management unit includes the capacity of the target memory space as 100 megabytes, the device identifier "host1" of the first computing device, and the device identifier "host2" of the second computing device.
[0117] The first computing device sends a first memory allocation request, so that the management unit can determine the target memory space according to its needs, so as to enable processes on different computing devices to read and write data in the same target memory space.
[0118] S202: The first computing device receives address information.
[0119] The address information is determined by the management unit according to the first memory allocation request, and the aforementioned address information includes a physical address and a virtual address corresponding to the physical address, and the virtual address is generated by the management unit based on the physical address.
[0120] The address information received by the first computing device may include a physical address, a virtual address, and capacity information of the target memory space.
[0121] Exemplarily, the address information received by the first computing device is (0x90000000, 0x60100000, 100), which indicates that the physical address of the target memory space is 0x90000000, the virtual address is 0x60100000, and the capacity is 100 megabytes.
[0122] In a possible implementation, the physical address may include a device name of a device to which the target memory space belongs and a physical offset based on a physical start address of the memory space in the device.
[0123] Exemplarily, the physical address of the target memory space is (1000, DAX1), which indicates that the target memory space is located in a multi-port CXL storage device with a device name of "DAX1", and the offset between the starting address of its physical address and the starting address of the aforementioned multi-port CXL storage device memory physical address is 0x1000.
[0124] By receiving address information indicating the location of the target memory space in the CXL memory space, the first computing device can access the data in the target memory space according to the address, thereby completing collaborative operations on the data in the target memory space with processes of other computing devices.
[0125] S203: The first computing device performs data read and write operations on the target data in the target memory space according to the address information.
[0126] The target data is the data for the first process of the first computing device to cooperate with the second process of the second computing device. After receiving the address information of the target memory space, the first process of the first computing device can map the physical address and virtual address therein to the page table of the first process, and then the first process can determine the target data that needs to be cooperated with the second process of the second computing device according to actual needs, and determine the virtual address of the target data according to the virtual address of the target memory space, and then the first process can implement data read and write operations on the target data in the target memory space according to the virtual address of the target data. It can be understood that the virtual address of the target data can be at least part of the virtual address of the target memory space.
[0127] Based on the above steps S201-S203, the first computing device can implement the first computing device, specifically the first process of the first computing device, to perform data read and write operations on the target data in the target memory space according to the received address information.
[0128] Based on this, in order to enable processes on different computing devices to read and write target data in the same target memory space, an embodiment of the present application provides a possible implementation method, in which the first computing device determines the virtual address of the target data based on the virtual address of the target memory space; sends the virtual address of the target data to the second computing device, specifically the second process of the second computing device, and then the second process can perform data read and write operations on the target data based on the received virtual address.
[0129] For example, the virtual address of the target memory space is 0x90000000, and the first computing device determines that the virtual address of the target data is 0x90001000 according to actual needs, and then the first computing device can send the virtual address 0x90001000 to the second computing device, so that the second process of the second computing device can read and write the target data with the virtual address 0x90001000.
[0130] Since the virtual addresses received by processes in different computing devices are the same, in other words, the virtual addresses of the same target memory space are unified, so that the virtual addresses of target data can be directly transmitted between different computing devices without transmitting the virtual address offset. The process that receives the virtual address does not need to calculate the virtual address of the target data based on the offset, but can directly use the received virtual address to read or write the target data, which simplifies the access process to the target memory space and improves collaboration efficiency.
[0131] In one possible implementation, the target data includes a pointer type variable; the pointer type variable is used to instruct the first computing device or the second computing device to access the data pointed to by the variable. Specifically, the pointer type variable is used to instruct the first process of the first computing device or the second process of the second computing device to access the data pointed to by the variable.
[0132] Among them, a pointer type variable usually stores the virtual address of another data in the target memory space. That is to say, when the first process or the second process accesses the pointer type variable, it can obtain another virtual address. Since the virtual address of the target memory space is unified, the first process or the second process can access the data pointed to by the variable according to the virtual address stored in the aforementioned pointer type variable, thereby improving the collaboration efficiency between processes of different computing devices.
[0133] The above steps S101-S104 and steps S201-S203 respectively introduce the memory allocation method provided by the embodiment of the present application from the perspective of a management unit for managing the computing fast link CXL memory space and a first computing device that sends a first memory allocation request, which can enable processes on different computing devices to access the same target memory space based on the same virtual address for collaboration, thereby improving the collaboration efficiency between processes. For specific effects, see Figure 8 , Figure 8 This is a schematic diagram of a shared memory access process in CXL involved in an embodiment of the present application, wherein process A running on a first computing device 10 and process M running on a second computing device 20 respectively access the same target memory space in the CXL memory pool through their respective page tables. From the page table positions pointed to by the arrows, it can be known that process A and process M use the same virtual address when accessing the target shared memory.
[0134] The following is an exemplary description of the complete interactive process of the memory allocation method provided in the embodiment of the present application, wherein the aforementioned memory allocation method can at least be implemented in the aforementioned Figure 3 and Figure 4 In both architectures, the specific process is as follows Fig. 9 As shown, Fig. 9 Another memory allocation specific implementation flowchart provided in an embodiment of the present application includes the following steps:
[0135] S301: A first computing device sends a first memory allocation request to a management unit.
[0136] The first memory allocation request is sent by a first process in a first computing device.
[0137] For example, Figure 4As shown, the first computing device may be the first computing device 4100 , and process A on the first computing device 4100 sends a first memory allocation request to the management unit 4010 , requesting to share a target memory space with a capacity of 100 megabytes with process M in the second computing device 4200 .
[0138] S302: The management unit queries the SMV2P mapping table to see whether the target memory space exists.
[0139] In this step, the management unit may match the device identifier included in the first memory allocation request sent by the first computing device with the device identifier corresponding to the address information of each target memory space in the SMV2P mapping table by traversal matching.
[0140] If it already exists, the management unit executes step S303.
[0141] For example, Figure 4 As shown, the management unit matches the device identifier "host1" of the first computing device 4100 and the device identifier "host2" of the second computing device 4200 with the device identifiers corresponding to the address information of each target memory space recorded in the SMV2P mapping table. When the device identifiers "host1" and "host2" corresponding to the target memory space are matched, it is determined that the target memory space already exists, and step S303 is executed.
[0142] If not, the management unit executes step S304.
[0143] For example, Figure 4 As shown, the management unit matches the device identifier "host1" on the first computing device 4100 and the device identifier "host2" on the second computing device 4200 with the device identifiers corresponding to the address information of each target memory space recorded in the SMV2P mapping table. When there is no match to the device identifiers "host1" and "host2" corresponding to the target memory space, the management unit determines that the target memory space does not exist, and executes step S304.
[0144] S303: The management unit sends address information of the target memory space to the first computing device, and modifies information in the SMV2P mapping table.
[0145] In this step, the management unit specifically sends the address information of the target memory space to the first process running the first computing device. The management unit determines that the target memory space already exists according to the SMV2P mapping table and does not need to be reallocated, and sends the address information of the target memory space to the first process.
[0146] S304: The management unit determines a target memory space in the unallocated CXL memory space, obtains a physical address of the target memory space, and allocates a virtual address to the target memory space.
[0147] In this step, the management unit may determine a target memory space from a plurality of multi-port CXL storage devices.
[0148] In a possible implementation, the physical address of the target memory space includes a physical offset and a device name corresponding to the target memory space.
[0149] The device name may refer to the identifier of the multi-port CXL storage device in the management unit, for example Figure 3 The identifier of the multi-port CXL storage device 3000 in the management unit 3030 may be “DAX01”.
[0150] For example, Figure 4 As shown, the management unit 4010 determines a target memory space with a capacity of 100 megabytes from the unallocated memory space 1 in the memory 4320 of the multi-port CXL storage device 4300, and obtains that the physical offset of the target memory space is 0x1000, and the device name of the multi-port CXL storage device 4300 is "DAX01", and then the virtual address allocated by the management unit 4010 to the target memory space is 0x60000000.
[0151] Through steps S302-S304, the management unit can avoid repeatedly allocating target memory space to processes by querying the SMV2P mapping table, and ensure that processes sharing the same target memory space can use the same virtual address, thereby improving collaboration efficiency.
[0152] S305: The management unit saves the relevant information to the SMV2P mapping table.
[0153] In this step, the management unit may save the device identifications of the first computing device and the second computing device and address information of the target memory spaces corresponding to the two devices to the SMV2P mapping table.
[0154] For example, Figure 4As shown, the management unit 4010 saves the following information to the SMV2P mapping table, including: (0x60000000, 0x20001000, 100, Host1_on, Host2_off), wherein 0x60000000 represents the virtual address of the target memory space, 0x20001000 represents the physical address of the target memory space, 100 represents that the capacity of the target memory space is 100 megabytes, Host1_on represents the first computing device 4100 running the first process; Host2_off represents the second computing device 4200 running the second process.
[0155] Furthermore, Host1_on may also be used to indicate that the first computing device has currently performed read and write operations on the data in the target memory space, and Host2_off may also be used to indicate that the second computing device has currently not performed read and write operations on the data in the target memory space.
[0156] By maintaining the SMV2P mapping table and recording the device identifications of multiple computing devices and the address information of the target memory space, the management unit can constrain and manage the virtual addresses generated when allocating CXL memory space, ensuring that the virtual addresses used by processes on different computing devices to access the same target memory space are the same, thereby improving the collaboration efficiency between processes.
[0157] In a possible implementation, when the management unit determines according to the SMV2P mapping table that no process performs a read or write operation on data in the target memory space, the target memory space is released or allocated to other processes that need the memory space.
[0158] Specifically, when the process no longer needs to use the target memory space, it can send a release instruction of the target memory space to the management unit via the computing device where it is located. After receiving the release instruction, the management unit modifies the SMV2P mapping table accordingly, for example, changing Host1_on to Host1_off. In this way, the management unit can determine the usage of each target memory space based on the SMV2P mapping table.
[0159] Exemplarily, when the status information corresponding to the target memory space 1 in the SMV2P mapping table is Host1_off and Host2_off, the management unit determines that the target memory space 1 is no longer in use and can be released or reallocated. Afterwards, when the management unit receives a memory allocation request and determines that the memory allocation request matches the aforementioned target memory space 1, the aforementioned target memory space 1 can be reallocated to improve the memory utilization rate in the CXL storage device.
[0160] S306: The management unit sends the address information to the first computing device.
[0161] In this step, the management unit may send the virtual address, physical address, and capacity information of the target memory space to the first computing device.
[0162] For example, Figure 4 As shown, the management unit 4010 sends (0x60000000, 0x1000, CXL01, 100) to the process A in the first computing device 4100, wherein 0x60000000 represents the virtual address of the target memory space, 0x1000 represents that the offset between the starting address of the physical address of the target memory space and the starting address of the corresponding physical address of the target memory space is 0x1000, CXL01 represents the device name of the multi-port CXL storage device 4300, and 100 represents that the capacity of the target memory space is 100 megabytes.
[0163] S307: The first computing device sends the virtual address of the target memory space to the second computing device.
[0164] In this step, when the first computing device sends the virtual address of the target memory space, it can send the virtual address of the target memory space to the computing device sharing the target memory space via a network or other means. In this way, on the one hand, the second computing device can send a memory allocation request to the management unit in a timely manner to improve the collaboration efficiency. On the other hand, in the subsequent memory allocation process, the second computing device can ensure that the virtual address is allocated correctly based on the received virtual address, thereby further improving the accuracy of allocating the target memory space.
[0165] When the first computing device sends the virtual address of the target memory space to the second computing device, specifically, the first process of the first computing device sends the virtual address of the target memory space to the second process of the second computing device. The processes between different computing devices can communicate in a variety of ways. For example, the first process can send a process identifier to ensure that the virtual address is sent to the second process, or the first process can send the virtual address to the port number corresponding to the second process. The embodiments of the present application are not limited to this.
[0166] Exemplarily, the first process sends the received target memory space virtual address: 0x60000000 through the first computing device where the first process is located, to the port number 5244 corresponding to the second process on the second computing device through the network.
[0167] S308: The first computing device maps the target memory space to the virtual address space of the process according to the address information.
[0168] In this step, specifically, the first process in the first computing device receives the address information, and then the first process can map the physical address and virtual address in the address information into its page table, thereby mapping the target memory space to the virtual address space of the process.
[0169] In a possible implementation, after the first computing device sends the received virtual address to the second computing device, it sends the virtual address of the target data to the second computing device.
[0170] The target data is the data that the first process needs to cooperate with the second process, for example, the first process writes the target data and the second process reads the target data. The first process can determine the target data in the target memory space according to the actual needs during the operation, and determine the virtual address of the target data and send it to the second computing device.
[0171] For example, Figure 4 As shown, the first computing device 4100 sends the determined address information of the target data in the target memory space: 0x60005000, to the second computing device 4200 running the process M through the network.
[0172] Based on the above steps S301-S308, the management unit records the relevant information of the target memory space allocated to the first process and the second process, and saves it to the SMV2P mapping table. Correspondingly, the first process receives the address information of the target memory space and can perform data read and write operations on the target memory space.
[0173] S309: The second computing device sends a second memory allocation request to the management unit.
[0174] In this step, the second memory allocation request sent by the second computing device may include the virtual address received in the above step S307.
[0175] For example, Figure 4 As shown, the process M on the second computing device 4200 sends a memory allocation request to the management unit 4010 on the CXL switch 4000 to apply for a target memory space with a virtual address of 0x60000000.
[0176] Alternatively, the second memory allocation request sent by the second computing device may include a device identification of the first computing device and a device identification of the second computing device.
[0177] S310, the management unit queries the SMV2P mapping table to see whether the target memory space exists.
[0178] If it does not exist, the management unit executes step S311; if it already exists, the management unit executes step S312.
[0179] In this step, the management unit queries the virtual address of each recorded target memory space in the SMV2P mapping table according to the virtual address in the second memory allocation request received in step S309. If there is a target memory space with a consistent virtual address, the management unit executes step S311; otherwise, the management unit executes step S312.
[0180] S311, the management unit sends address information of the target memory space to the second computing device, and modifies the information in the SMV2P mapping table.
[0181] In this step, the management unit specifically sends the address information of the target memory space to the second process running the second computing device. The management unit determines that the target memory space already exists according to the SMV2P mapping table and does not need to be reallocated, and sends the address information of the target memory space to the aforementioned second process.
[0182] S312: The management unit determines a target memory space in the unallocated CXL memory space, obtains a physical address of the target memory space, and allocates a virtual address to the target memory space.
[0183] S313, the management unit saves the relevant information to the SMV2P mapping table.
[0184] Steps S312-S313 are similar to the above steps S304-S305 and will not be repeated here.
[0185] S314, the second computing device checks the virtual address and maps the target memory space to the virtual address space of the process.
[0186] In this step, specifically, the second process in the second computing device receives the address information. After receiving the address information, the second computing device can check the virtual address in the following manner, including: the second process matches the virtual address in the address information received in step S314 with the virtual address sent by the first computing device in the aforementioned step S307. When it is determined that the aforementioned two virtual addresses are consistent, or when the virtual address check is correct, the address information is registered in its page table to achieve mapping of the target memory space and improve the accuracy of unified addressing of the target memory space.
[0187] After completing steps S301-S314, the first process of the first computing device and the second process of the second computing device can collaborate on the target data in the target memory space according to actual needs. For example, the first process modifies the target data in the target memory space, and then transmits the virtual address of the target data to the second computing device. After receiving the virtual address of the aforementioned target data, the second computing device reads the modified target data in the aforementioned target memory space, thereby enabling processes on different computing devices to perform collaborative data operations based on the unified virtual address of the target memory space, thereby improving collaboration efficiency.
[0188] The above mainly introduces the scheme of the embodiment of the present application from the perspective of the method. It is understandable that in order to realize the above functions, the software upgrade device includes at least one of the hardware structure and software modules corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the embodiments of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of the present application.
[0189] The embodiment of the present application can divide the memory allocation device into functional units according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0190] For example, Fig.10 The schematic diagram of the structure of a memory allocation device 1200 provided by an exemplary embodiment of the present application is shown. The memory allocation device 1200 is applied to a computing device or a management unit, or the memory allocation device 1200 can be a computing device. The memory allocation device 1200 includes:
[0191] The receiving module 1210 is used to receive a first memory allocation request sent by the first computing device, wherein the first memory allocation request is used to request the management unit to allocate a target memory space to the corresponding process, and the target memory space is the CXL memory space shared by the first computing device and the second computing device.
[0192] The determination module 1220 is used to determine the address information of the target memory space according to the first memory allocation request, and the address information is used to indicate the position of the target memory space in the CXL memory space, wherein the address information includes a physical address and a virtual address corresponding to the physical address, and the virtual address is generated by the management unit based on the physical address.
[0193] The first sending module 1230 is configured to send the address information to the first computing device.
[0194] The second sending module 1240 is configured to send the address information to the second computing device.
[0195] For example, combined with Figure 5 , the receiving module 1210 can be used to perform the following steps: Figure 5 As shown in S101, the determination module 1220 can be used to perform the following steps: Figure 5 As shown in S102, the first sending module 1230 can be used to perform the following Figure 5 As shown in S103, the second sending module 1240 can be used as follows Figure 5 S104 shown.
[0196] In one possible implementation, the second sending module 1240 is further used to receive a second memory allocation request sent by the second computing device, where the second memory allocation request is used to request the management unit to allocate target memory space to the first computing device and the second computing device; and send the address information to the second computing device according to the second memory allocation request.
[0197] In a possible implementation, the determination module 1220 is further used to determine the target memory space from the unallocated CXL memory space according to the capacity information in the first memory allocation request; obtain the physical address of the target memory space; and generate a virtual address corresponding to the target memory space based on the physical address of the target memory space.
[0198] In a possible implementation, it also includes a saving module, which is used to save the device identification of the first computing device, the device identification of the second computing device and the address information of the target memory space into a preset shared memory virtual address to physical address SMV2P mapping table; then the second sending module 1240 is also used to: if the second memory allocation request sent by the second computing device is received, according to the device identification or virtual address in the second memory allocation request, query the SMV2P mapping table to obtain the address information of the target memory space corresponding to the device identification or the virtual address, and send the address information to the second computing device.
[0199] In one possible implementation, the SMV2P mapping table includes status information of whether the first computing device and the second computing device are currently performing read and write operations on the data in the target memory space, and further includes a modification module, wherein the modification module is used to modify the status information from a status indicating that the second computing device has not performed read and write operations on the data in the target memory space to a status in which the second computing device has performed read and write operations on the data in the target memory space after the second sending module 1240 sends the address information to the second computing device.
[0200] In a possible implementation, it also includes a deletion module, which is used to determine the usage status of the target memory space based on the status information; if the target memory space is in an unused state, delete the address information and device identification of the target memory space in the SMV2P mapping table.
[0201] For example, Fig.11 A schematic diagram of the structure of a memory allocation device 1300 provided by another exemplary embodiment of the present application is shown. The memory allocation device 1300 is applied to a first computing device. The memory allocation device 1300 includes:
[0202] The sending module 1310 is used to send a first memory allocation request to a management unit, where the management unit is used to manage a computing quick link CXL memory space. The first memory allocation request is used to request the management unit to allocate a target memory space, where the target memory space is the CXL memory space shared by the first computing device and the second computing device.
[0203] The receiving module 1320 is used to receive address information; the address information is determined by the management unit according to the first memory allocation request, the address information includes a physical address and a virtual address corresponding to the physical address, and the virtual address is generated by the management unit based on the physical address.
[0204] The read / write module 1330 is used to perform data read / write operations on the target data in the target memory space according to the address information; the target data is data for collaborative operations between the first computing device and the second computing device.
[0205] In a possible implementation, the address information includes a virtual address of the target memory space, and the read / write module 1330 is used to determine the virtual address of the target data according to the virtual address of the target memory space; and perform data read / write operations on the target data according to the virtual address of the target data.
[0206] In a possible implementation, the target data includes a pointer-type variable; the pointer-type variable is used to instruct the first computing device or the second computing device to access the data pointed to by the variable.
[0207] In an exemplary embodiment, a computer-readable storage medium is also provided, which is used to store at least one instruction, at least one program, code set or instruction set, and the at least one instruction, the at least one program, the code set or instruction set is loaded and executed by a processor to implement all or part of the steps in the above-mentioned memory fault prediction method. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0208] In an exemplary embodiment, a computer program product or a computer program is also provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computing device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computing device performs the above Figure 5 All or part of the steps of the method shown in any embodiment.
[0209] In some embodiments, the method shown in the embodiments of the present application can be implemented as computer program instructions encoded in a machine-readable format on a computer-readable storage medium or encoded on other non-transitory media or products.
[0210] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0211] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0212] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0213] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0214] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the relevant technology or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0215] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A memory allocation method, characterized in that: Applied to a management unit, the management unit is used to manage the computing fast link CXL memory space, the method includes: receiving a first memory allocation request sent by a first computing device, wherein the first memory allocation request is used to request the management unit to allocate a target memory space, wherein the target memory space is the CXL memory space shared by the first computing device and the second computing device; Determine, according to the first memory allocation request, address information of the target memory space, the address information being used to indicate a location of the target memory space in the CXL memory space, wherein the address information includes a physical address and a virtual address corresponding to the physical address, the virtual address being generated by the management unit based on the physical address; sending the address information to the first computing device; The address information is sent to the second computing device.
2. The method according to claim 1, characterized in that The sending the address information to the second computing device includes: receiving a second memory allocation request sent by the second computing device, where the second memory allocation request is used to request the management unit to allocate a target memory space to the first computing device and the second computing device; According to the second memory allocation request, the address information is sent to the second computing device.
3. The method according to claim 1 or 2, characterized in that: The determining, according to the first memory allocation request, address information of the target memory space includes: determining the target memory space from the unallocated CXL memory space according to the capacity information in the first memory allocation request; Obtaining the physical address of the target memory space; Based on the physical address of the target memory space, a virtual address corresponding to the target memory space is generated.
4. The method according to any one of claims 1 to 3, characterized in that: After determining the address information of the target memory space according to the first memory allocation request, the method further includes: The device identification of the first computing device, the device identification of the second computing device and the address information of the target memory space are saved in a preset shared memory virtual address to physical address SMV2P mapping table; The sending the address information to the second computing device includes: If a second memory allocation request sent by the second computing device is received, query the SMV2P mapping table to obtain address information of the target memory space corresponding to the device identifier or the virtual address according to the device identifier or the virtual address in the second memory allocation request; The address information is sent to the second computing device.
5. The method according to claim 4, characterized in that The SMV2P mapping table includes status information indicating whether the first computing device and the second computing device are currently performing a read or write operation on the data in the target memory space. After sending the address information to the second computing device, the method further includes: The state information is modified from a state indicating that the second computing device has not performed a read or write operation on the data in the target memory space to a state in which the second computing device has performed a read or write operation on the data in the target memory space.
6. The method according to claim 5, characterized in that The method further comprises: Determining the usage status of the target memory space according to the status information; If the target memory space is in an unused state, the address information and the device identification of the target memory space in the SMV2P mapping table are deleted.
7. A memory allocation method, characterized in that: Applied to a first computing device, the method includes: Sending a first memory allocation request to a management unit, the management unit being used to manage a computing fast link CXL memory space, the first memory allocation request being used to request the management unit to allocate a target memory space, the target memory space being the CXL memory space shared by the first computing device and the second computing device; receiving address information; the address information is determined by the management unit according to the first memory allocation request, the address information includes a physical address and a virtual address corresponding to the physical address, and the virtual address is generated by the management unit based on the physical address; According to the address information, data reading and writing operations are performed on the target data in the target memory space; the target data is data for collaborative operations between the first computing device and the second computing device.
8. The method according to claim 7, characterized in that The performing a data reading and writing operation on the target data in the target memory space according to the address information includes: Determining a virtual address of the target data according to the virtual address of the target memory space; According to the virtual address of the target data, data reading and writing operations are performed on the target data.
9. The method according to claim 7 or 8, characterized in that: The target data includes a pointer type variable; the pointer type variable is used to instruct the first computing device or the second computing device to access the data pointed to by the variable.
10. A computing device, characterized in that The computing device includes a processor and a memory; the processor is coupled to the memory; the memory is used to store computer instructions, and the computer instructions are loaded and executed by the processor to enable the computing device to implement the memory allocation method as described in any one of claims 1 to 9.
Citation Information
Cited By
Data processing method and electronic equipment
CN119676140A
Data transmission method and device, server, medium and product
CN120743559A
Data transmission methods, devices, servers, media and products
CN120743559B
Memory access method of computing device and related device
CN122045080A
System and method for multi-link CXL switch for NUMA architecture
EP4749467A1
