Resource management method and apparatus, electronic device, and storage medium
By introducing bridging devices into the resource management system, directly processing memory application and release commands, the problem of increasing memory access delay in the prior art is solved and system performance is improved.
Patent Information
- Application Number
- PCT/CN2024/122027
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-02-06
- Filing Date
- 2024-09-27
- Publication Date
- 2025-08-14
AI Technical Summary
In the prior art, the memory resource management method after computing high-speed link technology (CXL) is adopted to increase memory access delay and reduce system performance.
By introducing bridge devices into the resource management system, using instruction analysis modules, memory mapping tables and switch matrix modules, they directly process the host's memory application and release commands, realizing direct allocation or release of resources, and avoiding command analysis and management through the master host.
Reduces the processing time required for resource allocation or release, and improves the performance of the resource management system.
Smart Images

Figure CN2024122027_14082025_PF_FP_ABST
Abstract
Description
Resource management method, device, electronic device and storage medium
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to the Chinese patent application filed with the China Patent Office on February 6, 2024, with application number 202410166870.X, and application name “Resource Management Method, Device, Electronic Device and Storage Medium”, all contents of which are incorporated by reference into this application. Technical Field
[0003] The present application belongs to the field of computer storage technology, and in particular relates to a resource management method, device, electronic device, and non-volatile readable storage medium. Background Art
[0004] With the increasing demand for data center storage and data processing, in order to meet resource requirements, it is necessary to optimize and restructure the server hardware architecture. Compute Express Link (CXL) technology is often used to achieve memory capacity and bandwidth expansion and memory pooling to improve resource utilization and reduce maintenance costs.
[0005] In the related art, as shown in Figure 1, in the memory resource management method after applying CXL technology, a master host is often set up to uniformly manage and allocate all memory resources in the system. However, since all hosts in the system (hosts 1-N) need to initiate requests to the master host to obtain or release resources, this resource management method will cause the memory access delay to increase, thereby reducing system performance.
[0006] Summary of the Invention
[0007] To overcome the problems existing in the related art, the present application provides a resource management method, device, electronic device and non-volatile readable storage medium.
[0008] In a first aspect, the present application provides a resource management method, which is applied to a bridge device based on computing high-speed link technology in a resource management system, wherein the bridge device is used to establish a connection between a host and a memory device in the resource management system, and the bridge device includes an instruction parsing module, a memory mapping table, and a switch matrix module; the method includes:
[0009] In response to a target command sent by the host, the command type corresponding to the target command is determined by the instruction parsing module; the command type includes a memory request command and a memory release command;
[0010] In the case where the target command is a memory request command, determining a first target resource to be allocated to the host based on a memory mapping table, and enabling a first channel between the first target resource and the host based on a switch matrix module; the memory mapping table is used to represent memory allocation and usage of a memory device;
[0011] In a case where the target command is a memory release command, a second target resource indicated by the memory release command is determined, and a second channel between the second target resource and the host is closed based on the switch matrix module.
[0012] In some embodiments of the present application, the method further comprises:
[0013] Obtain device information corresponding to the memory device; the device information includes the device capacity, device starting address and device identifier corresponding to the memory device;
[0014] According to the continuous allocation rule, address space is allocated to memory devices in advance.
[0015] In some embodiments of the present application, in response to a target command sent by a host, determining, by an instruction parsing module, a command type corresponding to the target command includes:
[0016] In a case where the designated field in the target command is the first field, determining, through the instruction parsing module, that the command type corresponding to the target command is a memory allocation command;
[0017] In a case where the designated field in the target command is the second field, the instruction parsing module determines that the command type corresponding to the target command is a memory release command.
[0018] In some embodiments of the present application, determining the first target resource to be allocated to the host based on the memory mapping table includes:
[0019] Obtain a memory mapping table, and obtain memory allocation information based on the memory mapping table;
[0020] Based on the memory allocation information and the memory application information carried by the target command, a first target resource is determined in the memory resources corresponding to the memory device.
[0021] In some embodiments of the present application, the method further comprises:
[0022] Based on the first granularity, memory resources corresponding to the memory device are divided into at least two memory blocks;
[0023] For any memory block, the memory block is divided into at least two sub-memory blocks based on a second granularity; the first granularity is greater than the second granularity.
[0024] In some embodiments of the present application, the requested memory information includes the requested memory size; and determining the first target resource from the memory resources corresponding to the memory device based on the memory allocation information and the requested memory information carried by the target command includes:
[0025] Determine a memory block to be allocated and a sub-memory block to be allocated based on the memory allocation information;
[0026] In a case where the memory size of the target sub-memory block in the sub-memory blocks to be allocated is greater than or equal to the requested memory size, determining the target sub-memory block as the first target resource;
[0027] When the memory size of any to-be-allocated sub-memory block is smaller than the requested memory size and the memory size of the target memory block in the to-be-allocated memory block is greater than or equal to the requested memory size, the target memory block is determined as the first target resource.
[0028] In some embodiments of the present application, determining a first target resource from memory resources corresponding to a memory device based on the memory allocation information and the memory request information carried by the target command further includes:
[0029] When the memory size of any sub-memory block to be allocated and any memory block to be allocated is smaller than the applied memory size, the designated memory resource is determined as the first target resource; the designated memory resource includes at least two sub-memory blocks to be allocated, at least two memory blocks to be allocated, or at least two memory blocks to be allocated and a sub-memory block to be allocated.
[0030] In some embodiments of the present application, after determining the first target resource to be allocated to the host based on the memory mapping table, and enabling the first channel between the first target resource and the host based on the switch matrix module, the method further includes:
[0031] Based on the first tag, marking the first target resource in the memory mapping table as allocated;
[0032] The memory mapping table is updated based on the first resource information corresponding to the first target resource.
[0033] In some embodiments of the present application, the first resource information includes a host identifier corresponding to the host, a starting address corresponding to the first target resource, a memory device identifier corresponding to the first target resource, and an applied memory size.
[0034] In some embodiments of the present application, gating the first channel between the first target resource and the host based on the switch matrix module includes:
[0035] Sending a first signal to the switch matrix module;
[0036] The first signal is used to select a first channel between the first target resource and the host.
[0037] In some embodiments of the present application, the first target resource is used for the host to access and write the first target resource.
[0038] In some embodiments of the present application, the method further comprises:
[0039] The use status information of at least two memory blocks and at least two sub-memory blocks in the resource management system is obtained periodically, and a memory mapping table is updated based on the use status information.
[0040] In some embodiments of the present application, the method further comprises:
[0041] A designated memory block in at least two memory blocks or a designated sub-memory block in at least two sub-memory blocks is configured as a shared memory space; the shared memory space is used for data forwarding by at least two hosts.
[0042] In some embodiments of the present application, determining the second target resource indicated by the memory release command, and closing the second channel between the second target resource and the host based on the switch matrix module includes:
[0043] Obtaining memory address information for indicating a second target resource carried by the target command;
[0044] Based on the memory address information, the second channel between the second target resource and the host is closed through the switch matrix module.
[0045] In some embodiments of the present application, after determining the second target resource indicated by the memory release command and closing the second channel between the second target resource and the host based on the switch matrix module, the method further includes:
[0046] Based on the second tag, marking the second target resource in the memory mapping table as unallocated;
[0047] Delete the second resource information corresponding to the second target resource in the memory mapping table.
[0048] In some embodiments of the present application, closing the second channel between the second target resource and the host through the switch matrix module based on the memory address information includes:
[0049] Based on the memory address information, a second target resource is determined, and a second signal is sent to the switch matrix module; the second signal is used to close a second channel between the second target resource and the host.
[0050] In some embodiments of the present application, the method further comprises:
[0051] If it is detected that any allocated memory block or allocated sub-memory block is not occupied within a preset time period, a release request is sent to a target host corresponding to the allocated memory block or allocated sub-memory block;
[0052] Among them, the allocated memory block is a memory block marked with a first label in the memory mapping table, and the allocated sub-memory block is a sub-memory block marked with a first label in the memory mapping table; the release request is used to request the target host to send a memory release command for the allocated memory block or the allocated sub-memory block to the bridge device.
[0053] In a second aspect, the present application provides a resource management device, which is a bridge device based on computing high-speed link technology and is applied to a resource management system. The bridge device is used to establish a connection between a host and a memory device in the resource management system. The bridge device includes an instruction parsing module, a memory mapping table, and a switch matrix module. The device includes:
[0054] A first determining module is configured to respond to a target command sent by the host and determine a command type corresponding to the target command through the instruction parsing module; the command type includes a memory request command and a memory release command;
[0055] a second determining module configured to, when the target command is a memory request command, determine a first target resource to be allocated to the host based on a memory mapping table, and to enable a first channel between the first target resource and the host based on a switch matrix module; the memory mapping table being used to represent memory allocation and usage of a memory device;
[0056] The third determining module is used to determine the second target resource indicated by the memory release command when the target command is a memory release command, and close the second channel between the second target resource and the host based on the switch matrix module.
[0057] In a third aspect, the present application provides an electronic device comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the resource management method of any one of the above-mentioned first aspects is implemented.
[0058] In a fourth aspect, the present application provides a non-volatile readable storage medium. When the instructions in the non-volatile readable storage medium are executed by a processor of an electronic device, the electronic device can execute the steps in the resource management method in any embodiment of the first aspect above.
[0059] In an embodiment of the present application, a bridge device responds to a target command sent by a host and determines the command type corresponding to the target command; the command type includes a memory request command and a memory release command; when the target command is a memory request command, based on a memory mapping table, a first target resource allocated to the host is determined and a first channel between the first target resource and the host is selected; the memory mapping table is used to characterize the memory allocation and usage of the memory device; when the target command is a memory release command, a second target resource indicated by the memory release command is determined and a second channel between the second target resource and the host is closed. In this way, by using the bridge device as the core of resource management and allocation in the entire resource management system, the target command sent by the host is directly processed and parsed by the bridge device, and the bridge device implements direct allocation or release of resources. Compared with command parsing and resource allocation and management by the master host, the resource management method provided by the embodiment of the present application can reduce the processing time required for resource allocation or release, thereby improving the performance of the resource management system to a certain extent. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0061] FIG1 is a schematic diagram of a resource management method in the prior art provided by an embodiment of the present application;
[0062] FIG2 is a flowchart of the steps of a resource management method provided in an embodiment of the present application;
[0063] FIG3 is a schematic diagram of the architecture of a resource management system provided in an embodiment of the present application;
[0064] FIG4 is a flowchart of the specific steps of a resource management method provided in an embodiment of the present application;
[0065] FIG5 is a structural diagram of a resource management device provided in an embodiment of the present application;
[0066] FIG6 is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0067] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0068] FIG2 is a flowchart of the steps of a resource management method provided in an embodiment of the present application, which is applied to a bridging device based on computing high-speed link technology in a resource management system.
[0069] In an embodiment of the present application, the resource management system may include a bridging device based on computing express link technology (such as CXL SWITCH (Compute Express Link Switch)), a host and a memory device. The bridging device may connect the host and the memory device based on CXL technology to obtain a memory resource pool to achieve memory resource pooling. The bridging device may also be referred to as a switch, and the bridging device may be configured with modules such as an instruction parsing module, a resource management module, a memory mapping table, and a switch matrix module. The instruction parsing module may be used to process and parse the target command received by the bridging device, the resource management module may be used to allocate, record, recycle and manage resources, the memory mapping table is used to record the memory allocation and usage corresponding to multiple memory devices, and the switch matrix module is used to enable or disable the physical connection between the host and the memory resources. The host can be any CXL master device, including a CPU (Central Processing Unit), a GPU (Graphics Processing Unit), or a compute unit. All requests sent by hosts in the resource management system can be uniformly processed by the bridge device. The memory device can be any CXL extended memory (MEM), specifically maintained by the resource management module. For example, Figure 3 shows a schematic diagram of the architecture of a resource management system. As shown in Figure 3, a bridge device (e.g., CXL SWITCH 2.0) includes an instruction parsing module, a resource management module, a memory mapping table, and a switch matrix module. The bridge device is used to connect hosts 1-N with memory devices 1-M.
[0070] In one possible implementation, a bridging device based on computing high-speed link technology may be deployed in a field programmable gate array (FPGA). That is, the resource management method provided in the embodiment of the present application may be implemented based on a field programmable gate array (FPGA).
[0071] As shown in FIG2 , the method may include:
[0072] Step 101: In response to a target command sent by a host, a command type corresponding to the target command is determined by an instruction parsing module; the command types include a memory request command and a memory release command.
[0073] In an embodiment of the present application, when a host needs to acquire or release memory resources, a target command may be sent to the bridge device. It is understood that when the host needs to acquire memory resources, the target command sent to the bridge device is a memory request command; when the host needs to release memory resources, the target command sent to the bridge device is a memory release command. Furthermore, the memory request command may carry memory request information for the memory resources that the host needs to acquire, and similarly, the memory release command may carry memory address information corresponding to the memory resources that the host needs to release.
[0074] The bridge device can receive CXL.IO (CXL input / output interface) data packets based on the port, such as target commands. Each port can be set with a first-in-first-out (FIFO) rule to avoid the situation where multiple hosts send target commands at the same time, resulting in data packet loss. The bridge device responds to the target command sent to the bridge device by any host in the resource management system. The target command can be parsed by the instruction parsing module to determine the command type corresponding to the target command. Among them, the command type corresponding to the target command may include a memory request command and a memory release command. The memory request command is used to request the acquisition of resources in a resource pool composed of multiple memory devices, and the memory release command is used to request the release of specified resources (such as a second target resource) in a resource pool composed of multiple memory devices. Furthermore, the memory request command may include a read command and / or a write command, which is not limited in the embodiment of the present application.
[0075] Step 102: When the target command is a memory request command, determine the first target resource to be allocated to the host based on a memory mapping table, and select the first channel between the first target resource and the host based on a switch matrix module; the memory mapping table is used to characterize the memory allocation and usage of the memory device.
[0076] In an embodiment of the present application, if the bridge device determines that the target command is a memory request command, it further parses the target command to determine the memory request information indicated by the target command. The memory request information is used to represent the host's demand for memory resources. For example, the memory request information can be used to describe the memory capacity requested by the host. Based on a memory mapping table, a first target resource that satisfies the memory request information and needs to be allocated to the host is determined. The memory mapping table can record memory allocation and usage information corresponding to multiple memory devices, including markings for allocated and unallocated memory resources, memory device information and memory information corresponding to the memory resources, allocation information corresponding to allocated memory resources, usage information corresponding to used memory resources, and historical allocation information corresponding to unallocated memory resources. After the bridge device determines the first target resource to be allocated to the host, it can, based on a switch matrix module in the bridge device, enable a first channel between the first target resource and the host to establish a physical connection between the host that sent the memory request command and the memory device corresponding to the first target resource, thereby completing resource allocation for the host. The first channel can refer to an electrical signal path. It is understandable that after the first channel between the first target resource and the host is enabled, the host can communicate with the downstream allocated memory device through a communication protocol (such as the CXL.MEM protocol) to access and write the first target resource.
[0077] Step 103: When the target command is a memory release command, determine a second target resource indicated by the memory release command, and close a second channel between the second target resource and the host based on the switch matrix module.
[0078] In an embodiment of the present application, when the bridging device determines that the target command is a memory release command, the target command is further parsed to determine the memory information corresponding to the second target resource indicated by the target command, wherein the memory information may include memory identification information or memory address information corresponding to the second target resource, etc., which is used to find and determine the resource index information of the second target resource. In other words, the memory information corresponding to the second target resource is used to determine the second target resource requested to be released by the host from the memory resource pool formed in the resource management system. When the second target resource is determined, based on the switch matrix module in the bridging device, the second channel between the second target resource and the host is closed to close the physical connection between the host that sends the memory release command and the memory device corresponding to the second target resource, thereby completing the release of the second target resource. The second channel may refer to an electrical signal path.
[0079] In summary, in the embodiment of the present application, the bridge device responds to the target command sent by the host to determine the command type corresponding to the target command; the command type includes a memory request command and a memory release command; when the target command is a memory request command, based on the memory mapping table, the first target resource allocated to the host is determined and the first channel between the first target resource and the host is selected; the memory mapping table is used to characterize the memory allocation and usage of the memory device; when the target command is a memory release command, the second target resource indicated by the memory release command is determined and the second channel between the second target resource and the host is closed. In this way, by using the bridge device as the core of resource management and allocation in the entire resource management system, the target command sent by the host is directly processed and parsed by the bridge device, and the bridge device implements direct allocation or release of resources. Compared with command parsing and resource allocation and management through the master host, the resource management method provided in the embodiment of the present application can reduce the processing time required for resource allocation or release, and improve the performance of the resource management system to a certain extent.
[0080] In some embodiments of the present application, the embodiments of the present application further include the following steps:
[0081] Step 201: Obtain device information corresponding to the memory device; the device information includes the device capacity, device starting address, and device identification corresponding to the memory device.
[0082] In an embodiment of the present application, device information corresponding to each memory device in the resource management system is obtained, where the device information may include the device capacity, device starting address, and device identifier corresponding to each memory device. The device capacity is the actual capacity corresponding to the memory device, the device starting address is the starting address information corresponding to the memory resource in the memory device, and the device identifier is the identification information corresponding to the memory device, such as the device number.
[0083] Step 202: pre-allocate address space for the memory device according to the continuous allocation rule.
[0084] In an embodiment of the present application, after the hardware device is physically powered on, physical link initialization is performed. By traversing the number of downstream memory devices and reading the configuration space on the memory device in sequence, the starting address, size, and other information corresponding to each memory device are set according to the configuration space and registered in the resource management system. Specifically, a continuous address space can be allocated in advance for each memory device in the resource management system according to a continuous allocation rule. The continuous allocation rule can include continuous and unified addressing of multiple memory devices based on the memory capacity corresponding to each of the multiple memory devices in the resource management system. For example, all memory devices in the resource management system are continuously allocated address space according to their capacity. Assuming there are three 1GB (Gigabyte) memory devices, namely: A, B, and C, the address space of memory device A can be 0x0000_0000-0x400_0000, the address space of memory device B can be 0x4000_0000–0x800_0000, and the address space of memory device C can be 0x8000_0000–0xC000_0000.
[0085] In an embodiment of the present application, by pre-allocating address space for each memory device according to a continuous allocation rule, the memory devices in the resource management system can be uniformly addressed, avoiding the failure of subsequent resource allocation and release processes due to memory address conflicts, and improving the convenience of memory resource allocation and release.
[0086] In some embodiments of the present application, step 101 may include the following steps:
[0087] Step 301: When the designated field in the target command is the first field, the instruction parsing module determines that the command type corresponding to the target command is a memory allocation command.
[0088] In an embodiment of the present application, since the data transmission in the resource management system follows the CXL protocol and the data packet has a standard data format, the command type corresponding to the target command can be determined based on the field content in the target command. In the case where the designated field in the target command is the first field, the instruction parsing module can determine the command type corresponding to the target command as a memory request command. Among them, the designated field can be a type type field, and the first field can be a field representing the resource allocation request. Exemplarily, the first field can include 000 or 001, wherein the field "000" can represent a read command, and the field "001" can represent a write command.
[0089] Step 302: When the designated field in the target command is the second field, the instruction parsing module determines that the command type corresponding to the target command is a memory release command.
[0090] In an embodiment of the present application, when the designated field in the target command is the second field, the instruction parsing module may determine the command type corresponding to the target command as a memory release command. The designated field may be a type field, and the second field may be a field representing a request to release resources. For example, the second field may include 010, where the field "010" may represent a memory release command.
[0091] In the embodiment of the present application, the command type corresponding to the target command can be determined by specifying the field in the target command, thereby improving the efficiency of determining the type of the target command.
[0092] In some embodiments of the present application, step 102 may include the following steps:
[0093] Step 401: Obtain a memory mapping table, and obtain memory allocation information based on the memory mapping table.
[0094] In the embodiment of the present application, since the memory mapping table is used to characterize the memory allocation and usage of multiple memory devices, the memory allocation information and memory usage information will be recorded in the memory mapping table. The memory mapping table can map the memory allocation and application between each host and each memory device through table entries. Among them, the memory allocation information may include information such as the host identifier, the memory allocation starting address and memory capacity size corresponding to the host (that is, the starting address and memory capacity size corresponding to the memory resources allocated to the host), the memory device identifier, etc., and the memory usage information may include information such as the usage of the allocated memory resources (including memory resources of different granularities obtained by division).
[0095] Step 402: Based on the memory allocation information and the memory request information carried by the target command, determine a first target resource in the memory resources corresponding to the memory device.
[0096] In an embodiment of the present application, when the host sends a target command to the bridge device, the target command will carry information representing the actual resource requirements of the host. In the case where this target command is a memory request command, the target command carries memory request information. The memory request information is used to represent the memory resource information that the host needs to apply for, including memory size or memory identification, etc. Therefore, based on the memory request information and the memory allocation information corresponding to the memory mapping table, the first target resource can be determined in the memory resources corresponding to the memory device. Exemplarily, the memory resources that are currently in an idle state can be judged based on the memory allocation information, and then according to the memory request information corresponding to the target command sent by the host, the memory resource that meets the memory resource size represented by the memory request information is selected from the memory resources in the idle state as the first target resource.
[0097] In the embodiment of the present application, memory allocation information is determined based on the memory mapping table, the current memory allocation status is obtained, and then the first target resource to be allocated to the host is determined based on the memory allocation information and the memory request information. In this way, the available first target resource to be allocated to the host can be determined based on the actual memory allocation status in the memory device, thereby improving resource allocation efficiency to a certain extent.
[0098] In some embodiments of the present application, the embodiments of the present application further include the following steps:
[0099] Step 501: Divide memory resources corresponding to a memory device into at least two memory blocks based on a first granularity.
[0100] In an embodiment of the present application, the memory resources corresponding to the memory device can be divided into memory blocks of different granularities. Based on a first granularity, the memory resources corresponding to the memory and device are divided into at least two memory blocks. Specifically, the memory granularity division can be based on bits.
[0101] Step 502: For any memory block, divide the memory block into at least two sub-memory blocks based on a second granularity; the first granularity is greater than the second granularity.
[0102] In an embodiment of the present application, a fine-grained division is further performed on the memory blocks obtained by the division based on the first granularity. For any memory block, the memory block is further divided into at least two sub-memory blocks based on the second granularity. In other words, memory resources can be divided based on different granularities. Accordingly, in the process of allocating and managing memory resources, resource allocation and management can be performed based on the divided memory blocks or sub-memory blocks. It is understandable that the sub-memory blocks are obtained by further dividing the memory blocks. Therefore, the first granularity can be greater than the second granularity to achieve coarse-grained and fine-grained division of memory resources.
[0103] In one possible implementation, the first granularity may include granularities that meet a first granularity threshold, and correspondingly, the second granularity may include granularities that meet a second granularity threshold, where the minimum threshold value among the first granularity threshold values is greater than the maximum threshold value among the second granularity threshold values. In other words, the memory resources corresponding to the memory device may be divided based on different granularity standards to obtain multiple memory blocks of different granularity sizes. Furthermore, the memory blocks may be further divided based on different granularity standards to obtain multiple sub-memory blocks of different granularity sizes.
[0104] In an embodiment of the present application, memory resources are divided based on different granularities (first granularity and second granularity), which can provide diversified memory resource selection in the process of resource management. By dividing the memory blocks, when the memory size requested by the host is large, resource allocation is facilitated, and by dividing the memory blocks into sub-blocks, when the memory size requested by the host is small, allocating sub-memory blocks to the host can avoid resource waste and improve resource utilization.
[0105] In some embodiments of the present application, the requested memory information includes the requested memory size.
[0106] Accordingly, step 402 may include the following steps:
[0107] Step 601: Determine a memory block to be allocated and a sub-memory block to be allocated based on memory allocation information.
[0108] In an embodiment of the present application, based on the memory allocation information, free memory blocks or sub-memory blocks in the memory resources corresponding to the memory device are determined, and are respectively determined as memory blocks to be allocated and sub-memory blocks to be allocated. Specifically, based on the host identifiers corresponding to the allocated memory blocks and sub-memory blocks in the memory allocation information, memory blocks or sub-memory blocks that do not have a corresponding host identifier can be determined as free memory blocks or free sub-memory blocks.
[0109] Step 602: If the memory size of the target sub-memory block in the sub-memory blocks to be allocated is greater than or equal to the requested memory size, determine the target sub-memory block as the first target resource.
[0110] In an embodiment of the present application, when there is a target sub-memory block in the sub-memory blocks to be allocated whose memory size is greater than or equal to the requested memory size, indicating that the target sub-memory block can provide the memory size required by the host, the target sub-memory block can be directly determined as the first target resource. It is understandable that when there are multiple target sub-memory blocks in the sub-memory blocks to be allocated, the target sub-memory block corresponding to the memory device with the highest idleness can be determined as the first target resource based on the idle state of the memory devices corresponding to each target sub-memory block, wherein the idleness of the memory device is positively correlated with the number of sub-memory blocks to be allocated corresponding to the memory device, and a high idleness can be a large number of sub-memory blocks to be allocated contained in the memory device.
[0111] Step 603: If the memory size of any to-be-allocated sub-memory block is smaller than the requested memory size and the memory size of the target memory block in the to-be-allocated memory block is greater than or equal to the requested memory size, determine the target memory block as the first target resource.
[0112] In an embodiment of the present application, in the case that there is no sub-memory block to be allocated that meets the requested memory size, further judgment can be made based on the memory block to be allocated. When the memory size of the target memory block in the memory block to be allocated is greater than or equal to the requested memory size, it is characterized that the target memory block can provide the memory size required by the host, and then the target memory block can be determined as the first target resource. It is understandable that in the case that there are multiple target memory blocks in the memory block to be allocated, the target memory block corresponding to the memory device with a high idleness can be determined as the first target resource based on the idle state of the memory devices corresponding to each target memory block, wherein the idleness of the memory device is positively correlated with the number of memory blocks to be allocated corresponding to the memory device, and the high idleness can be that the number of memory blocks to be allocated contained in the memory device is large.
[0113] In the embodiment of the present application, a determination is first made based on the fine-grained sub-memory blocks and the requested memory size to determine whether a target sub-memory block that meets the requirements exists. If no target sub-memory block exists, a target memory block that meets the requirements is selected based on the coarse-grained memory blocks to complete the process of determining the first target resource. In this way, a matching memory block or sub-memory block can be selected as the first target resource while avoiding resource waste.
[0114] In some embodiments of the present application, step 402 may further include the following steps:
[0115] Step 604: When the memory size of any sub-memory block to be allocated and any memory block to be allocated is smaller than the requested memory size, the designated memory resource is determined as the first target resource; the designated memory resource includes at least two sub-memory blocks to be allocated, at least two memory blocks to be allocated, or at least two memory blocks to be allocated and a sub-memory block to be allocated.
[0116] In an embodiment of the present application, when the memory size of any to-be-allocated sub-memory block and any to-be-allocated memory block is smaller than the requested memory size, it indicates that a single memory block or sub-memory block cannot provide sufficient memory size to the host. Therefore, a combined allocation can be performed based on at least two memory blocks and / or sub-memory blocks to meet the requested memory size required by the host. Specifically, at least two to-be-allocated sub-memory blocks, at least two to-be-allocated memory blocks, or at least two to-be-allocated memory blocks and a to-be-allocated sub-memory block, whose sum of memory sizes is greater than or equal to the requested memory size, can be selected as the first target resource.
[0117] In an embodiment of the present application, when the memory size of a single memory block or sub-memory block is smaller than the applied memory size, the first target resource is determined by combining memory blocks and / or sub-memory blocks, making the resource allocation method in the resource management system more flexible and the resource allocation more diversified.
[0118] In some embodiments of the present application, after step 102, the embodiment of the present application further includes the following steps:
[0119] Step 701: Based on a first tag, mark a first target resource in a memory mapping table as allocated.
[0120] In an embodiment of the present application, after allocating the first target resource to the host, the memory allocation information in the memory mapping table needs to be updated. Specifically, the first target resource in the memory mapping table can be marked based on the first tag, and the first target resource marked based on the first tag represents an allocated state. The first tag is used to represent that the memory resource marked by the first tag is in an allocated state. Exemplarily, the first tag can be a text tag such as "allocated" or a logical digital tag such as "1".
[0121] Step 702: Update the memory mapping table based on the first resource information corresponding to the first target resource.
[0122] In an embodiment of the present application, a memory mapping table is updated based on first resource information corresponding to a first target resource. Specifically, the first resource information can be integrated into the memory mapping table in the form of a table entry. The first resource information may include a host identifier corresponding to a host to which the first target resource is allocated, a starting address corresponding to the first target resource, a memory device identifier corresponding to the first target resource, and a requested memory size.
[0123] In an embodiment of the present application, when the memory resources in the resource management system change, the allocation and usage status of the memory resources in the memory mapping table are updated synchronously in a timely manner. The memory mapping table can be dynamically updated to ensure the real-time nature of the allocation and usage status of the memory resources represented by the memory mapping table.
[0124] In some embodiments of the present application, step 102 may include the following steps:
[0125] Step 801: Send a first signal to a switch matrix module.
[0126] In an embodiment of the present application, a switch matrix module controls the physical connection between a host and memory resources. Specifically, after determining a first target resource, the switch matrix module can be used to enable a first channel between a first memory device corresponding to the first target resource and the host. A control signal is used to toggle a switch, thereby enabling or disabling the corresponding channel. A first signal is sent to the switch matrix module in the bridge device. The first signal is used to enable the first channel between the first target resource and the host.
[0127] In an embodiment of the present application, the physical connection between the host and the memory resources is controlled by the switch matrix module in the bridging device to enable or disable the corresponding channel, which can improve the efficiency of memory resource allocation and memory resource management in the resource management system.
[0128] In some embodiments of the present application, the embodiments of the present application may further include the following steps:
[0129] Step 901: regularly obtain usage status information of at least two memory blocks and at least two sub-memory blocks in a resource management system, and update a memory mapping table based on the usage status information.
[0130] In an embodiment of the present application, the usage status information of at least two memory blocks and at least two sub-memory blocks in the resource management system is obtained at regular intervals. The usage status information may include information such as memory resource occupancy information, resource occupancy duration, and resource non-occupancy duration of at least two memory blocks and at least two sub-memory blocks. The memory usage information in the memory mapping table is updated based on the usage status information. Specifically, the usage status information obtained each time can be integrated into the memory mapping table in the form of table entries to update the memory usage information in the memory mapping table. Exemplarily, the usage status of memory blocks of different granularities can be read regularly to determine the memory resource occupancy information (occupied or unoccupied) and to time the usage status of the memory blocks to obtain the resource occupancy duration or the resource non-occupied duration.
[0131] In the embodiment of the present application, by regularly monitoring the usage status information of at least two memory blocks and at least two sub-memory blocks in the resource management system, dynamic management of memory resources in the resource management system can be facilitated.
[0132] In some embodiments of the present application, the embodiments of the present application may further include the following steps:
[0133] Step 1001: Configure a designated memory block among at least two memory blocks or a designated sub-memory block among at least two sub-memory blocks as a shared memory space; the shared memory space is used for data forwarding by at least two hosts.
[0134] In an embodiment of the present application, a specified memory block among at least two memory blocks or a specified sub-memory block among at least two sub-memory blocks can be configured as a shared memory space. The shared memory space is used for data forwarding between at least two hosts. The at least two hosts can include all hosts in the resource management system, or can include some hosts in the resource management system. It is understood that multiple shared memory spaces can be configured as needed in the resource management system, and this embodiment of the present application does not impose any restrictions on this.
[0135] For example, the 2MB (Megabyte) memory space starting at address 0x1000_0000 in the resource management system can be configured as a shared memory space. Both host 1 and host 2 in the resource management system can use this shared memory space. For example, host 1 can write data to this shared memory space, and host 2 can directly read the contents of this shared memory space to realize data transmission.
[0136] In an embodiment of the present application, at least two hosts may be allowed to share the same shared memory space, thereby enabling data forwarding between the at least two hosts.
[0137] In some embodiments of the present application, step 103 may include the following steps:
[0138] Step 1101: Obtain memory address information for indicating a second target resource carried by a target command.
[0139] In an embodiment of the present application, when a host sends a target command to a bridge device, the target command carries information indicating the host's actual resource requirements. In the case where the target command is a memory release command, the target command carries memory address information corresponding to a second target resource that the host needs to release. The memory address information is used to indicate the second target resource that the host needs to release.
[0140] Step 1102: Based on the memory address information, close the second channel between the second target resource and the host through the switch matrix module.
[0141] In an embodiment of the present application, a second target resource to be released is determined from a resource management system based on memory address information. The second target resource may include a memory block and / or a sub-memory block. After the second target resource is determined, a second channel between the second target resource and the host may be closed based on a switch matrix module to release the second target resource.
[0142] In an embodiment of the present application, the second target resource is determined by memory address information and the second channel between the second target resource and the host is closed. The corresponding memory release processing can be performed directly based on the target command through the bridge device, thereby improving the efficiency of memory release.
[0143] In some embodiments of the present application, after step 103, the present application embodiment may include the following steps:
[0144] Step 1201: Based on the second tag, mark the second target resource in the memory mapping table as unallocated.
[0145] In an embodiment of the present application, after releasing the second target resource indicated by the host, the memory allocation information in the memory mapping table needs to be updated. Specifically, the second target resource in the memory mapping table can be marked based on the second tag, and the second target resource marked based on the second tag is characterized as being in an unallocated state, that is, an idle state. The second tag is used to represent that the memory resource marked by the second tag is in an unallocated state. Exemplarily, the second tag can be a text tag such as "unallocated" or a logical digital tag such as "0".
[0146] Step 1202: Delete the second resource information corresponding to the second target resource in the memory mapping table.
[0147] In an embodiment of the present application, the memory mapping table is updated based on the second resource information corresponding to the second target resource. Specifically, the second resource information contained in the memory mapping table can be deleted. The second resource information can include a host identifier corresponding to the host to which the second target resource is allocated, a starting address corresponding to the second target resource, a memory device identifier corresponding to the second target resource, and an applied memory size. It is understandable that after deleting the second resource information in the memory mapping table, the second resource information can be saved as historical allocation information corresponding to the second target resource.
[0148] In an embodiment of the present application, when the memory resources in the resource management system change, the allocation and usage status of the memory resources in the memory mapping table are updated synchronously in a timely manner. The memory mapping table can be dynamically updated to ensure the real-time nature of the allocation and usage status of the memory resources represented by the memory mapping table.
[0149] In some embodiments of the present application, step 1102 may include the following steps:
[0150] Step 1301: Determine a second target resource based on the memory address information, and send a second signal to the switch matrix module; the second signal is used to close a second channel between the second target resource and the host.
[0151] In an embodiment of the present application, the physical connection between the host and the memory resources can be controlled based on a switch matrix module. Specifically, a second target resource can be determined from the memory resources in the resource management system based on memory address information. After determining the second target resource, the switch matrix module can be used to shut down the second channel between the second memory device corresponding to the second memory resource and the host. A control signal is used to switch the switch, thereby enabling or disabling the corresponding channel. A second signal is sent to the switch matrix module in the bridge device. The second signal is used to shut down the second channel between the second target resource and the host.
[0152] In an embodiment of the present application, the physical connection between the host and the memory resources is controlled by the switch matrix module in the bridging device to enable or disable the corresponding channel, which can improve the efficiency of memory resource allocation and memory resource management in the resource management system.
[0153] In some embodiments of the present application, the embodiments of the present application may further include the following steps:
[0154] Step 1401: If it is detected that any allocated memory block or allocated sub-memory block is not occupied within a preset time period, a release request is sent to a target host corresponding to the allocated memory block or allocated sub-memory block;
[0155] Among them, the allocated memory block is a memory block marked with a first label in the memory mapping table, and the allocated sub-memory block is a sub-memory block marked with a first label in the memory mapping table; the release request is used to request the target host to send a memory release command for the allocated memory block or the allocated sub-memory block to the bridge device.
[0156] In an embodiment of the present application, the bridge device monitors the memory usage status of the allocated memory blocks or allocated sub-memory blocks in the resource management system based on the memory mapping table. The allocated memory blocks or allocated sub-memory blocks can be determined based on the first tag in the memory mapping table, and the memory blocks marked with the first tag are determined as allocated memory blocks, and the sub-memory blocks marked with the first tag are determined as allocated sub-memory blocks. If it is detected that any allocated memory block or allocated sub-memory block is not occupied within a preset time length, it indicates that there may be resource waste in the memory space of the allocated memory block or allocated sub-memory block. Therefore, a release request can be sent to the target host corresponding to the allocated memory block or allocated sub-memory block that is not occupied within the preset time length. The preset time length can be set according to demand, and the embodiment of the present application does not limit this. The release request is used to request the target host to agree to release the allocated memory block or allocated sub-memory block that is not occupied within the preset time length, and send a memory release command for the allocated memory block or allocated sub-memory block to the bridge device.
[0157] In a possible implementation, when the cumulative unused time corresponding to any allocated memory block or allocated sub-memory block is greater than a preset time threshold, a release request can be sent to the target host corresponding to the allocated memory block or allocated sub-memory block.
[0158] In an embodiment of the present application, by detecting the occupancy status of allocated memory blocks and allocated sub-memory blocks, the allocated memory blocks or allocated sub-memory blocks that have not been occupied for a long time are actively negotiated with the target host for resource release. That is to say, the resource management method in an embodiment of the present application provides two resource release methods: the host actively makes a resource release request and the bridge device actively releases resources with the host, which improves the diversity of resource release methods and also improves resource utilization to a certain extent.
[0159] For example, an embodiment of the present application provides a schematic table describing the memory mapping tables of two memory devices (respectively, memory device 1 and memory device 2), as shown in the following table:
[0160] The above memory mapping table can reflect the following information: Memory device 1 and memory device 2 are divided into two memory blocks 00 and 01, respectively, and the memory blocks are further divided to obtain sub-memory blocks. A memory device is divided into two memory blocks, which are further divided into 8 sub-memory blocks. Among them, logical identifier 1 indicates that the memory block or sub-memory block is allocated, and logical identifier 0 indicates that the memory block or sub-memory block is not allocated. Sub-memory block 001 in memory device 1 is allocated to host 4, and sub-memory block 011 in memory device 1 is allocated to host 3. Memory block 01 in memory device 1 is allocated to host 2. It is understood that sub-memory blocks 100 / 101 / 110 / 111 contained in memory block 01 are allocated to host 2. Memory block 00 in memory device 2 is allocated to host 1. It is understood that sub-memory blocks 000 / 001 / 010 / 011 contained in memory block 00 are allocated to host 1. Sub-memory block 111 in memory device 2 is allocated to host 6. It is understandable that the content of the above memory mapping table is only an example. The specific form and content-related settings of the memory mapping table can be set according to needs, and the embodiments of the present application do not limit this.
[0161] For example, FIG4 is a flowchart of the specific steps of a resource management method provided by an embodiment of the present application. As shown in FIG4 , in response to a target command sent by the host, the command type corresponding to the target command is determined and the host identifier corresponding to the host is obtained; in the case where the target command is a memory request command, the request memory information carried by the target command is determined, and based on the request memory information and the memory allocation information corresponding to the memory mapping table, the first target resource that needs to be allocated to the host is determined in the memory resources corresponding to the memory device, and the switch matrix module is controlled to select the first target resource and the first channel of the host to complete the resource allocation to the host. After the first target resource is allocated to the host, the memory mapping table is updated; in the case where the target command is a memory release command, the memory address information carried by the target command is obtained, and based on the memory address information, the second target resource is determined in the memory resources corresponding to the memory device, and the switch matrix module is controlled to close the second channel of the second target resource and the host to complete the resource release of the second target resource indicated by the host. After releasing the second target resource, the memory mapping table is updated.
[0162] FIG5 is a schematic diagram of the structure of a resource management device provided in an embodiment of the present application. As shown in FIG5 , the device is applied to a bridging device based on computing high-speed link technology in a resource management system. The bridging device is used to establish a connection between a host and a memory device in the resource management system. The bridging device includes an instruction parsing module, a memory mapping table, and a switch matrix module, and specifically may include:
[0163] The first determining module 1501 is configured to respond to a target command sent by the host and determine a command type corresponding to the target command through the instruction parsing module; the command type includes a memory allocation command and a memory release command;
[0164] The second determining module 1502 is configured to, when the target command is a memory request command, determine a first target resource to be allocated to the host based on a memory mapping table, and to enable a first channel between the first target resource and the host based on a switch matrix module; the memory mapping table is used to represent memory allocation and usage of a memory device;
[0165] The third determining module 1503 is configured to, when the target command is a memory release command, determine a second target resource indicated by the memory release command, and close a second channel between the second target resource and the host based on the switch matrix module.
[0166] In some embodiments of the present application, the apparatus comprises:
[0167] The first acquisition module is used to obtain device information corresponding to the memory device; the device information includes the device capacity, device starting address and device identification corresponding to the memory device;
[0168] The first allocation module is used to pre-allocate address space for the memory device according to a continuous allocation rule.
[0169] In some embodiments of the present application, the first determining module 1501 includes:
[0170] a first determining submodule, configured to determine, when the designated field in the target command is the first field, by means of an instruction parsing module, that the command type corresponding to the target command is a memory allocation command;
[0171] The second determining submodule is configured to determine, when the designated field in the target command is the second field, through the instruction parsing module to determine that the command type corresponding to the target command is a memory release command.
[0172] In some embodiments of the present application, the second determining module 1502 includes:
[0173] A second acquisition module is used to acquire a memory mapping table and acquire memory allocation information based on the memory mapping table;
[0174] The fourth determining module is configured to determine a first target resource in memory resources corresponding to the memory device based on the memory allocation information and the memory application information carried by the target command.
[0175] In some embodiments of the present application, the apparatus comprises:
[0176] A first partitioning module, configured to partition memory resources corresponding to the memory device into at least two memory blocks based on a first granularity;
[0177] The second partitioning module is configured to partition any memory block into at least two sub-memory blocks based on a second granularity; the first granularity is greater than the second granularity.
[0178] In some embodiments of the present application, the requested memory information includes the requested memory size; and the fourth determining module includes:
[0179] A third determining submodule is configured to determine a memory block to be allocated and a sub-memory block to be allocated based on the memory allocation information;
[0180] a fourth determining submodule, configured to determine the target sub-memory block as the first target resource if the memory size of the target sub-memory block in the to-be-allocated sub-memory block is greater than or equal to the requested memory size;
[0181] The fifth determining submodule is configured to determine the target memory block as the first target resource when the memory size of any to-be-allocated sub-memory block is smaller than the requested memory size and the memory size of the target memory block in the to-be-allocated memory block is greater than or equal to the requested memory size.
[0182] In some embodiments of the present application, the fourth determining module further includes:
[0183] The sixth determination sub-module is used to determine the designated memory resource as the first target resource when the memory size of any sub-memory block to be allocated and any memory block to be allocated is smaller than the applied memory size; the designated memory resource includes at least two sub-memory blocks to be allocated, at least two memory blocks to be allocated, or at least two memory blocks to be allocated and a sub-memory block to be allocated.
[0184] In some embodiments of the present application, the device further comprises:
[0185] A first marking module, configured to mark a first target resource in the memory mapping table as being in an allocated state based on a first tag;
[0186] The first updating module is configured to update the memory mapping table based on first resource information corresponding to the first target resource.
[0187] In some embodiments of the present application, the second determining module 1502 includes:
[0188] A first sending module, configured to send a first signal to the switch matrix module;
[0189] The first signal is used to select a first channel between the first target resource and the host.
[0190] In some embodiments of the present application, the device further comprises:
[0191] The second updating module is used to periodically obtain usage status information of at least two memory blocks and at least two sub-memory blocks in the resource management system, and update the memory mapping table based on the usage status information.
[0192] In some embodiments of the present application, the device further comprises:
[0193] The first configuration module is used to configure a specified memory block in at least two memory blocks or a specified sub-memory block in at least two sub-memory blocks as a shared memory space; the shared memory space is used for data forwarding by at least two hosts.
[0194] In some embodiments of the present application, the third determining module 1503 includes:
[0195] a third acquisition module, configured to acquire memory address information indicating a second target resource carried in the target command;
[0196] The first closing module is used to close the second channel between the second target resource and the host through the switch matrix module based on the memory address information.
[0197] In some embodiments of the present application, the device further comprises:
[0198] A second marking module, configured to mark the second target resource in the memory mapping table as being in an unallocated state based on the second label;
[0199] The first deleting module is configured to delete the second resource information corresponding to the second target resource in the memory mapping table.
[0200] In some embodiments of the present application, the first closing module includes:
[0201] The second sending module is used to determine the second target resource based on the memory address information and send a second signal to the switch matrix module; the second signal is used to close the second channel between the second target resource and the host.
[0202] In some embodiments of the present application, the device further comprises:
[0203] If it is detected that any allocated memory block or allocated sub-memory block is not occupied within a preset time period, a release request is sent to a target host corresponding to the allocated memory block or allocated sub-memory block;
[0204] Among them, the allocated memory block is a memory block marked with a first label in the memory mapping table, and the allocated sub-memory block is a sub-memory block marked with a first label in the memory mapping table; the release request is used to request the target host to send a memory release command for the allocated memory block or the allocated sub-memory block to the bridge device.
[0205] The present application also provides an electronic device, see Figure 6, including: a processor 1601, a memory 1602, and a computer program 16021 stored in the memory and executable on the processor, wherein the processor implements the resource management method of the aforementioned embodiment when executing the program.
[0206] The present application also provides a non-volatile readable storage medium. When instructions in the non-volatile readable storage medium are executed by a processor of an electronic device, the electronic device can execute the resource management method of the aforementioned embodiment.
[0207] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0208] The algorithms and displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems may also be used together with the teachings herein. Based on the above description, it is apparent that the structure required for constructing such systems is suitable. In addition, the present application is not directed to any specific programming language. It should be understood that various programming languages may be utilized to implement the present application described herein, and the description of the specific languages above is provided for the purpose of disclosing the preferred embodiment of the present application.
[0209] In the description provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present application can be practiced without these specific details. In some instances, well-known methods, structures, and techniques are not shown in detail so as not to obscure the understanding of this description.
[0210] Similarly, it should be understood that in order to streamline the present application and aid in understanding one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present application, various features of the present application are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting an intention that the claimed application requires more features than are expressly recited in each claim. Rather, as reflected in the claims below, inventive aspects lie in fewer than all the features of the individual embodiments disclosed above. Accordingly, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim itself serving as a separate embodiment of the present application.
[0211] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition may be divided into multiple submodules or subunits or subcomponents. All features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed herein may be combined in any combination, except that at least some of such features and / or processes or units are mutually exclusive. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.
[0212] The various component embodiments of the present application can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all of the functions of some or all of the components in the sorting device according to the present application. The application can also be implemented as a device or apparatus program for executing a part or all of the methods described herein. Such a program implementing the present application can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0213] It should be noted that the above embodiments illustrate rather than limit the present application, and that a person skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbols placed between brackets should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present application may be implemented by means of hardware comprising several different elements and by means of appropriately programmed computers. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names.
[0214] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0215] It should be noted that all actions of acquiring signals, information or data in this application are carried out in compliance with the relevant data protection laws and policies of the country where they are located and with the authorization given by the owner of the corresponding device.
[0216] The above are only preferred embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present application should be included in the scope of protection of the present application.
[0217] The above are only specific embodiments of the present application, but the scope of protection of this 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 this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
Claims
1. A resource management method, characterized in that: A bridging device based on computing high-speed link technology is applied to a resource management system, the bridging device being configured to establish a connection between a host and a memory device in the resource management system, the bridging device including a memory mapping table; the method comprising: In response to a target command sent by the host, determining a command type corresponding to the target command; the command type includes a memory request command and a memory release command; In a case where the target command is the memory request command, determining a first target resource to be allocated to the host based on the memory mapping table, and enabling a first channel between the first target resource and the host; the memory mapping table is configured to represent memory allocation and usage of the memory device; In a case where the target command is the memory release command, a second target resource indicated by the memory release command is determined, and a second channel between the second target resource and the host is closed.
2. The method according to claim 1, characterized in that The method further comprises: Obtaining device information corresponding to the memory device; the device information includes a device capacity, a device starting address, and a device identifier corresponding to the memory device; According to the continuous allocation rule, the address space is allocated to the memory device in advance.
3. The method according to claim 1, characterized in that The step of determining, in response to a target command sent by the host, a command type corresponding to the target command, includes: In a case where the designated field in the target command is the first field, determining that the command type corresponding to the target command is a memory request command; In a case where the designated field in the target command is the second field, it is determined that the command type corresponding to the target command is a memory release command.
4. The method according to claim 1, wherein The determining, based on the memory mapping table, a first target resource to be allocated to the host comprises: Obtaining a memory mapping table, and obtaining memory allocation information based on the memory mapping table; Based on the memory allocation information and the memory request information carried by the target command, a first target resource is determined in the memory resources corresponding to the memory device.
5. The method according to claim 4, characterized in that The method further comprises: Based on a first granularity, dividing memory resources corresponding to the memory device into at least two memory blocks; For any of the memory blocks, the memory block is divided into at least two sub-memory blocks based on a second granularity; the first granularity is greater than the second granularity.
6. The method according to claim 5, characterized in that The memory application information includes the memory application size; and determining the first target resource from the memory resources corresponding to the memory device based on the memory allocation information and the memory application information carried by the target command, including: Determining a memory block to be allocated and a sub-memory block to be allocated based on the memory allocation information; In a case where the memory size of the target sub-memory block in the to-be-allocated sub-memory block is greater than or equal to the requested memory size, determining the target sub-memory block as the first target resource; When the memory size of any of the to-be-allocated sub-memory blocks is smaller than the requested memory size, and the memory size of the target memory block in the to-be-allocated memory block is greater than or equal to the requested memory size, the target memory block is determined as the first target resource.
7. The method according to claim 6, characterized in that The determining, based on the memory allocation information and the memory application information carried by the target command, a first target resource from the memory resources corresponding to the memory device, further includes: When the memory size of any of the sub-memory blocks to be allocated and any of the memory blocks to be allocated are both smaller than the applied memory size, the designated memory resource is determined as the first target resource; the designated memory resource includes at least two sub-memory blocks to be allocated, at least two memory blocks to be allocated, or at least two memory blocks to be allocated and a sub-memory block to be allocated.
8. The method according to claim 6, characterized in that After determining the first target resource to be allocated to the host based on the memory mapping table, and enabling the first channel between the first target resource and the host, the method further includes: Based on the first tag, marking the first target resource in the memory mapping table as allocated; The memory mapping table is updated based on the first resource information corresponding to the first target resource.
9. The method according to claim 8, characterized in that The first resource information includes a host identifier corresponding to the host, a starting address corresponding to the first target resource, a memory device identifier corresponding to the first target resource, and an applied memory size.
10. The method according to claim 1, characterized in that The step of enabling the first target resource and the first channel of the host includes: sending a first signal; The first signal is configured to enable a first channel between the first target resource and the host.
11. The method according to claim 10, characterized in that The first target resource is configured to be accessible and writable by the host.
12. The method according to claim 5, characterized in that The method further comprises: The usage status information of the at least two memory blocks and the at least two sub-memory blocks in the resource management system is periodically acquired, and the memory mapping table is updated based on the usage status information.
13. The method according to claim 5, characterized in that The method further comprises: A designated memory block among the at least two memory blocks or a designated sub-memory block among the at least two sub-memory blocks is configured as a shared memory space; the shared memory space is configured for data forwarding by at least two hosts.
14. The method according to claim 1, wherein The determining the second target resource indicated by the memory release command, and closing the second channel between the second target resource and the host, includes: Obtaining memory address information carried by the target command and configured to indicate the second target resource; Based on the memory address information, a second channel between the second target resource and the host is closed.
15. The method according to claim 1, wherein After determining the second target resource indicated by the memory release command and closing the second channel between the second target resource and the host, the method further includes: Based on the second tag, marking the second target resource in the memory mapping table as unallocated; Delete the second resource information corresponding to the second target resource in the memory mapping table.
16. The method according to claim 14, characterized in that Closing the second channel between the second target resource and the host based on the memory address information includes: Based on the memory address information, the second target resource is determined, and a second signal is sent; the second signal is configured to close a second channel between the second target resource and the host.
17. The method according to claim 8, characterized in that The method further comprises: If it is detected that any allocated memory block or allocated sub-memory block is not occupied within a preset time period, a release request is sent to a target host corresponding to the allocated memory block or the allocated sub-memory block; The allocated memory block is a memory block marked with the first tag in the memory mapping table, and the allocated sub-memory block is a sub-memory block marked with the first tag in the memory mapping table; the release request is configured to request the target host to send a memory release command for the allocated memory block or the allocated sub-memory block to the bridging device.
18. A resource management device, characterized in that: A bridging device based on computing high-speed link technology applied to a resource management system, the bridging device being configured to establish a connection between a host and a memory device in the resource management system, the bridging device including an instruction parsing module, a memory mapping table, and a switch matrix module; the apparatus comprising: a first determining module configured to, in response to a target command sent by the host, determine, through the instruction parsing module, a command type corresponding to the target command; the command type including a memory request command and a memory release command; a second determining module configured to, when the target command is the memory request command, determine a first target resource to be allocated to the host based on the memory mapping table, and to enable a first channel between the first target resource and the host based on the switch matrix module; the memory mapping table being configured to represent memory allocation and usage of the memory device; The third determining module is configured to determine the second target resource indicated by the memory release command when the target command is the memory release command, and close the second channel between the second target resource and the host based on the switch matrix module.
19. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the resource management method according to any one of claims 1 to 17 when executing the program.
20. A non-volatile readable storage medium, characterized in that: When the instructions in the non-volatile readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the resource management method described in one or more of claims 1-17.
Citation Information
Patent Citations
Memory management method, system and related device
CN116560826A
Resource allocation method and device, electronic equipment and storage medium
CN117170882A
Resource management method and device, electronic equipment and storage medium
CN117707796A
Switch-managed resource allocation and software execution
US20200322287A1