Memory allocation method and electronic device
By carrying attribute indicators and demand information in memory requests, the CXL memory pool is managed in a refined manner, solving the problem of memory allocation mismatch and achieving more efficient and accurate memory allocation.
Patent Information
- Application Number
- CN202410362722.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-27
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2044-03-27
AI Technical Summary
In the prior art, memory allocation in the CXL memory pool only refers to the capacity requirements requested by the computing device, resulting in a mismatch between memory performance and actual usage requirements and low allocation accuracy.
The memory request carries allocation request information and memory demand information. Using attribute indicators such as latency or bandwidth, the target memory expansion device with matching category is determined from the CXL memory pool for refined management and allocation.
Improves the accuracy and efficiency of memory allocation to meet the needs of computing devices for memory with different attributes.
Smart Images

Figure CN118210629B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of memory management technology, and in particular to a memory allocation method and electronic device. Background Art
[0002] Compute Express Link (CXL) is a high-speed interconnect technology that allows multiple computing devices to share a remote pool of memory (such as the CXL memory pool). This reduces the memory gap between computing devices and central processing units (CPUs), and between computing devices, enabling high-speed data transmission and memory sharing.
[0003] Currently, when memory is allocated to the CXL memory pool, memory that satisfies the capacity requirement of the memory requested by the computing device is usually allocated to the computing device.
[0004] However, in the above technical solution, only the capacity requirement of the memory requested by the computing device is referred to, so that the allocated memory performance does not match the actual usage requirements, and the accuracy of memory allocation is low. Summary of the Invention
[0005] Embodiments of the present application provide a memory allocation method and an electronic device, which are used to provide a memory allocation solution for a CXL memory pool, so as to improve the accuracy of memory allocation in the CXL memory pool.
[0006] To achieve the above objectives, the present invention adopts the following technical solutions:
[0007] In one aspect, a memory allocation method is provided, which is applied to a CXL memory pool management device. The method includes:
[0008] Receive a memory request from a computing device; wherein the memory request includes allocation request information and memory requirement information, wherein the allocation request information is used to indicate an attribute indicator of a memory expansion device requested by the computing device, wherein the attribute indicator is a latency indicator or a bandwidth indicator; and the memory requirement information is used to indicate a memory indicator requested by the computing device, wherein the memory indicator includes a memory size and a memory type;
[0009] Determine the target memory expansion device whose category matches the attribute indicator from the calculation fast link CXL memory pool;
[0010] Memory that meets the memory requirement information is allocated to the computing device from the target memory expansion device.
[0011] In the above technical solution, by including allocation request information and memory requirement information in the computing device's memory request, the allocation request information can, on the one hand, indicate the attribute indicators of the memory expansion device requested by the computing device, such as latency or bandwidth indicators, and, on the other hand, the memory requirement information can indicate the memory indicators requested by the computing device, such as memory size and memory type. Furthermore, the management device can determine the target memory expansion device from the CXL memory pool whose category matches the attribute indicators, enabling more targeted memory allocation to meet the computing device's needs for memory with different attributes. Memory that meets the memory requirement information is then allocated to the computing device from the target memory expansion device, which not only improves the efficiency of memory allocation but also effectively improves the accuracy of memory allocation.
[0012] In some possible implementations, the method further includes:
[0013] In the CXL memory pool, the category of each memory expansion device is determined based on the memory bandwidth or the memory bandwidth and memory capacity of each memory expansion device; wherein the memory bandwidth is the smallest value between the memory channel bandwidth and the memory link bandwidth.
[0014] In this way, by determining the memory channel bandwidth and memory link bandwidth, the minimum bandwidth value is determined as the memory bandwidth of the memory expansion device. This not only considers the total bandwidth of the multiple memory channels in the memory expansion device, but also the link bandwidth between the memory expansion device and the CXL switches in the CXL memory pool. This increases the amount of information used in determining the memory bandwidth, allowing for a more accurate determination of the memory bandwidth.
[0015] In the above implementation, the memory expansion devices in the CXL memory pool are classified according to their memory capacity and memory bandwidth, which enables refined management of the CXL memory pool. When allocating memory, the target memory expansion device whose category matches the attribute indicator can be quickly and efficiently determined based on the category dimension of the memory expansion device.
[0016] In some possible implementations, the categories of the memory expansion device include bandwidth-type memory expansion devices and capacity-type memory expansion devices. The bandwidth-type memory expansion device refers to a memory expansion device whose memory bandwidth meets a first preset condition, and the capacity-type memory expansion device refers to a memory expansion device whose memory capacity meets a second preset condition.
[0017] Determine the target memory expansion device from the CXL memory pool whose category matches the attribute indicator, including:
[0018] In a case where the attribute indicator indicated by the allocation request information is a bandwidth indicator, determining the bandwidth-type memory expansion device as a target memory expansion device that matches the attribute indicator; or
[0019] In a case where the attribute indicator indicated by the allocation request information is a latency indicator, the capacity-type memory expansion device is determined as a target memory expansion device that matches the attribute indicator.
[0020] In this way, when the attribute indicator indicated by the allocation request information is the bandwidth indicator, a bandwidth-type memory expansion device is determined for the computing device, with the memory expansion device with a larger bandwidth being the preferred device, thereby satisfying the computing device's bandwidth requirements. When the attribute indicator indicated by the allocation request information is the latency indicator, a capacity-type memory expansion device is determined for the computing device, with the memory expansion device with a larger capacity being the preferred device, thereby satisfying the computing device's latency requirements. In this way, by determining a target memory expansion device that matches the attribute indicator, the computing device's requirements for memory with different attributes can be satisfied.
[0021] In some possible implementations, the bandwidth-type memory expansion device and the capacity-type memory expansion device both carry a latency level for memory latency. If the attribute indicator indicated by the allocation request information is a latency indicator, determining the capacity-type memory expansion device as a target memory expansion device that matches the attribute indicator includes:
[0022] In a case where the attribute indicator indicated by the allocation request information is a latency indicator, a capacity-type memory expansion device whose latency level of the memory latency meets a latency priority condition is determined as a target memory expansion device matching the attribute indicator.
[0023] In the above implementation, by setting the latency priority condition, when the attribute indicator indicated by the allocation request information is the latency indicator, the memory expansion device with the minimum latency can be determined for the computing device, which can further meet the latency requirements of the computing device.
[0024] In some possible implementations, the category of the memory expansion device also includes a balanced memory expansion device, which refers to a memory expansion device whose memory bandwidth and memory capacity meet a third preset condition. If the attribute indicator indicated by the allocation request information is a bandwidth indicator, the target memory expansion device that matches this attribute indicator also includes the balanced memory expansion device; or if the attribute indicator indicated by the allocation request information is a latency indicator, the target memory expansion device that matches this attribute indicator also includes the balanced memory expansion device.
[0025] In the above implementation, other types of memory expansion devices are added for reference during memory allocation, so that when the attribute indicator indicated by the allocation request information is a bandwidth indicator, or when the attribute indicator indicated by the allocation request information is a latency indicator, a balanced memory expansion device can be used as a candidate memory expansion device, thereby enriching the candidate options for memory expansion devices during memory allocation.
[0026] In some possible implementations, when the attribute indicator indicated by the allocation request information is a bandwidth indicator, the allocation priority of the bandwidth-type memory expansion device is higher than the allocation priority of the balanced-type memory expansion device, and the allocation priority of the balanced-type memory expansion device is higher than the allocation priority of the capacity-type memory expansion device.
[0027] That is, if the attribute indicator indicated by the allocation request information is bandwidth, the memory allocation process for the bandwidth-type memory expansion device is prioritized, followed by the memory allocation process for the balanced-type memory expansion device, and then the memory allocation process for the capacity-type memory expansion device. In this way, by setting the allocation priority, the bandwidth-type memory expansion device is prioritized, thereby meeting the bandwidth needs of the computing device.
[0028] In some possible implementations, when the attribute indicator indicated by the allocation request information is a latency indicator, the allocation priority of the capacity-type memory expansion device is higher than the allocation priority of the balanced-type memory expansion device, and the allocation priority of the balanced-type memory expansion device is higher than the allocation priority of the bandwidth-type memory expansion device.
[0029] In other words, if the attribute indicator indicated by the allocation request information is latency, the memory allocation process for the capacity-type memory expansion device is prioritized, followed by the memory allocation process for the balance-type memory expansion device, and then the memory allocation process for the bandwidth-type memory expansion device. In this way, by setting allocation priorities, the capacity-type memory expansion device is prioritized, which can meet the latency requirements of the computing device.
[0030] In some possible implementations, the memory requirement information indicates that the requested memory size is a target capacity and the memory type is a target type. Before determining a target memory expansion device whose type matches the attribute indicator from the CXL memory pool, the method further includes: determining that a remaining memory capacity of a memory expansion device in the CXL memory pool that has memory of the target type is greater than the target capacity.
[0031] In the above implementation, by determining that the remaining memory capacity of the memory expansion device with the target type of memory in the CXL memory pool is greater than the target capacity, the subsequent memory allocation process is executed under the premise that the remaining memory capacity of the memory expansion device with the target type of memory in the CXL memory pool is sufficient, thereby improving the reliability of memory allocation.
[0032] In some possible implementations, when the attribute indicator indicated by the allocation request information is a bandwidth indicator, determining a target memory expansion device whose category matches the attribute indicator from the CXL memory pool includes:
[0033] Obtaining an uplink bandwidth of the computing device, and determining a lower limit of bandwidth allocated to the computing device based on the uplink bandwidth, wherein the uplink bandwidth of the computing device is determined based on the number of links between the computing device and the CXL switch;
[0034] Based on the bandwidth lower limit and a first preset priority order, it is determined whether the target memory expansion device exists, wherein the first preset priority order is used to indicate the order of priority assigned to memory expansion devices of different categories from high to low when the attribute indicator is a bandwidth indicator.
[0035] In the above implementation, by maintaining the first preset priority order, when the attribute indicator requested by the computing device is the bandwidth indicator, memory allocation is performed according to the first preset priority order, and memory that matches the computing device's request can be allocated to the computing device first, thereby improving the accuracy of memory allocation.
[0036] In some possible implementations, the bandwidth-type memory expansion device, the capacity-type memory expansion device, and the balanced-type memory expansion device all carry latency levels for memory latency. These latency levels include primary and secondary latency, with the primary latency indicating a lower latency than the secondary latency. By providing each type of memory expansion device with a latency level, categorized management based on latency is possible, further enabling refined management of the CXL memory pool.
[0037] In some possible implementations, the first preset priority order is: bandwidth-type memory expansion device with first-level latency, balanced-type memory expansion device with first-level latency, bandwidth-type memory expansion device with second-level latency, balanced-type memory expansion device with second-level latency, capacity-type memory expansion device with first-level latency, and capacity-type memory expansion device with second-level latency.
[0038] That is, when the attribute indicator indicated by the allocation request information is the bandwidth indicator, the memory allocation process of the bandwidth-type memory expansion device with a first-level latency is preferentially executed, the memory allocation process of the balanced-type memory expansion device with a first-level latency is secondarily executed, the memory allocation process of the bandwidth-type memory expansion device with a second-level latency is thirdly executed, the memory allocation process of the balanced-type memory expansion device with a second-level latency is thirdly executed, the memory allocation process of the capacity-type memory expansion device with a first-level latency is thirdly executed, and the memory allocation process of the capacity-type memory expansion device with a second-level latency is thirdly executed. In this way, by setting the allocation priority, the bandwidth-type memory expansion device is prioritized, thereby meeting the bandwidth requirements of the computing device.
[0039] In some possible implementations, when the attribute indicator indicated by the allocation request information is a latency indicator, determining a target memory expansion device whose category matches the attribute indicator from the CXL memory pool includes:
[0040] Based on a second preset priority order, it is determined whether the target memory expansion device exists; wherein the second preset priority order is used to indicate the order of priority assigned to different categories of memory expansion devices from high to low when the attribute indicator is a latency indicator.
[0041] In the above implementation, by maintaining the second preset priority order, when the attribute indicator requested by the computing device is the latency indicator, memory allocation is performed according to the second preset priority order, and memory that matches the computing device's request can be allocated to the computing device first, thereby improving the accuracy of memory allocation.
[0042] In some possible implementations, the second preset priority order is: capacity-type memory expansion device with first-level latency, balanced-type memory expansion device with first-level latency, bandwidth-type memory expansion device with first-level latency, capacity-type memory expansion device with second-level latency, balanced-type memory expansion device with second-level latency, and bandwidth-type memory expansion device with second-level latency.
[0043] That is, when the attribute indicator indicated by the allocation request information is the bandwidth indicator, the memory allocation process of the capacity-type memory expansion device with a first-level latency is executed first, the memory allocation process of the balanced-type memory expansion device with a first-level latency is executed second, the memory allocation process of the bandwidth-type memory expansion device with a first-level latency is executed third, the memory allocation process of the capacity-type memory expansion device with a second-level latency is executed third, the memory allocation process of the balanced-type memory expansion device with a second-level latency is executed third, and the memory allocation process of the bandwidth-type memory expansion device with a second-level latency is executed third. In this way, by setting the allocation priority and taking the latency level as the priority, the latency requirements of the computing device can be met.
[0044] In some possible implementations, the memory bandwidth satisfies the first preset condition, including: the memory bandwidth is within a first bandwidth range; or, the first parameter value is within a first threshold range, the first parameter value is positively correlated with the memory capacity and negatively correlated with the memory bandwidth; or, the second parameter value is within a second threshold range, the second parameter value is negatively correlated with the memory capacity and positively correlated with the memory bandwidth.
[0045] In this implementation, three types of first preset conditions are provided for determining whether a memory expansion device is a bandwidth-type memory expansion device. Based on any of these three types of first preset conditions, whether a memory expansion device is a bandwidth-type memory expansion device can be determined. This enriches the types of first preset conditions.
[0046] In some possible implementations, the memory capacity satisfies the second preset condition, including: the memory capacity is within the first capacity range; or, the first parameter value is within the third threshold range, and the value within the first threshold range is smaller than the value within the third threshold range; the second parameter value is within the fourth threshold range, and the value within the second threshold range is larger than the value within the fourth threshold range.
[0047] This implementation provides three types of second preset conditions for determining whether a device is a capacity-type memory expansion device. Based on any of these three types of second preset conditions, whether a memory expansion device is a capacity-type memory expansion device can be determined. This enriches the types of second preset conditions.
[0048] In some possible implementations, the first parameter value is a ratio of the memory capacity to the memory bandwidth, or the first parameter value is a difference between the memory capacity and the memory bandwidth.
[0049] In this way, two types of first parameter values are provided, so that the management device can determine whether the category of the memory expansion device is a bandwidth-type memory expansion device based on the ratio of the memory capacity to the memory bandwidth, or the difference between the memory capacity and the memory bandwidth. This not only improves the efficiency of determining the bandwidth-type memory expansion device, but also improves the flexibility of determining the bandwidth-type memory expansion device.
[0050] In some possible implementations, the second parameter value is the ratio of the memory bandwidth to the memory capacity, or the second parameter value is the difference between the memory bandwidth and the memory capacity. Thus, providing two types of second parameter values allows the management device to determine whether the memory expansion device is a capacity-type memory expansion device based on the ratio of the memory bandwidth to the memory capacity or the difference between the memory bandwidth and the memory capacity. This not only improves the efficiency of determining capacity-type memory expansion devices, but also increases the flexibility of determining capacity-type memory expansion devices.
[0051] In some possible implementations, the memory bandwidth and the memory capacity satisfy the third preset condition, including: the memory bandwidth is within the second bandwidth range and the memory capacity is within the second capacity range; or, the first parameter value is within the fifth threshold range, and the fifth threshold range is between the first threshold range and the third threshold range; or, the second parameter value is within the sixth threshold range, and the sixth threshold range is between the second threshold range and the fourth threshold range.
[0052] This implementation provides three types of third preset conditions for determining whether a memory expansion device is a balanced memory expansion device. Based on any of these three types of third preset conditions, whether a memory expansion device is a balanced memory expansion device can be determined. This enriches the types of third preset conditions.
[0053] In some possible implementations, if the memory bandwidth of the memory expansion device meets the first preset condition, the memory expansion device is determined to be a bandwidth-type memory expansion device. If the memory capacity of the memory expansion device meets the second preset condition, the memory expansion device is determined to be a capacity-type memory expansion device. If the memory bandwidth and memory capacity of the memory expansion device meet the third preset condition, the memory expansion device is determined to be a balanced-type memory expansion device.
[0054] In this way, each memory expansion device in the CXL memory pool can be classified and managed according to its memory capacity and memory bandwidth. The CXL memory pool can be divided into three types of memory expansion devices: bandwidth-type memory expansion devices, capacity-type memory expansion devices, and balanced memory expansion devices, thus achieving refined management of the CXL memory pool.
[0055] In some possible implementations, if the memory bandwidth of the memory expansion device satisfies the first preset condition, determining that the memory expansion device is a bandwidth-type memory expansion device includes:
[0056] If the memory bandwidth of the memory expansion device is within a first bandwidth range, the category of the memory expansion device is determined to be a bandwidth-type memory expansion device; or, if the first parameter value is within a first threshold range, the category of the memory expansion device is determined to be a bandwidth-type memory expansion device; or, if the second parameter value is within a second threshold range, the category of the memory expansion device is determined to be a bandwidth-type memory expansion device.
[0057] This implementation provides three methods for determining whether a device is a bandwidth-type memory expansion device. Based on any of these three methods, you can determine whether a memory expansion device is a bandwidth-type memory expansion device. This enriches the methods for determining whether a device is a bandwidth-type memory expansion device.
[0058] In some possible implementations, if the memory capacity of the memory expansion device satisfies the second preset condition, determining that the memory expansion device is a capacity-type memory expansion device includes:
[0059] If the memory capacity of the memory expansion device is within the first capacity range, the category of the memory expansion device is determined to be a capacity-type memory expansion device; or, if the first parameter value is within the third threshold range, the category of the memory expansion device is determined to be a capacity-type memory expansion device; or, if the second parameter value is within the fourth threshold range, the category of the memory expansion device is determined to be a capacity-type memory expansion device.
[0060] This implementation provides three ways to determine whether a device is a capacity-type memory expansion device. Based on any of these three methods, you can determine whether the device is a capacity-type memory expansion device. This enriches the methods for determining whether a device is a capacity-type memory expansion device.
[0061] In some possible implementations, if the memory bandwidth and memory capacity of the memory expansion device meet a third preset condition, determining that the memory expansion device is a balanced memory expansion device includes:
[0062] If the memory bandwidth is within the second bandwidth range and the memory capacity is within the second capacity range, the category of the memory expansion device is determined to be a balanced memory expansion device; or, if the first parameter value is within the fifth threshold range, the category of the memory expansion device is determined to be a balanced memory expansion device; or, if the second parameter value is within the sixth threshold range, the category of the memory expansion device is determined to be a balanced memory expansion device.
[0063] This implementation provides three methods for determining whether a memory expansion device is a balanced memory expansion device. Based on any of these three methods, you can determine whether the memory expansion device is a balanced memory expansion device. This enriches the methods for determining whether a memory expansion device is a balanced memory expansion device.
[0064] In some possible implementations, allocating memory that satisfies the memory requirement information to the computing device from the target memory expansion device includes:
[0065] Determining whether the capacity of the target type of memory of the target memory expansion device is greater than or equal to the target capacity;
[0066] In a case where the capacity of the target type of memory of the target memory expansion device is greater than or equal to the target capacity, memory of the target capacity is allocated to the computing device from the target memory expansion device.
[0067] In the above implementation method, by determining whether the capacity of the target type memory of the target memory expansion device is greater than or equal to the target capacity, it is ensured that the subsequent memory allocation process is executed when the capacity of the target type memory of the target memory expansion device is greater than or equal to the target capacity, thereby improving the reliability of memory allocation.
[0068] In another aspect, a memory allocation device is provided, the device comprising:
[0069] a receiving module configured to receive a memory request from a computing device; wherein the memory request includes allocation request information and memory requirement information, wherein the allocation request information is used to indicate an attribute indicator of a memory expansion device requested by the computing device, wherein the attribute indicator is a latency indicator or a bandwidth indicator; and the memory requirement information is used to indicate a memory indicator requested by the computing device, wherein the memory indicator includes a memory size and a memory type.
[0070] A determination module, configured to determine a target memory expansion device whose category matches the attribute indicator from the CXL memory pool;
[0071] An allocation module is used to allocate memory that meets the memory requirement information to the computing device from the target memory expansion device.
[0072] In another aspect, an electronic device is provided, comprising a processor and a memory, the processor and the memory being coupled, wherein the memory is configured to store computer program instructions, and the processor is configured to call the computer program instructions in the memory to execute the memory allocation method described in the above embodiment.
[0073] On the other hand, a computer-readable storage medium is provided, which stores computer program instructions. The computer program instructions are used to enable an electronic device to execute the memory allocation method shown in the above embodiment.
[0074] On the other hand, a computer program product is provided, including computer program instructions. When the computer program instructions are executed on an electronic device, the electronic device executes the memory allocation method shown in the above embodiment. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] Figure 1 A schematic diagram of the architecture of a memory allocation system provided in an embodiment of the present application;
[0076] Figure 2 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0077] Figure 3 A flowchart of a memory allocation method provided in an embodiment of the present application;
[0078] Figure 4 A flowchart of a memory allocation method provided in an embodiment of the present application;
[0079] Figure 5 An example schematic diagram of a memory application provided in an embodiment of the present application;
[0080] Figure 6 A schematic diagram of a memory allocation process provided in an embodiment of the present application;
[0081] Figure 7 A schematic diagram of a memory allocation process provided in an embodiment of the present application;
[0082] Figure 8 An example schematic diagram of a memory allocation system provided in an embodiment of the present application;
[0083] Figure 9 An example schematic diagram of memory management provided in an embodiment of the present application;
[0084] Figure 10 A schematic diagram of the structure of a memory allocation device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0085] In the description of the embodiments of the present application, unless otherwise specified, " / " means "or", for example, A / B can mean A or B. "And / or" in this article is merely a description of the association relationship of associated 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. In addition, "at least one" means one or more, and "a plurality" means two or more. Words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not limit them to be necessarily different.
[0086] It should be noted that in the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0087] CXL is a high-speed interconnect technology that supports multiple computing devices to share a remote pooled memory pool (such as the CXL memory pool), narrowing the memory gap between computing devices and CPUs, and between computing devices. It enables high-speed data transmission and memory sharing, providing higher data throughput and lower latency, thus meeting the needs of modern computing and storage systems.
[0088] Currently, when allocating memory in the CXL memory pool, the memory capacity requested by the computing device is typically allocated to the computing device to meet the required capacity. However, the above technical solution only considers the memory capacity requested by the computing device, resulting in the allocated memory performance not matching actual usage needs and low memory accuracy.
[0089] In view of this, an embodiment of the present application provides a memory allocation method that can be applied to the memory allocation scenario of the CXL memory pool. Among them, by carrying allocation request information and memory requirement information in the memory request of the computing device, on the one hand, the allocation request information can be used to indicate the attribute indicators of the memory requested by the computing device, such as latency indicators or bandwidth indicators, and on the other hand, the memory requirement information can be used to indicate the memory indicators requested by the computing device, such as memory size and memory type. Furthermore, the management device can determine the target memory expansion device whose category matches the attribute indicator from the CXL memory pool, and can achieve more targeted memory allocation, thereby meeting the computing device's needs for memory with different attributes. Then, memory that meets the memory requirement information is allocated to the computing device from the target memory expansion device, which not only improves the efficiency of memory allocation, but also effectively improves the accuracy of memory allocation.
[0090] In some embodiments, the memory allocation method provided by the embodiments of the present application can be applied to Figure 1 The memory allocation system shown. Figure 1 This is a schematic diagram of the architecture of a memory allocation system provided in an embodiment of the present application. Figure 1 The memory allocation system includes: a computing device 101 , a management device 102 , a CXL switch 103 , and multiple memory expansion devices 104 .
[0091] The computing device 101 is a device that applies for memory, that is, a device to which memory is to be allocated. Figure 1 , the computing device 101 can be Figure 1 Any one of the Host_0 device, Host_1 device, ..., Host_n device shown, where n is a positive integer greater than 1.
[0092] In some possible implementations, the computing device 101 may be an independent physical server, such as a general-purpose server, a graphics processing unit (GPU) server, an artificial intelligence (AI) server, etc., or a server cluster or distributed file system composed of multiple physical servers, or at least one of cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks, and big data or artificial intelligence platforms. The embodiments of the present application are not limited to this.
[0093] In an embodiment of the present application, the computing device 101 is configured to send a memory request to the management device 102 to request the management device 102 to allocate memory to the computing device 101. In some possible implementations, the memory request may carry allocation request information, where the allocation request information is used to indicate an attribute indicator of the memory expansion device requested by the computing device 101, where the attribute indicator is a latency indicator or a bandwidth indicator. Alternatively, in other possible implementations, the memory request may also carry memory requirement information, where the memory requirement information is used to indicate a memory indicator requested by the computing device 101, such as one or more of the following: memory type (memory type on the memory expansion device), memory size, memory speed, etc.
[0094] In some possible implementations, the memory request may be automatically triggered by the computing device 101. For example, upon receiving a pending task, the computing device may automatically trigger a memory request for the pending task so that the task can be subsequently processed based on the allocated memory. The pending task may be a computing task or a storage task.
[0095] In other possible implementations, the memory request can be manually triggered by the user. For example, the computing device 101 can be associated with a terminal device, and the user can trigger the computing device 101 to send a memory request to the management device 102 by operating the terminal device. The terminal device can be at least one of a smartphone, a desktop computer, a laptop, a virtual reality terminal, and an augmented reality terminal.
[0096] The management device 102 is a device for allocating memory. In some possible implementations, the management device 102 may be a management node of a CXL memory pool, such as Figure 1 The FM node shown. A management node refers to a server or processor responsible for memory management in a CXL memory pool. In other possible implementations, the management device 102 may also be another proxy node in the CXL memory pool. A proxy node refers to another server or processor connected to a management node.
[0097] In some possible implementations, the management device 102 may run a classification management module, an application interface module, and a memory allocation module. The classification management module, application interface module, and memory allocation module may be deployed as three independent modules in the management device 102, or they may be combined into a single integrated module and deployed in the management device 102. This embodiment of the present application is not limited to this.
[0098] The classification management module is used to classify and manage memory expansion devices in the CXL memory pool. In embodiments of the present application, the categories of each memory expansion device in the CXL memory pool are determined based on the memory capacity and memory bandwidth of the memory expansion device. For example, the classification management module can be used to classify memory expansion devices in the CXL memory pool into bandwidth-type memory expansion devices and capacity-type memory expansion devices. In another example, the classification management module can be used to classify memory expansion devices in the CXL memory pool into bandwidth-type memory expansion devices, capacity-type memory expansion devices, and balanced-type memory expansion devices.
[0099] The application interface module is used to provide the computing device 101 with an application programming interface (API) for the CXL memory pool. For example, it can provide the computing device 101 with an API for requesting memory and an API for releasing memory. Regarding the API for requesting memory, in some possible implementations, different attribute metrics can be provided to the computing device 101, such as APIs for latency or bandwidth.
[0100] The memory allocation module is used to allocate memory to the computing device 101 .
[0101] In this embodiment of the present application, the management device 102 is configured to receive a memory request from the computing device 101, determine a target memory expansion device from the CXL memory pool whose class matches the attribute indicator, and then allocate memory from the target memory expansion device to the computing device 101 that meets the memory request information.
[0102] exist Figure 1 In the memory allocation system shown, a computing device 101 is connected to a management device 102 and multiple memory expansion devices 104 via a CXL switch 103. Figure 1 Multiple computing devices such as Host_0 and Host_1 can share a CXL memory pool through the CXL switch 103 .
[0103] In one possible implementation, the memory expansion device 104 may be a memory expansion card, which may include a memory stick and a CXL controller. Figure 1 , the memory module can be used as follows Figure 1 The CXL controller can be represented by the shaded grid strips shown in the figure. Figure 1 In some possible implementations, the memory expansion device 104 may include at least one of an accelerator, a dual-inline-memory-module (DIMM), a non-volatile memory (NVMem), and a persistent memory (PMEM). Figure 1 As shown, the dual in-line memory module DIMM may be a fourth generation double data rate synchronous dynamic random access memory (DDR) or a fifth generation DDR.
[0104] In a possible implementation, the management device may be an electronic device, and its hardware structure can be found in Figure 2 .
[0105] Figure 2 The electronic device 200 may include a processor 201, a memory 202, a communication interface 203, and a bus 204. The processor 201, the memory 202, and the communication interface 203 may be connected via the bus 204.
[0106] The processor 201 is the control center of the electronic device 200 and can be a central processing unit (CPU) or other types of processors. Among them, other types of processors can be processors such as microprocessors. In the embodiment of the present application, the memory allocation method can be specifically executed by the processor 201 in the electronic device 200.
[0107] As an example, the processor 201 may include one or more CPUs, such as Figure 2 CPU0 and CPU1 are shown in the figure.
[0108] The memory 202 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, or other type of dynamic storage device that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0109] In one possible implementation, the memory 202 may exist independently of the processor 201. The memory 202 may be connected to the processor 201 via a bus 204 and may be used to store data, instructions, or program codes. When the processor 201 calls and executes the instructions or program codes stored in the memory 202, the memory allocation method provided in the embodiments of the present application may be implemented.
[0110] In another possible implementation, the memory 202 may also be integrated with the processor 201 .
[0111] The communication interface 203 is used to connect the electronic device 200 to other devices via a communication network, which can be Ethernet, a radio access network (RAN), a wireless local area network (WLAN), etc. The communication interface 203 may include a receiving unit for receiving data and a sending unit for sending data.
[0112] The bus 204 may be an ISA bus, a PCI bus, or an EISA bus. The bus may be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, Figure 2 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0113] It should be pointed out that Figure 2 The structure shown in the figure does not constitute a limitation on the electronic device 200. Figure 2In addition to the components shown, the electronic device 200 may include more or fewer components than shown, or combine certain components, or arrange the components differently.
[0114] Figure 3 This is a flow chart of a memory allocation method provided in an embodiment of the present application. The method is executed by a management device, for example, specifically, it can be executed by a processor of the management device. Figure 3 Taking the interaction process between a computing device and a management device as an example, the method includes the following steps S301-S303:
[0115] S301: Receive a memory request from a computing device.
[0116] The memory request may include allocation request information, where the allocation request information is used to indicate a property indicator of the memory expansion device requested by the computing device. For example, the property indicator may be a latency indicator or a bandwidth indicator.
[0117] The memory request may further include memory requirement information, where the memory requirement information is used to indicate memory metrics requested by the computing device, such as one or more of memory type, memory size, memory speed, etc.
[0118] S302 : Determine a target memory expansion device whose category matches the attribute indicator from the CXL memory pool.
[0119] The categories of each memory expansion device in a CXL memory pool are determined based on the memory capacity and memory bandwidth of the memory expansion device. For example, memory expansion devices in a CXL memory pool can be categorized as bandwidth-type memory expansion devices and capacity-type memory expansion devices. Alternatively, memory expansion devices in a CXL memory pool can be categorized as bandwidth-type memory expansion devices, capacity-type memory expansion devices, and balanced-type memory expansion devices.
[0120] S303: Allocate memory that meets the memory requirement information to the computing device from the target memory expansion device.
[0121] Exemplarily, a memory bank that meets the memory requirement information may be allocated to the computing device from the target memory expansion device.
[0122] The technical solution provided by the embodiment of the present application carries allocation request information and memory requirement information in the memory request of the computing device. On the one hand, the allocation request information can indicate the attribute indicators of the memory expansion device requested by the computing device, such as the latency indicator or the bandwidth indicator. On the other hand, the memory requirement information can indicate the memory indicators requested by the computing device, such as the memory size and memory type. Furthermore, the management device can determine the target memory expansion device whose category matches the attribute indicator from the CXL memory pool, which can achieve more targeted memory allocation, thereby meeting the computing device's demand for memory with different attributes. Memory that meets the memory requirement information is then allocated to the computing device from the target memory expansion device, which not only improves the efficiency of memory allocation, but also effectively improves the accuracy of memory allocation.
[0123] Figure 4 This is a flow chart of a memory allocation method provided in an embodiment of the present application. The method is executed by a management device, for example, specifically, it can be executed by a processor of the management device. Figure 4 Taking the interaction process between a computing device and a management device as an example, the method includes the following steps S401-S406:
[0124] S401: Obtain the memory capacity and memory bandwidth of each memory expansion device in the CXL memory pool.
[0125] The memory capacity of the memory expansion device refers to the storage space size of the memory expansion device.
[0126] In some possible implementations, the management device may obtain the memory capacity of each memory expansion device in the CXL memory pool through an out-of-band channel.
[0127] The memory bandwidth of a memory expansion device refers to the speed at which the memory expansion device can read and write data. It is used to measure the ability to move data from the memory expansion device during a single read or write process.
[0128] In some possible implementations, the management device may obtain the memory bandwidth of each memory expansion device in the CXL memory pool through an out-of-band channel.
[0129] In some possible implementations, the memory bandwidth of the memory expansion device is the smallest of the memory channel bandwidth and the memory link bandwidth. Memory channel bandwidth refers to the total bandwidth of multiple memory channels in the memory expansion device. Memory link bandwidth refers to the link bandwidth between the memory expansion device and a CXL switch in the CXL memory pool.
[0130] Regarding memory channel bandwidth, in some possible implementations, for each memory expansion device in a CXL memory pool, the management device may determine the memory channel bandwidth of the memory expansion device based on the number of memory channels included in the memory expansion device and the single-channel bandwidth. Single-channel bandwidth refers to the bandwidth of a single memory channel. It should be noted that a memory expansion device may include multiple memory channels.
[0131] Exemplarily, the management device may determine the product of the number of memory channels and the single-channel bandwidth of the memory expansion device based on the number of memory channels included in the memory expansion device, the single-channel bandwidth, and the following formula (1), as the memory channel bandwidth of the memory expansion device.
[0132] Memory channel bandwidth = number of memory channels × single channel bandwidth (1)
[0133] Regarding memory link bandwidth, in some possible implementations, for each memory expansion device in the CXL memory pool, the management device may determine the theoretical bandwidth of the number of links between the memory expansion device and the CXL switch based on the number of links between the memory expansion device and the CXL switch, and use the theoretical bandwidth as the memory link bandwidth of the memory expansion device.
[0134] For example, assuming there are 8 links between the memory expansion device and the CXL switch, if the memory expansion device and the CXL switch use the PCIe 5.0 protocol, the theoretical bandwidth of this number of links is 32 GB / s. Assuming there are 16 links between the memory expansion device and the CXL switch, the theoretical bandwidth of this number of links is 64 GB / s.
[0135] In this way, by determining the memory channel bandwidth and memory link bandwidth, the minimum bandwidth value is determined as the memory bandwidth of the memory expansion device. This not only considers the total bandwidth of the multiple memory channels in the memory expansion device, but also the link bandwidth between the memory expansion device and the CXL switches in the CXL memory pool. This increases the amount of information used in determining the memory bandwidth, allowing for a more accurate determination of the memory bandwidth.
[0136] S402 : In the CXL memory pool, determine the category of each memory expansion device based on the memory capacity and memory bandwidth of each memory expansion device.
[0137] In some possible implementations, if the memory bandwidth of the memory expansion device meets a first preset condition, the memory expansion device is determined to be a bandwidth-type memory expansion device. In this embodiment of the present application, a bandwidth-type memory expansion device refers to a memory expansion device whose memory bandwidth meets the first preset condition.
[0138] The memory bandwidth meeting the first preset condition may include any one of the following three conditions (1-1) to (1-3).
[0139] (1-1) The memory bandwidth is within the first bandwidth range.
[0140] The first bandwidth range may be a numerical range in which the bandwidth is greater than or equal to a preset bandwidth threshold. The preset bandwidth threshold is a pre-set bandwidth threshold, such as a bandwidth threshold with a larger value. It should be understood that the first bandwidth range may be a range with a larger bandwidth value. In this way, memory expansion devices with a larger bandwidth can be screened out.
[0141] (1-2) The first parameter value is within the first threshold range.
[0142] The first parameter value is positively correlated with the memory capacity and negatively correlated with the memory bandwidth. That is, the larger the memory capacity, the larger the first parameter value, and the larger the memory bandwidth, the smaller the first parameter value.
[0143] In some possible implementations, the first parameter value is a ratio of the memory capacity to the memory bandwidth. In other possible implementations, the first parameter value is a difference between the memory capacity and the memory bandwidth. The present embodiment does not limit the setting of the first parameter value.
[0144] Exemplarily, taking the first parameter value as the ratio of the memory capacity to the memory bandwidth as an example, the process of the management device determining the first parameter value can be: based on the memory capacity, the memory channel bandwidth, the memory link bandwidth and the following formula (2), determine the ratio of the memory capacity to the memory bandwidth as the first parameter value.
[0145] The first parameter value = memory capacity / min (memory channel bandwidth, memory link bandwidth) (2)
[0146] As another example, taking the first parameter value as the difference between the memory capacity and the memory bandwidth as an example, the process of the management device determining the first parameter value can be: based on the memory capacity, the memory channel bandwidth, the memory link bandwidth and the following formula (3), determine the difference between the memory capacity and the memory bandwidth as the first parameter value.
[0147] The first parameter value = memory capacity - min (memory channel bandwidth, memory link bandwidth) (3)
[0148] In this way, two types of first parameters are provided, so that the management device can determine the category of the memory expansion device based on the ratio of the memory capacity to the memory bandwidth, or the difference between the memory capacity and the memory bandwidth. This not only improves the efficiency of classification management, but also improves the flexibility of classification management.
[0149] It is worth noting that in other possible implementations, the first parameter value may also be other types of parameter values, as long as the first parameter value is positively correlated with the memory capacity and negatively correlated with the memory bandwidth. This embodiment of the present application does not limit this.
[0150] In some possible implementations, the first threshold range may be a numerical range less than or equal to the first preset threshold, such as a numerical range less than or equal to 2, such as (0, 2). It should be understood that the first parameter value is less than or equal to the first preset threshold, indicating that the bandwidth capability is greater than the capacity capability. In this way, memory expansion devices with a larger bandwidth can also be screened out.
[0151] (1-3) The second parameter value is within the second threshold range.
[0152] The second parameter value is negatively correlated with the memory capacity and positively correlated with the memory bandwidth. That is, the larger the memory capacity, the smaller the second parameter value, and the larger the memory bandwidth, the larger the second parameter value.
[0153] In some possible implementations, the second parameter value is a ratio of the memory bandwidth to the memory capacity. In other possible implementations, the second parameter value is a difference between the memory bandwidth and the memory capacity. The present embodiment does not limit the setting of the second parameter value.
[0154] Exemplarily, taking the second parameter value as the ratio of the memory bandwidth to the memory capacity as an example, the process of the management device determining the second parameter value may be: based on the memory capacity, the memory channel bandwidth, the memory link bandwidth and the following formula (4), determine the ratio of the memory bandwidth to the memory capacity as the second parameter value.
[0155] Second parameter value = min(memory channel bandwidth, memory link bandwidth) / memory capacity (4)
[0156] As another example, taking the second parameter value as the difference between the memory bandwidth and the memory capacity, the process of the management device determining the second parameter value may be: based on the memory capacity, the memory channel bandwidth, the memory link bandwidth and the following formula (5), determine the difference between the memory bandwidth and the memory capacity as the second parameter value.
[0157] Second parameter value = min(memory channel bandwidth, memory link bandwidth) - memory capacity (5)
[0158] In this way, two types of second parameter values are provided, so that the management device can determine the category of the memory expansion device based on the ratio of the memory bandwidth to the memory capacity, or the difference between the memory bandwidth and the memory capacity, which not only improves the efficiency of classification management, but also improves the flexibility of classification management.
[0159] It is worth noting that in other possible implementations, the second parameter value may also be other types of parameter values, as long as the second parameter value is negatively correlated with the memory capacity and positively correlated with the memory bandwidth. This embodiment of the present application does not limit this.
[0160] In some possible implementations, the second threshold range can be a numerical range greater than the second preset threshold, such as a numerical range greater than 4, such as (4, +∞). It should be understood that a second parameter value greater than the second preset threshold indicates that the bandwidth capability is greater than the capacity capability. In this way, memory expansion devices with larger bandwidths can also be screened out.
[0161] In (1-1) to (1-3) above, three types of first preset conditions are provided, enriching the types of first preset conditions. The management device can determine whether the memory expansion device is a bandwidth-type memory expansion device based on any one of the three types of first preset conditions.
[0162] In some possible implementations, if the memory bandwidth of the memory expansion device is within a first bandwidth range, the memory expansion device is determined to be a bandwidth-type memory expansion device; or, if the first parameter value is within a first threshold range, the memory expansion device is determined to be a bandwidth-type memory expansion device; or, if the second parameter value is within a second threshold range, the memory expansion device is determined to be a bandwidth-type memory expansion device. In this implementation, three methods are provided for determining whether a memory expansion device is a bandwidth-type memory expansion device. Based on any one of these three methods, whether the memory expansion device is a bandwidth-type memory expansion device can be determined. In this way, the methods for determining bandwidth-type memory expansion devices are enriched.
[0163] In some other possible implementations, if the memory capacity of the memory expansion device meets the second preset condition, the category of the memory expansion device is determined to be a capacity-type memory expansion device. In the embodiment of the present application, a capacity-type memory expansion device refers to a memory expansion device whose memory capacity meets the second preset condition.
[0164] The memory capacity meeting the second preset condition may include any one of the three conditions shown below (2-1) to (2-3).
[0165] (2-1) The memory capacity is within the first capacity range.
[0166] The first capacity range may be a numerical range of capacities greater than or equal to a preset capacity threshold. The preset capacity threshold is a pre-set capacity threshold, such as a capacity threshold with a larger value. It should be understood that the first capacity range may be a range with a larger capacity value. In this way, memory expansion devices with larger capacities can be selected.
[0167] (2-2) The first parameter value is within the third threshold range.
[0168] In an embodiment of the present application, the numerical value within the first threshold range is less than the numerical value within the third threshold range. That is to say, compared with the first threshold range, the third threshold range is a numerical range with a larger numerical value. For example, the third threshold range can be a numerical range greater than the third preset threshold (greater than or equal to the first preset threshold), such as a numerical range greater than 4, such as (4, +∞). It should be understood that the first parameter value is greater than the third preset threshold, indicating that the capacity capacity is larger than the bandwidth capacity. In this way, it is also possible to screen out memory expansion devices with larger capacity.
[0169] (2-3) The second parameter value is within the fourth threshold range.
[0170] In an embodiment of the present application, the numerical value within the second threshold range is greater than the numerical value within the fourth threshold range. That is to say, compared with the second threshold range, the fourth threshold range is a numerical range with smaller numerical values. For example, the fourth threshold range can be a numerical range less than or equal to the fourth preset threshold (less than or equal to the second preset threshold), such as a numerical range less than or equal to 2, such as (0, 2]. It should be understood that the second parameter value is less than or equal to the fourth preset threshold, indicating that the capacity capacity is larger than the bandwidth capacity. In this way, memory expansion devices with larger capacity can also be screened out.
[0171] In (2-1) to (2-3) above, three types of second preset conditions are provided, enriching the types of second preset conditions. The management device can determine whether the memory expansion device is a capacity-type memory expansion device based on any one of the three types of second preset conditions.
[0172] In some possible implementations, if the memory capacity corresponding to the memory expansion device is within a first capacity range, the memory expansion device is determined to be a capacity-type memory expansion device; or, if the first parameter value is within a third threshold range, the memory expansion device is determined to be a capacity-type memory expansion device; or, if the second parameter value is within a fourth threshold range, the memory expansion device is determined to be a capacity-type memory expansion device. In this implementation, three methods are provided for determining whether a device is a capacity-type memory expansion device. The management device can determine whether the memory expansion device is a capacity-type memory expansion device based on any of these three methods. In this way, the methods for determining a capacity-type memory expansion device are enriched.
[0173] In some other possible implementations, if the memory bandwidth and memory capacity corresponding to the memory expansion device meet a third preset condition, the memory expansion device is determined to be a balanced memory expansion device. In this embodiment of the present application, a balanced memory expansion device refers to a memory expansion device whose memory bandwidth and memory capacity meet the third preset condition.
[0174] The memory bandwidth and memory capacity satisfying the third preset condition may include any one of the following three conditions (3-1) to (3-3).
[0175] (3-1) The memory bandwidth is within the second bandwidth range and the memory capacity is within the second capacity range.
[0176] The second bandwidth range may be a numerical range in which the bandwidth is less than a preset bandwidth threshold. It should be understood that the second bandwidth range may be a range with a relatively small bandwidth value. The second capacity range may be a numerical range in which the capacity is less than a preset capacity threshold. It should be understood that the second capacity range may be a range with a relatively small capacity value.
[0177] (3-2) The first parameter value is within the fifth threshold range.
[0178] In the embodiment of the present application, the fifth threshold range is between the first threshold range and the third threshold range. For example, the fifth threshold range can be a numerical range greater than the first preset threshold and less than or equal to the third preset threshold, such as a numerical range greater than 2 and less than or equal to 4, such as (2, 4]. It should be understood that the first parameter value is within the fifth threshold range, that is, the first parameter value is between the first threshold range and the third threshold range, indicating that the capacity capability and the bandwidth capability are balanced.
[0179] (3-3) The second parameter value is within the sixth threshold range.
[0180] In the embodiment of the present application, the sixth threshold range is between the second threshold range and the fourth threshold range. For example, the sixth threshold range can be a numerical range greater than the fourth preset threshold and less than or equal to the second preset threshold, such as a numerical range greater than 2 and less than or equal to 4, such as (2, 4]. It should be understood that the second parameter value is within the sixth threshold range, that is, the second parameter value is between the second threshold range and the fourth threshold range, indicating that the capacity capability and the bandwidth capability are balanced.
[0181] In (3-1) to (3-3) above, three types of third preset conditions are provided, enriching the types of third preset conditions. The management device can determine whether the memory expansion device is a balanced memory expansion device based on any one of the three types of third preset conditions.
[0182] In some possible implementations, if the memory bandwidth is within the second bandwidth range and the memory capacity is within the second capacity range, the memory expansion device is determined to be a balanced memory expansion device; or, if the first parameter is within the fifth threshold range, the memory expansion device is determined to be a balanced memory expansion device; or, if the second parameter is within the sixth threshold range, the memory expansion device is determined to be a balanced memory expansion device. In this implementation, three methods for determining whether a memory expansion device is a balanced memory expansion device are provided. Based on any of these three methods, whether the memory expansion device is a balanced memory expansion device can be determined. In this way, the methods for determining whether a memory expansion device is a balanced memory expansion device are enriched.
[0183] In the above embodiment, each memory expansion device in the CXL memory pool is classified and managed according to the memory capacity and memory bandwidth corresponding to each memory expansion device. The CXL memory pool can be divided into three types of memory expansion devices: bandwidth-type memory expansion devices, capacity-type memory expansion devices, and balanced memory expansion devices, thereby achieving refined management of the CXL memory pool.
[0184] It should be noted that, in some other possible implementations, the CXL memory pool may also be divided into two types of memory expansion devices: bandwidth-type memory expansion devices and capacity-type memory expansion devices, which is not limited in the present embodiment.
[0185] Furthermore, in some possible implementations, the bandwidth-type memory expansion device, the capacity-type memory expansion device, and the balanced-type memory expansion device may each carry a latency level for memory latency. For example, the latency level may include a first-level latency and a second-level latency, where the latency indicated by the first-level latency is less than the latency indicated by the second-level latency.
[0186] In one possible implementation, the latency level of each memory expansion device is determined based on the number of CXL switch stages it spans. For example, level 1 latency may represent the latency across one level of CXL switches, while level 2 latency may represent the latency across two levels of CXL switches.
[0187] In this way, by carrying the memory latency level for each category of memory expansion devices, classified management in the latency dimension can be achieved, and further refined management of the CXL memory pool can be achieved.
[0188] S403: Receive a memory request from a computing device.
[0189] The memory request is used to request allocation of memory from the CXL memory pool for the computing device. In some possible implementations, the memory request may include allocation request information indicating attribute metrics of the memory expansion device requested by the computing device. For example, the attribute metrics may be latency metrics or bandwidth metrics.
[0190] In some possible implementations, a latency metric can be used to indicate a latency requirement, such as low memory latency. It should be understood that if the attribute metric indicated in the allocation request information is a latency metric, this indicates that the computing device is requesting memory with low memory latency. In some possible implementations, a latency metric can also be used to indicate a latency value or range. For example, the metric value can be the memory latency value, and the metric range can be the range of values within which the memory latency falls.
[0191] In embodiments of the present application, a bandwidth indicator can be used to indicate a bandwidth indicator requirement, such as a high memory bandwidth. It should be understood that if the attribute indicator indicated by the allocation request information is a bandwidth indicator, this indicates that the computing device is requesting memory with a high memory bandwidth. In some possible implementations, the bandwidth indicator can also be used to indicate a bandwidth indicator value or an indicator range. For example, the indicator value can be the bandwidth value of the memory bandwidth, and the indicator range can be the numerical range of the memory bandwidth.
[0192] In some possible implementations, the memory request may also carry memory requirement information, which is used to indicate the memory metrics requested by the computing device, such as one or more of the following: memory type (memory type on a memory expansion device), memory size, memory speed, etc. The embodiments of this application will be described later using an example in which a memory request includes allocation request information and memory requirement information.
[0193] In a scenario where a memory request is automatically triggered by a computing device, the process of triggering a memory request by the computing device may be: the computing device determines the allocation request information and memory requirement information of this memory application based on the task to be processed, and then generates the memory request based on the determined allocation request information and memory requirement information, and sends the memory request to the management device. For example, the allocation request information may be determined based on the task type of the task to be processed, such as different task types may correspond to different attribute indicators. Alternatively, the allocation request information may also be a pre-specified attribute indicator, such as a default attribute indicator. For another example, the memory requirement information may be determined based on the data volume of the task to be processed, such as different data volumes may correspond to different memory indicators.
[0194] In a scenario where a memory request is manually triggered by a user, the computing device may provide the user with a memory request interface, which provides a configuration function for allocation request information and memory requirement information. The user may configure the allocation request information and memory requirement information in the memory request interface, and upload the configured allocation request information and memory requirement information to the computing device. The computing device then receives the uploaded allocation request information and memory requirement information, generates the memory request based on the allocation request information and memory requirement information, and sends the memory request to the management device. For example, the memory request interface may include options for multiple attribute indicators, and the user can complete the configuration of the allocation request information by selecting any of the attribute indicator options. For another example, the memory request interface may include options for multiple memory indicators, and the user can complete the configuration of the memory requirement information by selecting any of the memory indicator options. This embodiment of the present application is not limited to this.
[0195] It is worth noting that in other possible implementations, the computing device may also use other implementations to trigger the memory request, which is not limited in the present embodiment.
[0196] For example, Figure 5 This is an example diagram of a memory application provided in an embodiment of the present application. Figure 5 , where obj_type is used to refer to memory types, such as accelerator, non-volatile memory (Nvmem), dynamic random access memory (DRAM), etc. It should be noted that DRAM types can include DDR4 type or DDR5 type. obj_attribute is used to refer to attribute indicators, such as bandwidth indicator (BW_Prefer) and latency indicator (Latency_Prefer). In this way, by calling Figure 5 The program shown triggers the computing device to send a memory request to the management device, requesting that memory from the CXL memory pool be allocated to the computing device. Furthermore, after the computing device has finished using the memory, it can call the void* cxlfabric_free function to free the memory.
[0197] In some possible implementations, if the memory requirement information indicates that the requested memory size is the target capacity and the memory type is the target type, the management device further determines whether the remaining memory capacity of the memory expansion device with the target type in the CXL memory pool is greater than the target capacity. In other words, subsequent memory allocation processes are performed only after ensuring that the remaining memory capacity of the memory expansion device with the target type in the CXL memory pool is sufficient.
[0198] S404: Determine a target memory expansion device whose class matches the attribute indicator from the CXL memory pool.
[0199] In some possible implementations, taking the example of a CXL memory pool divided into two types of memory expansion devices: bandwidth-based memory expansion devices and capacity-based memory expansion devices, if the attribute indicator indicated by the allocation request information is a bandwidth indicator, the management device can determine the target memory expansion device from the bandwidth-based memory expansion devices. Alternatively, if the attribute indicator indicated by the allocation request information is a latency indicator, the management device can determine the target memory expansion device from the capacity-based memory expansion devices. In this way, by determining the target memory expansion device that matches the attribute indicator, the computing device's needs for memory with different attributes can be met.
[0200] In some other possible implementations, taking the example of the CXL memory pool being divided into three types of memory expansion devices: bandwidth-type memory expansion devices, capacity-type memory expansion devices, and balanced-type memory expansion devices, when the attribute indicator indicated by the allocation request information is a bandwidth indicator, the target memory expansion device may also include the balanced-type memory expansion device. Or, when the attribute indicator indicated by the allocation request information is a latency indicator, the target memory expansion device may also include the balanced-type memory expansion device. In this way, other types of memory expansion devices are added for reference during memory allocation, so that when the attribute indicator indicated by the allocation request information is a bandwidth indicator, or when the attribute indicator indicated by the allocation request information is a latency indicator, the balanced-type memory expansion device may also be used as a candidate memory expansion device, thereby enriching the candidate options for memory expansion devices during memory allocation.
[0201] In the case where the attribute indicator indicated by the allocation request information is a latency indicator, the management device may further determine a capacity-type memory expansion device whose latency level of memory latency meets the latency priority condition as the target memory expansion device.
[0202] The latency priority condition may be low latency, such as minimum latency level. By setting the latency priority condition, when the attribute indicator indicated by the allocation request information is a latency indicator, a capacity-based memory expansion device with the lowest latency can be determined for the computing device to meet the computing device's latency requirements.
[0203] The following describes the process of determining the target memory expansion device in scenario 1 where the attribute indicator is the bandwidth indicator and scenario 2 where the attribute indicator is the latency indicator.
[0204] Scenario 1: The attribute indicator is the bandwidth indicator.
[0205] In some possible implementations, when the attribute indicator indicated by the allocation request information is a bandwidth indicator, the management device may also maintain a first preset priority order, which is used to indicate the order of priority from high to low for allocating different categories of memory expansion devices when the attribute indicator is a bandwidth indicator.
[0206] The management device may determine a target memory expansion device from the CXL memory pool that matches a class attribute indicator by obtaining an uplink bandwidth of the computing device and, based on the uplink bandwidth of the computing device, determining a lower limit of bandwidth allocated to the computing device. Furthermore, based on the lower limit of bandwidth and a first preset priority order, determining whether a target memory expansion device exists.
[0207] The uplink bandwidth refers to the link bandwidth between the computing device and the CXL switch, and is determined based on the number of links between the computing device and the CXL switch. For example, the management device can determine the theoretical bandwidth corresponding to the number of links between the computing device and the CXL switch, as the uplink bandwidth. For example, assuming the number of links between the computing device and the CXL switch is 16, the theoretical bandwidth corresponding to 16 links is 64 GB / s. In some possible implementations, twice the uplink bandwidth is used as the lower limit, such as 128 GB / s, to allocate a larger bandwidth to the computing device.
[0208] For example, the first preset priority order may be: bandwidth-type memory expansion device, balanced-type memory expansion device, and capacity-type memory expansion device. This means that the allocation priority of a bandwidth-type memory expansion device is higher than that of a balanced-type memory expansion device, and the allocation priority of a balanced-type memory expansion device is higher than that of a capacity-type memory expansion device.
[0209] As another example, when the bandwidth-type memory expansion device, the capacity-type memory expansion device, and the balanced-type memory expansion device all carry latency levels of memory latency, the first preset priority order can be: bandwidth-type memory expansion device with first-level latency, balanced-type memory expansion device with first-level latency, bandwidth-type memory expansion device with second-level latency, balanced-type memory expansion device with second-level latency, capacity-type memory expansion device with first-level latency, and capacity-type memory expansion device with second-level latency.
[0210] In this way, by maintaining the first preset priority order, when the attribute indicator requested by the computing device is the bandwidth indicator, memory allocation is performed according to the first preset priority order, and memory that matches the computing device's request can be allocated to the computing device first, thereby improving the accuracy of memory allocation.
[0211] In some possible implementations, the process of determining whether a target memory expansion device exists based on the bandwidth lower limit and the first preset priority order may be: determining, in sequence according to the first preset priority order, whether the memory channel bandwidth of each memory expansion device is greater than or equal to the bandwidth lower limit, so as to determine a target memory expansion device having a memory channel bandwidth greater than or equal to the bandwidth lower limit.
[0212] Specifically, in some possible implementations, there may be multiple target memory expansion devices. For example, the management device may determine multiple memory expansion devices whose sum of memory channel bandwidths is greater than or equal to the bandwidth lower limit as target memory expansion devices.
[0213] In this way, when the memory channel bandwidth of a single memory expansion device cannot meet the bandwidth lower limit, the memory channel bandwidths of multiple memory expansion devices can be combined to meet the bandwidth lower limit, thereby ensuring smooth memory allocation.
[0214] Scenario 2: The attribute indicator is the latency indicator.
[0215] In some possible implementations, when the attribute indicator indicated by the allocation request information is a latency indicator, the management device may also maintain a second preset priority order, which is used to indicate the order of priority from high to low for allocating different categories of memory expansion devices when the attribute indicator is a latency indicator.
[0216] The process of the management device determining the target memory expansion device whose category matches the attribute indicator from the CXL memory pool may be: determining whether the target memory expansion device exists based on the second preset priority order.
[0217] For example, the second preset priority order may be: capacity-type memory expansion device, balanced-type memory expansion device, and bandwidth-type memory expansion device. This means that the allocation priority of a capacity-type memory expansion device is higher than that of a balanced-type memory expansion device, and the allocation priority of a balanced-type memory expansion device is higher than that of a bandwidth-type memory expansion device.
[0218] As another example, when the bandwidth-type memory expansion device, the capacity-type memory expansion device, and the balanced-type memory expansion device all carry latency levels of memory latency, the second preset priority order can be: capacity-type memory expansion device with first-level latency, balanced-type memory expansion device with first-level latency, bandwidth-type memory expansion device with first-level latency, capacity-type memory expansion device with second-level latency, balanced-type memory expansion device with second-level latency, and bandwidth-type memory expansion device with second-level latency.
[0219] In this way, by maintaining the second preset priority order, when the attribute indicator requested by the computing device is the latency indicator, memory allocation is performed according to the second preset priority order, and memory that matches the computing device's request can be allocated to the computing device first, thereby improving the accuracy of memory allocation.
[0220] S405: Determine in the target memory expansion device the memory that meets the memory requirement information.
[0221] In some possible implementations, the process of the management device determining, in the target memory expansion device, memory that meets the memory requirement information may include at least one of the following:
[0222] In one possible implementation, the target memory expansion device determines memory of the same type as that indicated by the memory requirement information as the memory that satisfies the memory requirement information. This ensures that the memory types match, thereby guaranteeing the reliability of memory allocation.
[0223] In another possible implementation, the target memory expansion device determines that the memory with a remaining memory capacity greater than or equal to the memory size indicated by the memory requirement information is used as the memory that satisfies the memory requirement information. This ensures that the remaining memory capacity is sufficient, thereby ensuring the reliability of memory allocation.
[0224] There may be multiple target memory expansion devices. For example, among multiple target memory expansion devices, a memory whose sum of remaining memory capacities is greater than or equal to the memory size indicated by the memory requirement information is determined as the memory that meets the memory requirement information.
[0225] In this way, when the remaining memory capacity of a single memory expansion device cannot meet the memory size requirement, the remaining memory capacity of multiple memory expansion devices can be combined to meet the memory size requirement, thereby ensuring smooth memory allocation.
[0226] Another possible implementation method is to determine the memory that meets the memory requirement information from the memory channel with the largest remaining memory capacity among the multiple memory channels of the target memory expansion device. In this way, by allocating memory from the memory channel with the largest remaining memory capacity, balanced memory allocation can be achieved.
[0227] S406: Allocate memory that meets the memory requirement information to the computing device from the target memory expansion device.
[0228] In some possible implementations, if the memory requirement information indicates that the requested memory size is the target capacity and the memory type is the target type, a determination is made as to whether the capacity of the target type memory of the target memory expansion device is greater than or equal to the target capacity. Furthermore, if the capacity of the target type memory of the target memory expansion device is greater than or equal to the target capacity, memory of the target capacity is allocated from the target memory expansion device to the computing device.
[0229] With respect to the embodiment shown in steps S404 to S406 above, provided that the management device maintains a preset priority order, the management device may determine, in accordance with the preset priority order, whether the determined target memory expansion devices meet the memory requirement information. If so, the management device may allocate memory that meets the memory requirement information from the target memory expansion device to the computing device. If the current target memory expansion device does not meet the memory requirement information, the management device may continue to determine whether the next determined target memory expansion device meets the memory requirement information.
[0230] The following describes the memory allocation process in scenario 1 where the attribute indicator is the bandwidth indicator and scenario 2 where the attribute indicator is the latency indicator.
[0231] Scenario 1: The attribute indicator is the bandwidth indicator.
[0232] For example, taking the first preset priority order of bandwidth-type memory expansion device, balanced-type memory expansion device, and capacity-type memory expansion device as an example, the management device prioritizes executing the memory allocation process for the bandwidth-type memory expansion device. The corresponding process may be: the management device determines memory in the bandwidth-type memory expansion device that meets the memory requirement information. If the bandwidth-type memory expansion device does not meet the memory requirement information, the management device executes the memory allocation process for the balanced-type memory expansion device. The corresponding process may be: the management device determines memory in the balanced-type memory expansion device that meets the memory requirement information. If the balanced-type memory expansion device does not meet the memory requirement information, the management device executes the memory allocation process for the capacity-type memory expansion device. The corresponding process may be: the management device determines memory in the capacity-type memory expansion device that meets the memory requirement information. If the capacity-type memory expansion device does meet the memory requirement information, the management device executes the memory allocation process for the capacity-type memory expansion device. The corresponding process may be: the management device determines memory in the capacity-type memory expansion device that meets the memory requirement information. If the capacity-type memory expansion device does meet the memory requirement information, the management device executes the memory allocation process for the capacity-type memory expansion device. In this way, when the attribute indicator indicated by the allocation request information is a bandwidth indicator, by setting a first preset priority order, a bandwidth-type memory expansion device is given priority to meet the bandwidth demand of the computing device.
[0233] As another example, taking the first preset priority order of: bandwidth memory expansion device with first-level latency, balanced memory expansion device with first-level latency, bandwidth memory expansion device with second-level latency, balanced memory expansion device with second-level latency, capacity memory expansion device with first-level latency, and capacity memory expansion device with second-level latency as an example, the management device prioritizes executing the memory allocation process for the bandwidth memory expansion device with first-level latency. The corresponding process may be: the management device determines memory that meets the memory requirement information in the bandwidth memory expansion device with first-level latency, and if memory that meets the memory requirement information exists in the bandwidth memory expansion device with first-level latency, the management device allocates the memory that meets the memory requirement information to the computing device. If memory that meets the memory requirement information does not exist in the bandwidth memory expansion device with first-level latency, the management device executes the memory allocation process for the balanced memory expansion device with first-level latency. The corresponding process may be: the management device determines memory that meets the memory requirement information in the balanced memory expansion device with first-level latency, and if memory that meets the memory requirement information exists in the balanced memory expansion device with first-level latency, the management device allocates the memory that meets the memory requirement information to the computing device. If no memory that meets the memory requirement information exists in the balanced memory expansion device with the first level of latency, a memory allocation process for the bandwidth memory expansion device with the second level of latency is executed. The corresponding process may be: the management device determines memory that meets the memory requirement information in the bandwidth memory expansion device with the second level of latency, and if memory that meets the memory requirement information exists in the bandwidth memory expansion device with the second level of latency, the memory that meets the memory requirement information is allocated to the computing device. If no memory that meets the memory requirement information exists in the bandwidth memory expansion device with the second level of latency, a memory allocation process for the balanced memory expansion device with the second level of latency is executed. The corresponding process may be: the management device determines memory that meets the memory requirement information in the balanced memory expansion device with the second level of latency, and if memory that meets the memory requirement information exists in the balanced memory expansion device with the second level of latency, the memory that meets the memory requirement information is allocated to the computing device. If no memory that meets the memory requirement information exists in the balanced memory expansion device with a second latency, a memory allocation process for the capacity-type memory expansion device with a first latency is executed. The corresponding process may be: the management device determines memory that meets the memory requirement information in the capacity-type memory expansion device with a first latency, and if memory that meets the memory requirement information exists in the capacity-type memory expansion device with a first latency, the memory that meets the memory requirement information is allocated to the computing device. If no memory that meets the memory requirement information exists in the capacity-type memory expansion device with a first latency, a memory allocation process for the capacity-type memory expansion device with a second latency is executed. The corresponding process may be: the management device determines memory that meets the memory requirement information in the capacity-type memory expansion device with a second latency, and if memory that meets the memory requirement information exists in the capacity-type memory expansion device with a second latency, the memory that meets the memory requirement information is allocated to the computing device.
[0234] It is worth noting that in some other possible implementations, the first preset priority order can also be set to another order with bandwidth-type memory expansion devices being prioritized, such as the first preset priority order can also be: bandwidth-type memory expansion device with first-level latency, bandwidth-type memory expansion device with second-level latency, balanced memory expansion device with first-level latency, balanced memory expansion device with second-level latency, capacity-type memory expansion device with first-level latency, and capacity-type memory expansion device with second-level latency. This embodiment of the present application is not limited to this.
[0235] For example, the following is combined Figure 6 Scenario 1 is described as an example. Figure 6 A flowchart of memory allocation provided in an embodiment of the present application. Figure 6 In the case where the attribute indicator indicated by the allocation request information is a bandwidth indicator, that is, in the case where a bandwidth-type memory expansion device is applied for first, the memory allocation process may include:
[0236] S601. A management device receives a memory request from a computing device. The allocation request information carried by the memory request indicates that the attribute indicator is a bandwidth indicator. The memory requirement information carried by the memory request indicates that the memory type is a target type and the memory size is a target capacity.
[0237] That is, the memory request instructs allocation of a target type of memory of a bandwidth type memory expansion device of a target capacity.
[0238] S602: The management device determines whether the remaining memory capacity of the memory expansion device with the target type of memory in the CXL memory pool is greater than or equal to the target capacity. If the remaining memory capacity of the memory expansion device with the target type of memory in the CXL memory pool is greater than or equal to the target capacity, S603 is executed. If the remaining memory capacity of the memory expansion device with the target type of memory in the CXL memory pool is less than the target capacity, a message indicating a memory allocation failure is returned to the computing device.
[0239] S603: The management device obtains the uplink bandwidth of the computing device, and determines a lower limit of the bandwidth allocated to the computing device based on the uplink bandwidth.
[0240] Exemplarily, the management device may query the uplink bandwidth of the computing device and use twice the uplink bandwidth as the lower limit of the bandwidth allocated to the computing device.
[0241] S604: The management device determines whether the target memory expansion device exists based on the bandwidth lower limit and the first preset priority order. If so, S605 is executed. If not, a message indicating memory allocation failure is returned to the computing device.
[0242] Exemplarily, the first preset priority order can be: bandwidth-type memory expansion device with first-level latency, balanced-type memory expansion device with first-level latency, bandwidth-type memory expansion device with second-level latency (or greater than second-level latency), balanced-type memory expansion device with second-level latency (or greater than second-level latency), capacity-type memory expansion device with first-level latency, and capacity-type memory expansion device with second-level latency (or greater than second-level latency).
[0243] In some possible implementations, the management device determines, in order of a first preset priority, whether the memory channel bandwidth of each memory expansion device is greater than or equal to the bandwidth lower limit, to determine a target memory expansion device whose memory channel bandwidth is greater than or equal to the bandwidth lower limit.
[0244] It should be noted that when executing S604, the management device can determine, in accordance with a first preset priority order and based on the sum of the memory channel bandwidths of the multiple memory expansion devices, whether there are multiple memory expansion devices whose sum of the memory channel bandwidths is greater than or equal to the bandwidth lower limit; if so, the multiple memory expansion devices are determined as target memory expansion devices, so that the bandwidth demand can be met subsequently based on the memory channel bandwidths of the multiple memory expansion devices.
[0245] For example, if the memory channel bandwidth of the current memory expansion device is less than the bandwidth lower limit, the system can determine whether the sum of the memory channel bandwidths of the current memory expansion device and the next memory expansion device is greater than or equal to the bandwidth lower limit according to a first preset priority order. If so, the current memory expansion device and the next memory expansion device are determined as target memory expansion devices. If not, the system continues to determine whether the sum of the memory channel bandwidths of the current memory expansion device, the next memory expansion device, and the next memory expansion device is greater than or equal to the bandwidth lower limit until multiple memory expansion devices that meet the bandwidth requirement are determined.
[0246] S605: The management device determines whether the target memory expansion device meets the memory requirement information. If so, S606 is executed. If not, a memory allocation failure message is returned to the computing device.
[0247] Exemplarily, it may be determined whether the memory type of the target memory expansion device is the target type and whether the memory size is greater than or equal to the target capacity.
[0248] It should be noted that when executing the judgment process of whether the memory size is greater than or equal to the target capacity in S605, the management device can judge whether the sum of the remaining memory capacities of the multiple target memory expansion devices is greater than or equal to the target capacity based on the sum of the remaining memory capacities of the multiple target memory expansion devices in accordance with the first preset priority order. If so, execute S606 based on the memory of the multiple target memory expansion devices.
[0249] For example, if the remaining memory capacity of the current target memory expansion device is less than the target capacity, the first preset priority order may be used to determine whether the sum of the remaining memory capacities of the current target memory expansion device and the next target memory expansion device is greater than or equal to the target capacity. If so, step S606 is performed based on the memory capacities of the current target memory expansion device and the next target memory expansion device. If not, the sum of the remaining memory capacities of the current target memory expansion device, the next target memory expansion device, and the next target memory expansion device is further determined to be greater than or equal to the target capacity until a memory device that meets the memory requirement information is determined.
[0250] S606: The management device allocates memory that meets the memory requirement information to the computing device from the target memory expansion device.
[0251] In a possible implementation, after the management device allocates memory that meets the memory requirement information to the computing device from the target memory expansion device, it may also return a message indicating that the memory allocation is successful to the computing device.
[0252] Scenario 2: The attribute indicator is the latency indicator.
[0253] For example, taking the second preset priority order of: capacity-type memory expansion device, balanced-type memory expansion device, and bandwidth-type memory expansion device as an example, the management device prioritizes executing the memory allocation process for the capacity-type memory expansion device. The corresponding process may be: the management device determines memory in the capacity-type memory expansion device that meets the memory requirement information. If the capacity-type memory expansion device has memory that meets the memory requirement information, the management device allocates the memory that meets the memory requirement information to the computing device. If the capacity-type memory expansion device does not have memory that meets the memory requirement information, the management device executes the memory allocation process for the balanced-type memory expansion device. The corresponding process may be: the management device determines memory in the balanced-type memory expansion device that meets the memory requirement information. If the balanced-type memory expansion device does not have memory resources that meet the memory requirement information, the management device executes the memory allocation process for the bandwidth-type memory expansion device. The corresponding process may be: the management device determines memory in the bandwidth-type memory expansion device that meets the memory requirement information. If the bandwidth-type memory expansion device has memory that meets the memory requirement information, the management device allocates the memory that meets the memory requirement information to the computing device. In this way, when the attribute indicator indicated by the allocation request information is the latency indicator, the capacity-type memory expansion device is given priority by setting the allocation priority.
[0254] As another example, taking the second preset priority order of: first-level latency capacity-type memory expansion device, first-level latency balanced-type memory expansion device, first-level latency bandwidth-type memory expansion device, second-level latency capacity-type memory expansion device, second-level latency balanced-type memory expansion device, and second-level latency bandwidth-type memory expansion device as an example, the management device prioritizes executing the memory allocation process for the first-level latency capacity-type memory expansion device. The corresponding process may be: the management device determines memory that meets the memory requirement information in the first-level latency capacity-type memory expansion device. If memory that meets the memory requirement information exists in the first-level latency capacity-type memory expansion device, the management device allocates the memory that meets the memory requirement information to the computing device. If memory that meets the memory requirement information does not exist in the first-level latency capacity-type memory expansion device, the management device executes the memory allocation process for the first-level latency balanced-type memory expansion device. The corresponding process may be: the management device determines memory that meets the memory requirement information in the first-level latency balanced-type memory expansion device. If memory that meets the memory requirement information exists in the first-level latency balanced-type memory expansion device, the management device allocates the memory that meets the memory requirement information to the computing device. If no memory that meets the memory requirement information exists in the level-one latency balanced memory expansion device, a memory allocation process for the level-one latency bandwidth memory expansion device is executed. The corresponding process may be: the management device determines memory that meets the memory requirement information in the level-one latency bandwidth memory expansion device, and if memory that meets the memory requirement information exists in the level-one latency bandwidth memory expansion device, the memory that meets the memory requirement information is allocated to the computing device. If no memory that meets the memory requirement information exists in the level-one latency bandwidth memory expansion device, a memory allocation process for the level-two latency capacity memory expansion device is executed. The corresponding process may be: the management device determines memory that meets the memory requirement information in the level-two latency capacity memory expansion device, and if memory that meets the memory requirement information exists in the level-two latency capacity memory expansion device, the memory that meets the memory requirement information is allocated to the computing device. If no memory that meets the memory requirement information exists in the capacity-type memory expansion device with a second-level latency, a memory allocation process for the balanced-type memory expansion device with a second-level latency is executed. The corresponding process may be: the management device determines memory that meets the memory requirement information in the balanced-type memory expansion device with a second-level latency, and if memory that meets the memory requirement information exists in the balanced-type memory expansion device with a second-level latency, the memory that meets the memory requirement information is allocated to the computing device. If no memory that meets the memory requirement information exists in the balanced-type memory expansion device with a second-level latency, a memory allocation process for the bandwidth-type memory expansion device with a second-level latency is executed. The corresponding process may be: the management device determines memory that meets the memory requirement information in the bandwidth-type memory expansion device with a second-level latency, and if memory that meets the memory requirement information exists in the bandwidth-type memory expansion device with a second-level latency, the memory that meets the memory requirement information is allocated to the computing device.
[0255] It is worth noting that in some other possible implementations, the second preset priority order can also be set to other orders, which is not limited in this embodiment of the present application.
[0256] For example, the following is combined Figure 7 The second scenario is described below with examples. Figure 7 A flowchart of memory allocation provided in an embodiment of the present application. Figure 7 In the case where the attribute indicator indicated by the allocation request information is a latency indicator, that is, in the case where a capacity-type memory expansion device is applied for first, the memory allocation process may include:
[0257] S701. A management device receives a memory request from a computing device. The allocation request information carried by the memory request indicates that the attribute indicator is a latency indicator. The memory requirement information carried by the memory request indicates that the memory type is a target type and the memory size is a target capacity.
[0258] That is, the memory request instructs allocation of the memory of the capacity-type memory expansion device of the target type of the target capacity.
[0259] S702: The management device determines whether the remaining memory capacity of the memory expansion device with the target memory type in the CXL memory pool is greater than or equal to the target capacity. If the remaining memory capacity of the memory expansion device with the target memory type in the CXL memory pool is greater than or equal to the target capacity, S703 is executed. If the remaining memory capacity of the memory expansion device with the target memory type in the CXL memory pool is less than the target capacity, a message indicating a memory allocation failure is returned to the computing device.
[0260] S703: The management device determines whether a target memory expansion device exists based on a second preset priority order.
[0261] Exemplarily, the second preset priority order can be: capacity-type memory expansion device with first-level latency, balanced-type memory expansion device with first-level latency, bandwidth-type memory expansion device with first-level latency, capacity-type memory expansion device with second-level latency (or greater than second-level latency), balanced-type memory expansion device with second-level latency (or greater than second-level latency), bandwidth-type memory expansion device with second-level latency (or greater than second-level latency).
[0262] S704: The management device determines whether the target memory expansion device meets the memory requirement information. If so, S705 is executed. If not, a memory allocation failure message is returned to the computing device.
[0263] Exemplarily, it may be determined whether the memory type of the target memory expansion device is the target type and whether the memory size is greater than or equal to the target capacity.
[0264] It should be noted that when executing the judgment process of whether the memory size is greater than or equal to the target capacity in S704, the management device can judge whether the sum of the remaining memory capacities of the multiple target memory expansion devices is greater than or equal to the target capacity based on the sum of the remaining memory capacities of the multiple target memory expansion devices in accordance with the second preset priority order. If so, execute S705 based on the memory of the multiple target memory expansion devices.
[0265] For example, if the remaining memory capacity of the current target memory expansion device is less than the target capacity, the system may determine, according to a second preset priority order, whether the sum of the remaining memory capacities of the current target memory expansion device and the next target memory expansion device is greater than or equal to the target capacity. If so, step S705 is executed based on the memory capacities of the current target memory expansion device and the next target memory expansion device. If not, the system continues to determine whether the sum of the remaining memory capacities of the current target memory expansion device, the next target memory expansion device, and the next target memory expansion device is greater than or equal to the target capacity until a memory device that meets the memory requirement information is determined.
[0266] S705: The management device allocates memory that meets the memory requirement information to the computing device from the target memory expansion device.
[0267] In a possible implementation, after the management device allocates memory that meets the memory requirement information to the computing device from the target memory expansion device, it may also return a message indicating that the memory allocation is successful to the computing device.
[0268] In the above embodiment, the process of allocating memory based on the preset priority order maintained by the management device is described by taking scenario 1 where the attribute indicator is the bandwidth indicator and scenario 2 where the attribute indicator is the delay indicator as examples.
[0269] The following is based on Figure 8 The memory allocation system shown is used to illustrate the process of the memory allocation method provided in the embodiment of the present application. Figure 8 This is an example diagram of a memory allocation system provided in an embodiment of the present application. Figure 8 , with DIMM memory expansion devices (such as Figure 8 Taking the DDR4 or DDR5 shown in the figure as an example, six DIMM memory expansion devices are included: memory expansion device a, memory expansion device b, memory expansion device c, memory expansion device d, memory expansion device e, and memory expansion device f. When classifying and managing a CXL memory pool composed of these multiple DIMM memory expansion devices, attribute information of each DIMM memory expansion device in the CXL memory pool can be collected through an out-of-band channel, as shown in Table 1.
[0270] Table 1
[0271]
[0272] Table 1, using a DIMM memory expansion device as an example, shows the attribute information of multiple DIMM memory expansion devices, including device code (e.g., DIMM code), memory type (e.g., DIMM type), number of memory channels, memory capacity, single-channel bandwidth, latency level, number of device links, and memory speed. The device code uniquely identifies the memory expansion device, such as codes a, b, or c. The memory type refers to the type of memory expansion device within the memory expansion device, such as DDR4 or DDR5. The number of memory channels refers to the total number of memory channels included in the memory expansion device. For example, 1ch indicates one memory channel, and 2ch indicates two memory channels. The latency level can be determined based on the number of CXL switches spanned by the memory expansion device. The number of device links refers to the number of links between the memory expansion device and the CXL switch. For example, the number of links between Host_0 and the CXL switch can be 16, represented by ×16.
[0273] See also Figure 8 ,like Figure 8Memory expansion device a (DDR4@2ch@128GB) uses DDR4 memory and includes two memory channels. Its memory capacity is 128GB. It spans one CXL switch and has eight links to the CXL switches, as represented by ×8. Memory expansion device b (DDR4@1ch@128GB) uses DDR4 memory and includes one memory channel. Its memory capacity is 128GB. It spans one CXL switch and has eight links to the CXL switches, as represented by ×8. Memory expansion device c (DDR5@2ch@128GB) uses DDR5 memory and includes two memory channels. Its memory capacity is 128GB. It spans one CXL switch and has 16 links to the CXL switches, as represented by ×16. Memory expansion device d (DDR5@2ch@128GB) uses DDR5 memory and includes two memory channels. Its memory capacity is 128GB. It spans one CXL switch and has eight links to the CXL switches, as represented by ×8. Memory expansion device e (DDR4@1ch@128GB) uses DDR4 memory and includes one memory channel. Its memory capacity is 128GB. It spans two CXL switches and has eight links to the CXL switches, as represented by ×8. Memory expansion device f (DDR5@2ch@128GB) uses DDR5 memory and includes two memory channels. Its memory capacity is 128GB. It spans two CXL switches and has 16 links to the CXL switches, as represented by ×16.
[0274] Furthermore, according to the attribute information of each DIMM memory expansion device in the above-mentioned multiple DIMM memory expansion devices, the multiple DIMM memory expansion devices are classified to obtain information as shown in Table 2.
[0275] Table 2
[0276]
[0277] Referring to Table 2, taking the ratio of memory capacity to memory bandwidth as the first parameter value to set the first preset condition as an example, the multiple DIMM memory expansion devices can be divided into bandwidth-type memory expansion devices, balanced memory expansion devices, and capacity-type memory expansion devices in turn. Among them, taking the first threshold range of (0, 2] as an example, if the first parameter value of the DIMM memory expansion device is within (0, 2], the category of the DIMM memory expansion device is determined to be a bandwidth-type memory expansion device, such as the category of memory expansion device c and memory expansion device f is a bandwidth-type memory expansion device. Taking the third threshold range of (4, +∞) as an example, if the first parameter value of the DIMM memory expansion device is within (4, +∞), the category of the DIMM memory expansion device is determined to be a capacity-type memory expansion device, such as the category of memory expansion device b and memory expansion device e is a capacity-type memory expansion device. Taking the fifth threshold range of (2, 4] as an example, if the first parameter value of the DIMM memory expansion device is within (2, 4], the category of the DIMM memory expansion device is determined to be a balanced memory expansion device, such as the category of memory expansion device a and memory expansion device d is a balanced memory expansion device.
[0278] After determining the category of each DIMM memory expansion device in the plurality of DIMM memory expansion devices, the following Figure 9 Memory management is performed using the management method shown. For example, Figure 9 This is an example diagram of memory management provided by an embodiment of the present application. Figure 9 , classify memory expansion devices according to different DIMM parameters. Among them, different categories of memory expansion devices can be managed in the form of memory blocks. For example, the memory expansion devices can be divided into 512MB memory blocks for management.
[0279] Furthermore, in Figure 8 In the memory allocation system shown, assume that the Host_0 device requests memory resource allocation from the management device. The requested memory attribute indicator is bandwidth, the memory type is DRAM (DDR4 or DDR5), and the memory size is 2GB. In this case, the code called by the computing device can be void*cxlfabric_alloc(DRAM, BW_Prefer, 2GB). Furthermore, memory allocation using the technical solution provided in the embodiment of the present application can include the following steps 1 to 4.
[0280] Step 1: The management device determines whether the remaining memory capacity of the memory expansion device with DRAM type memory in the CXL memory pool is greater than or equal to 2GB. If the remaining memory capacity of the memory expansion device with DRAM type memory in the CXL memory pool is greater than or equal to 2GB, step 2 is executed. If the remaining memory capacity of the memory expansion device with DRAM type memory in the CXL memory pool is less than 2GB, a message indicating memory allocation failure is returned to the computing device.
[0281] Step 2: The management device obtains the number of links between Host_0 and the CXL memory switch and determines the theoretical bandwidth corresponding to this number of links as Host_0's uplink bandwidth. For example, the number of links between Host_0 and the CXL memory pool is 16, and the theoretical bandwidth corresponding to 16 links is 64 GB / s. The lower limit is set at twice the uplink bandwidth, meaning that Host_0 is allocated a bandwidth greater than or equal to 128 GB / s.
[0282] Step 3: The management device determines whether the target memory expansion device exists based on the bandwidth lower limit of 128 GB / s and the first preset priority order. If so, proceed to Step 4. If not, a memory allocation failure message is returned to the computing device.
[0283] The memory channel bandwidth of the target memory expansion device is greater than or equal to the bandwidth lower limit.
[0284] For example, taking the first preset priority order of: bandwidth-type memory expansion device with first-level latency, balanced-type memory expansion device with first-level latency, bandwidth-type memory expansion device with second-level latency, balanced-type memory expansion device with second-level latency, capacity-type memory expansion device with first-level latency, and capacity-type memory expansion device with second-level latency as an example, it can be prioritized to determine whether the memory channel bandwidth of memory expansion device c is greater than or equal to the bandwidth lower limit. It can be found that the memory channel bandwidth of memory expansion device c (76.8 GB / s) is less than the bandwidth lower limit of 128 GB / s. At this point, it can be further determined whether the memory channel bandwidth of memory expansion device a is greater than or equal to the bandwidth lower limit. It can be found that the memory channel bandwidth of memory expansion device a (51.2 GB / s) is also less than the bandwidth lower limit of 128 GB / s. However, the sum of the memory channel bandwidth of memory expansion device a (51.2 GB / s) and the memory channel bandwidth of memory expansion device c (76.8 GB / s) is 128 GB / s, which meets the bandwidth lower limit. Therefore, the memory expansion device a and the memory expansion device c can be used as target memory expansion devices.
[0285] For example, taking the first preset priority order of: bandwidth-type memory expansion device with level 1 latency, bandwidth-type memory expansion device with level 2 latency, balanced memory expansion device with level 1 latency, balanced memory expansion device with level 2 latency, capacity-type memory expansion device with level 1 latency, and capacity-type memory expansion device with level 2 latency as an example, it can be prioritized to determine whether the memory channel bandwidth of memory expansion device c is greater than or equal to the bandwidth lower limit. It can be found that the memory channel bandwidth of memory expansion device c (76.8 GB / s) is less than the bandwidth lower limit of 128 GB / s. At this point, it can be further determined whether the memory channel bandwidth of memory expansion device f is greater than or equal to the bandwidth lower limit. It can be found that the memory channel bandwidth of memory expansion device f (76.8 GB / s) is also less than the bandwidth lower limit of 128 GB / s. However, the sum of the memory channel bandwidth of memory expansion device c (76.8 GB / s) and the memory channel bandwidth of memory expansion device f (76.8 GB / s) is greater than 128 GB / s, which meets the bandwidth lower limit. Therefore, the memory expansion device c and the memory expansion device f can be used as target memory expansion devices.
[0286] Step 4: The management device determines whether the target memory expansion device meets the memory requirement information. For example, it determines whether the memory type of the target memory expansion device is DRAM and whether the memory size is greater than or equal to 2GB. If the target memory expansion device meets the memory requirement information, 2GB of DRAM-type memory is allocated from the target memory expansion device to the computing device, and a message indicating that the memory allocation was successful is returned to the computing device. If the target memory expansion device does not meet the memory requirement information, a message indicating that the memory allocation failed is returned to the computing device.
[0287] Exemplarily, the management device determines whether the memory expansion device a and the memory expansion device c meet the memory requirement information, such as determining whether the memory type of the memory expansion device a and the memory expansion device c is DRAM type and whether the memory size is greater than or equal to 2GB. It can be found that the memory type of the memory expansion device a is DDR4, the memory type of the memory expansion device c is DDR5, and the remaining memory capacity of the memory expansion device a and the memory expansion device c are both 100GB. The memory expansion device a and the memory expansion device c serve as target memory expansion devices and meet the memory requirement information of the computing device (both the memory type and the memory size are met). Therefore, 1GB of capacity can be applied for from each of the two memory expansion devices and returned to the Host_0 device, that is, the 1GB of memory from the memory expansion device a and the memory expansion device c is returned to the Host_0 device, and a message indicating that the memory allocation is successful is returned to the computing device.
[0288] Exemplarily, the management device determines whether the memory expansion device c and the memory expansion device f meet the memory requirement information, such as determining whether the memory type of the memory expansion device c and the memory expansion device f is DRAM type and whether the memory size is greater than or equal to 2GB. It can be found that the memory type of the memory expansion device c and the memory expansion device f is DDR5, and the remaining memory capacity of the memory expansion device c and the memory expansion device f is 100GB. The memory expansion device c and the memory expansion device f serve as target memory expansion devices and meet the memory requirement information of the computing device (both the memory type and the memory size are met). Therefore, 1GB of capacity can be applied for from each of the two memory expansion devices and returned to the Host_0 device, that is, the 1GB of memory from the memory expansion device c and the memory expansion device f is returned to the Host_0 device, and a message indicating that the memory allocation is successful is returned to the computing device.
[0289] The technical solution provided by the embodiments of the present application carries allocation request information and memory requirement information in the memory request of the computing device. On the one hand, the allocation request information can indicate the attribute indicators of the memory requested by the computing device, such as latency indicator or bandwidth indicator, and on the other hand, the memory requirement information can indicate the memory indicators requested by the computing device, such as memory size and memory type. Furthermore, the management device can determine the target memory expansion device whose category matches the attribute indicators from the CXL memory pool, enabling more targeted memory allocation, thereby meeting the computing device's needs for memory with different attributes and improving the accuracy of memory allocation. Moreover, in the CXL memory pool, the categories of each memory expansion device in the CXL memory pool are divided according to the memory capacity and memory bandwidth corresponding to the memory expansion device, enabling refined management of the CXL memory pool. When allocating memory, the target memory expansion device whose category matches the allocation request information can be quickly and efficiently determined based on the memory expansion device category dimension, and then the memory resources in the target memory expansion device can be allocated to the computing device, thereby improving not only the efficiency of memory allocation but also the accuracy of memory allocation.
[0290] The above mainly introduces the scheme of the embodiment of the present application from the perspective of method. It is understandable that the computing device (such as server) in the embodiment of the present application includes a hardware structure and / or software module corresponding to the execution of each function in order to realize the above functions. Those skilled in the art should easily appreciate that, in conjunction with the units and algorithm steps of each example described in the embodiment disclosed herein, the embodiment of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in a way that hardware or computer software drives 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 embodiment of the present application.
[0291] Figure 10 This is a structural diagram of a memory allocation device provided in an embodiment of the present application. Figure 10 The memory allocation device includes a receiving module 1001, a determining module 1002 and an allocating module 1003.
[0292] Receiving module 1001 is configured to receive a memory request from a computing device; wherein the memory request includes allocation request information and memory requirement information, wherein the allocation request information indicates an attribute indicator of a memory expansion device requested by the computing device, wherein the attribute indicator is a latency indicator or a bandwidth indicator; and the memory requirement information indicates a memory indicator requested by the computing device, wherein the memory indicator includes a memory size and a memory type.
[0293] A determination module 1002 is configured to determine a target memory expansion device whose category matches the attribute indicator from the CXL memory pool;
[0294] The allocation module 1003 is configured to allocate memory that meets the memory requirement information to the computing device from the target memory expansion device.
[0295] The technical solution provided by the embodiment of the present application carries allocation request information and memory requirement information in the memory request of the computing device. On the one hand, the allocation request information can be used to indicate the attribute indicators of the memory expansion device requested by the computing device, such as latency indicator or bandwidth indicator. On the other hand, the memory requirement information can be used to indicate the memory indicators requested by the computing device, such as memory size and memory type. Furthermore, the management device can determine the target memory expansion device with category matching attribute indicators from the CXL memory pool, which can achieve more targeted memory allocation, thereby meeting the computing device's demand for memory with different attributes. Memory that meets the memory requirement information is then allocated to the computing device from the target memory expansion device, which not only improves the efficiency of memory allocation, but also effectively improves the accuracy of memory allocation.
[0296] In some possible implementations, the apparatus further includes a classification module, configured to:
[0297] In the CXL memory pool, the category of each memory expansion device is determined based on the memory capacity and memory bandwidth of each memory expansion device; wherein the memory bandwidth is the smallest value between the memory channel bandwidth and the memory link bandwidth;
[0298] The categories of the memory expansion device include bandwidth type memory expansion device, capacity type memory expansion device and balanced type memory expansion device.
[0299] In some possible implementations, the bandwidth-type memory expansion device refers to a memory expansion device in which a ratio of the memory capacity to the memory bandwidth satisfies a first preset condition;
[0300] The capacity-type memory expansion device refers to a memory expansion device in which the ratio of the memory capacity to the memory bandwidth meets a second preset condition;
[0301] The balanced memory expansion device refers to a memory expansion device in which the ratio of the memory capacity to the memory bandwidth meets a third preset condition.
[0302] In some possible implementations, the memory requirement information indicates that the requested memory size is a target capacity and the memory type is a target type; the determination module 1002 is further configured to determine whether the remaining memory capacity of the memory expansion device having the target type memory in the CXL memory pool is greater than the target capacity.
[0303] In some possible implementations, when the attribute indicator indicated by the allocation request information is a bandwidth indicator, the determining module 1002 is specifically configured to: obtain the uplink bandwidth of the computing device, and determine a lower limit of the bandwidth allocated to the computing device based on the uplink bandwidth; the uplink bandwidth of the computing device is determined based on the number of links between the computing device and the CXL switch;
[0304] Based on the bandwidth lower limit and a first preset priority order, it is determined whether the target memory expansion device exists; wherein the first preset priority order is used to indicate the order of priority from high to low for allocating different categories of memory expansion devices when the attribute indicator is a bandwidth indicator.
[0305] In some possible implementations, the first preset priority order is: bandwidth-type memory expansion device with first-level latency, balanced-type memory expansion device with first-level latency, bandwidth-type memory expansion device with second-level latency, balanced-type memory expansion device with second-level latency, capacity-type memory expansion device with first-level latency, and capacity-type memory expansion device with second-level latency.
[0306] In some possible implementations, when the attribute indicator indicated by the allocation request information is a latency indicator, the determination module 1002 is specifically used to: determine whether the target memory expansion device exists based on a second preset priority order; wherein, the second preset priority order is used to indicate that when the attribute indicator is a latency indicator, the priority of different categories of memory expansion devices is allocated in order from high to low.
[0307] In some possible implementations, the second preset priority order is: capacity-type memory expansion device with first-level latency, balanced-type memory expansion device with first-level latency, bandwidth-type memory expansion device with first-level latency, capacity-type memory expansion device with second-level latency, balanced-type memory expansion device with second-level latency, and bandwidth-type memory expansion device with second-level latency.
[0308] In some possible implementations, the allocation module 1003 is specifically configured to:
[0309] Determining whether the capacity of the target type of memory of the target memory expansion device is greater than or equal to the target capacity;
[0310] In a case where the capacity of the target type of memory of the target memory expansion device is greater than or equal to the target capacity, memory of the target capacity is allocated to the computing device from the target memory expansion device.
[0311] The present application also provides an electronic device including a processor and a memory, wherein the processor and the memory are coupled, wherein the memory is used to store computer program instructions, and the processor is used to call the computer program instructions in the memory to execute the memory allocation method shown in the above embodiment.
[0312] An embodiment of the present application further provides a computer-readable storage medium, which stores computer program instructions, and the computer program instructions are used to enable an electronic device to execute the memory allocation method shown in the above embodiment.
[0313] An embodiment of the present application also provides a computer program product, including computer program instructions. When the computer program instructions are executed on an electronic device, the electronic device executes the memory allocation method shown in the above embodiment.
[0314] The electronic device, computer-readable storage medium, or computer program product provided in the embodiments of the present application are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects of the corresponding methods provided above, and will not be repeated here.
[0315] Through the description of the above implementation methods, those skilled in the art can clearly understand that for the convenience and brevity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device (such as an electronic device) is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device (such as an electronic device) and unit described above can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.
[0316] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices (such as electronic devices) and methods can be implemented in other ways. For example, the device (such as electronic device) embodiments described above are merely 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 system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0317] The units described above as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0318] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0319] If the above-mentioned 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 computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the method of each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as flash memory, mobile hard disk, read-only memory, random access memory, magnetic disk or optical disk.
[0320] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A memory allocation method, characterized in that: The method comprises: In a computing fast link CXL memory pool, the category of each memory expansion device is determined based on the memory bandwidth and memory capacity of each memory expansion device; wherein the memory bandwidth is the smallest of the memory channel bandwidth and the memory link bandwidth; the categories of the memory expansion devices include bandwidth-type memory expansion devices, capacity-type memory expansion devices, and balanced memory expansion devices; the bandwidth-type memory expansion device refers to a memory expansion device whose ratio of the memory capacity to the memory bandwidth meets a first preset condition; the capacity-type memory expansion device refers to a memory expansion device whose ratio of the memory capacity to the memory bandwidth meets a second preset condition; the balanced memory expansion device refers to a memory expansion device whose ratio of the memory capacity to the memory bandwidth meets a third preset condition; the bandwidth-type memory expansion device, the capacity-type memory expansion device, and the balanced memory expansion device all carry a latency level of memory latency, and the latency level includes a first-level latency and a second-level latency; Receive a memory request from a computing device; wherein the memory request includes allocation request information and memory requirement information, the allocation request information is used to indicate an attribute indicator of a memory expansion device requested by the computing device, the attribute indicator being a latency indicator or a bandwidth indicator; the memory requirement information is used to indicate a memory indicator requested by the computing device, the memory indicator including a memory size and a memory type; the latency indicator is used to indicate a latency requirement for the requested memory expansion device, and the bandwidth indicator is used to indicate a bandwidth requirement for the requested memory expansion device; Determine a target memory expansion device whose category matches the attribute indicator from the CXL memory pool; wherein, when the attribute indicator is a latency indicator, determine whether the target memory expansion device exists based on a second preset priority order; wherein, when the attribute indicator is a latency indicator, assign priorities of different categories of memory expansion devices in descending order; the second preset priority order is: capacity-type memory expansion device with first-level latency, balanced-type memory expansion device with first-level latency, bandwidth-type memory expansion device with first-level latency, capacity-type memory expansion device with second-level latency, balanced-type memory expansion device with second-level latency, bandwidth-type memory expansion device with second-level latency; the latency indicated by the first-level latency is less than the latency indicated by the second-level latency; Memory that meets the memory requirement information is allocated to the computing device from the target memory expansion device.
2. The method according to claim 1, characterized in that The memory requirement information indicates that the requested memory size is a target capacity, and the memory type is a target type; Before determining a target memory expansion device whose type matches the attribute indicator from the CXL memory pool, the method further includes: It is determined that the remaining memory capacity of the memory expansion device having the target type of memory in the CXL memory pool is greater than the target capacity.
3. The method according to claim 2, characterized in that In a case where the attribute indicator indicated by the allocation request information is a bandwidth indicator, determining a target memory expansion device whose category matches the attribute indicator from the CXL memory pool includes: Obtaining an uplink bandwidth of the computing device, and determining a lower limit of bandwidth allocated to the computing device based on the uplink bandwidth; the uplink bandwidth of the computing device is determined based on the number of links between the computing device and the CXL switch; Based on the bandwidth lower limit and a first preset priority order, it is determined whether the target memory expansion device exists; wherein the first preset priority order is used to indicate the order of priority from high to low for allocating different categories of memory expansion devices when the attribute indicator is a bandwidth indicator.
4. The method according to claim 3, characterized in that The first preset priority order is: bandwidth-type memory expansion device with first-level latency, balanced-type memory expansion device with first-level latency, bandwidth-type memory expansion device with second-level latency, balanced-type memory expansion device with second-level latency, capacity-type memory expansion device with first-level latency, and capacity-type memory expansion device with second-level latency.
5. The method according to any one of claims 2 to 4, characterized in that: Allocating memory that meets the memory requirement information to the computing device from the target memory expansion device includes: determining whether a capacity of a target type of memory of the target memory expansion device is greater than or equal to the target capacity; In a case where the capacity of the target type of memory of the target memory expansion device is greater than or equal to the target capacity, memory of the target capacity is allocated to the computing device from the target memory expansion device.
6. An electronic device, characterized in that: The electronic device includes a processor and a memory; the processor and the memory are coupled; The memory is used to store computer program instructions; The processor is configured to call the computer program instructions in the memory to execute the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Data migration method and computing device
CN116521608A
Memory management method, system and related device
CN116560826A
Memory extension method and device, server system, electronic equipment and storage medium
CN117555687A