Data migration method and computing device
By constructing a data migration mapping table, comprehensively considering the real and equivalent access delays, and optimizing the data migration method, the problem of application performance degradation in computing devices is solved, and more efficient memory access performance and capacity utilization are achieved.
Patent Information
- Application Number
- PCT/CN2023/135727
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-21
- Filing Date
- 2023-11-30
- Publication Date
- 2024-09-26
AI Technical Summary
Existing data migration methods fail to effectively consider the comprehensive access delay and performance loss when the processor accesses memory in computing devices, resulting in reduced application performance.
By constructing a data migration mapping table, the real access delay and equivalent access delay of the processor's access to memory are comprehensively considered, the migration target memory is determined, and the data migration process is optimized to improve the memory access performance of the application.
It effectively improves the memory access performance of applications, gives full play to hardware performance, and ensures full utilization of memory capacity through comprehensive access delay sorting and retry when data migration fails.
Smart Images

Figure CN2023135727_26092024_PF_FP
Abstract
Description
Data migration method and computing device
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on March 21, 2023, with application number 202310279463.5 and application name “Data Migration Method and Computing Device,” the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the technical field of computing devices, and in particular to a data migration and upgrade method and computing device. Background Art
[0003] In computing devices, running applications often occupy a certain amount of memory space. With the continuous advancement of enterprise digitalization and information technology transformation, a variety of diverse applications are emerging, placing higher demands on the content capacity of computing devices. Compute Express Link (CXL) is a bus architecture based on industry-standard protocols that is used to expand the memory of computing devices to increase their memory bandwidth and capacity. Due to the inherent latency of the CXL protocol and link itself, computing devices expanded with CXL may have memories with different access latencies.
[0004] When running an application, computing devices need to transfer access data from high-latency memory to low-latency memory to improve application performance. However, current data migration solutions can degrade application performance in practice.
[0005] Summary of the Invention
[0006] The embodiments of the present application provide a data migration method and a computing device, which can effectively improve the performance of an application during data migration.
[0007] In a first aspect, an embodiment of the present application provides a data migration method, which is applied to a first processor, where the first processor is one of multiple processors included in a computing device, and each of the multiple processors is connected to at least one memory; the first memory accessed by the first processor includes data to be migrated; the method includes: in response to a data migration instruction, determining a second memory from a data migration mapping table; the data migration mapping table includes a memory set corresponding to the first memory, the second memory is one of the memory sets, and the memory set corresponding to the first memory is obtained based on the comprehensive access delay of each memory, and the comprehensive access delay of each memory is determined based on the actual access delay from the first processor to the memory, and the equivalent access delay from the first processor to the memory, and the equivalent access delay is used to indicate the performance loss when the first processor accesses the memory; migrating the data to be migrated from the first memory to the second memory.
[0008] The data migration method provided in the embodiment of the present application, after receiving the data migration instruction, determines the second memory from the data migration mapping table determined based on the comprehensive access delay of each memory, and migrates the data to be migrated to the second memory. Among them, the comprehensive access delay not only takes into account the real access delay of the processor accessing the memory, but also takes into account the performance loss caused by the processor accessing the memory. Compared with the traditional method of determining the second memory to be migrated by considering only the real access delay, the data migration method provided in the embodiment of the present application is more in line with the performance loss that will exist when accessing memory across processors in actual scenarios. Data migration based on this method can give full play to the hardware performance and effectively improve the memory access performance of the application.
[0009] In one possible implementation, a data migration mapping table is stored in a memory of a computing device; and in response to a data migration instruction, determining the second memory from the data migration mapping table includes: in response to the data migration instruction, obtaining the data migration mapping table from the memory; and determining the second memory from the data migration mapping table. It should be understood that the data migration mapping table is pre-established and stored in the memory, and the processor can directly call and use it when performing data migration, eliminating the need to expend additional time and computing power to create the data migration mapping table, thereby improving data migration efficiency while reducing waste of computing resources.
[0010] In another possible implementation, after responding to the data migration instruction, the above method also includes: obtaining a memory latency table, the memory latency table including the comprehensive access delay from the first processor to each memory; and obtaining a data migration mapping table based on the memory latency table and the comprehensive access delay size sorting of the memory.
[0011] In another possible implementation, after responding to the data migration instruction, the method also includes: constructing and obtaining a memory latency table based on a memory relationship mapping table; the memory relationship mapping table includes the connection method between each processor in a plurality of processors and the memory connected to it; the memory relationship mapping table is determined by the memory information of each memory; the memory latency table includes the comprehensive access latency from the first processor to each memory; and obtaining the data migration mapping table based on the memory latency table and the comprehensive access latency size sorting of the memory.
[0012] In another possible implementation, after responding to the data migration instruction, the method also includes: obtaining memory information of each memory; based on the memory information, obtaining a memory relationship mapping table; the memory relationship mapping table includes the connection method between each processor in a plurality of processors and the memory connected to each processor; obtaining a memory latency table based on the memory relationship mapping table; the memory latency table includes the comprehensive access latency from the first processor to each memory; and obtaining a data migration mapping table based on the memory latency table and the size sorting of the comprehensive access latency of the memory.
[0013] In another possible implementation, the comprehensive access latency of each memory in the data migration mapping table satisfies: T_total = T_equal + T_real
[0014] T_total represents the total access latency, T_real represents the real access latency, and T_equal represents the equivalent access latency.
[0015] In another possible implementation, the equivalent access latency satisfies: T_equal = α × T_remote
[0016] Among them, when the memory is connected to the first processor, α is the first value; when the memory is connected to the second processor, α is the second value; the second processor is one of the multiple processors except the first processor; the second value is greater than the first value; T_remote represents the delay conversion coefficient corresponding to the performance loss when the first processor accesses the memory when the memory is connected to the second processor.
[0017] In another possible implementation, the data migration instruction includes: a first data migration direction; the first data migration direction is used to indicate the migration direction of hot data; determining the second memory from a data migration mapping table, including: determining from the data migration mapping table a first memory set corresponding to the first memory in the first data migration direction; the comprehensive access latency of each memory in the first memory set is less than the comprehensive access latency of the first memory; and using a target memory in the first memory set as the second memory, the comprehensive access latency of the target memory being less than the comprehensive access latency of other memories in the first memory set. It should be understood that for hot data migration, the hot data can be placed in a memory with lower latency, shortening the time it takes the processor to access the hot data, thereby ensuring the memory access performance of the application.
[0018] In another possible implementation, after migrating the data to be migrated from the first memory to the second memory, the method further includes: if the migration fails, selecting the next memory in the first memory set after the target memory as the second memory in ascending order of comprehensive access latency. It should be understood that if the hot data migration fails, selecting new memories for retrying in sequence can ensure full utilization of low-latency memory capacity while meeting data migration requirements, further ensuring memory access performance of the application.
[0019] In another possible implementation, the data migration instruction includes: a second data migration direction; the second data migration direction is used to indicate the migration direction of cold data; determining the second memory from a data migration mapping table includes: determining from the data migration mapping table a second memory set corresponding to the first memory in the second data migration direction; the combined access latency of each memory in the second memory set is greater than the combined access latency of the first memory; and selecting a memory in the second memory set as the second memory. It should be understood that migrating cold data can free up more capacity in lower-latency memory, allowing more hot data to be migrated to lower-latency memory, further ensuring memory access performance for applications.
[0020] In another possible implementation, after migrating the data to be migrated from the first memory to the second memory, the method further includes: in case of migration failure, reselecting a memory from the second memory set as the second memory according to the comprehensive access latency.
[0021] In another possible implementation, the at least one memory is connected to the processor in one or more of the following ways: direct connection, connection through CXL, and connection through a CXL switch chip.
[0022] In a second aspect, an embodiment of the present application provides a data migration device, which is applied to a first processor, wherein the first processor is one of a plurality of processors included in a computing device, and each of the plurality of processors is connected to at least one memory; the first memory accessed by the first processor includes data to be migrated; the device includes: a determination module and a migration module. The determination module is used to determine the second memory from a data migration mapping table; the data migration mapping table includes a memory set corresponding to the first memory, the second memory is one of the memory sets, and the memory set corresponding to the first memory is obtained based on the comprehensive access delay of each memory, and the comprehensive access delay of each memory is determined based on the actual access delay from the first processor to the memory and the equivalent access delay from the first processor to the memory, and the equivalent access delay is used to indicate the performance loss when the first processor accesses the memory; the migration module is used to migrate the data to be migrated from the first memory to the second memory.
[0023] In one possible implementation, the data migration mapping table is stored in a memory of the computing device; the determination module is specifically configured to, in response to a data migration instruction, obtain the data migration mapping table from the memory; and determine the second memory from the data migration mapping table.
[0024] In another possible implementation, the apparatus further includes an acquisition module configured to acquire a memory latency table including a comprehensive access latency from the first processor to each memory; and acquire a data migration mapping table based on the memory latency table and the memory's comprehensive access latency ranking.
[0025] In another possible implementation, the acquisition module is also used to obtain a memory latency table based on a memory relationship mapping table; the memory relationship mapping table includes the connection method between each processor in a plurality of processors and the memory connected to it; the memory relationship mapping table is determined by the memory information of each memory; the memory latency table includes the comprehensive access latency from the first processor to each memory; based on the memory latency table and the comprehensive access latency size sorting of the memory, a data migration mapping table is obtained.
[0026] In another possible implementation, the acquisition module is also used to obtain memory information of each memory; based on the memory information, obtain a memory relationship mapping table; the memory relationship mapping table includes the connection method between each processor in a plurality of processors and the memory connected to each processor; obtain a memory latency table based on the memory relationship mapping table; the memory latency table includes the comprehensive access latency from the first processor to each memory; based on the memory latency table and the comprehensive access latency size sorting of the memory, obtain a data migration mapping table.
[0027] In another possible implementation, the comprehensive access latency of each memory in the data migration mapping table satisfies: T_total = T_equal + T_real
[0028] T_total represents the total access latency, T_real represents the real access latency, and T_equal represents the equivalent access latency.
[0029] In another possible implementation, the equivalent access latency satisfies: T_equal = α × T_remote
[0030] Among them, when the memory is connected to the first processor, α is the first value; when the memory is connected to the second processor, α is the second value; the second processor is one of the multiple processors except the first processor; the second value is greater than the first value; T_remote represents the delay conversion coefficient corresponding to the performance loss when the first processor accesses the memory when the memory is connected to the second processor.
[0031] In another possible implementation, the first data migration direction; the first data migration direction is used to indicate the migration direction of hot data; the determination module is specifically used to determine the first memory set corresponding to the first memory in the first data migration direction from the data migration mapping table; the comprehensive access delay of each memory in the first memory set is less than the comprehensive access delay of the first memory; the target memory in the first memory set is used as the second memory, and the comprehensive access delay of the target memory is less than the comprehensive access delay of other memories in the first memory set.
[0032] In another possible implementation, the migration module is further configured to, in the event of migration failure, use the next memory of the target memory in the first memory set as the second memory in ascending order of comprehensive access latency.
[0033] In another possible implementation, the data migration instruction includes: a second data migration direction; the second data migration direction is used to indicate the migration direction of cold data; the determination module is specifically used to determine, from the data migration mapping table, a second memory set corresponding to the first memory in the second data migration direction; the comprehensive access delay of each memory in the second memory set is greater than the comprehensive access delay of the first memory; and one of the memories in the second memory set is used as the second memory.
[0034] In another possible implementation, the migration module is further configured to, in the event of migration failure, reselect a memory from the second memory set as the second memory according to the comprehensive access latency.
[0035] In another possible implementation, the at least one memory is connected to the processor in one or more of the following ways: direct connection, connection via a computing express link (CXL), and connection via a CXL switch chip.
[0036] In a third aspect, an embodiment of the present application provides a computing device, which includes: a processor and a memory; the memory stores instructions executable by the processor; when the processor is configured to execute the instructions, the computing device implements the method of the first aspect above.
[0037] In a fourth aspect, an embodiment of the present application provides a computing device, which includes multiple processors, each of the multiple processors is connected to at least one memory, the first processor is one of the multiple processors, and the first processor is used to: determine the second memory from a data migration mapping table in response to a data migration instruction; the data migration mapping table includes a memory set corresponding to the first memory, the second memory is one of the memory sets, the memory set corresponding to the first memory is obtained based on the comprehensive access delay of each memory, the comprehensive access delay of each memory is determined based on the actual access delay from the first processor to the memory, and the equivalent access delay from the first processor to the memory, the equivalent access delay is used to indicate the performance loss when the first processor accesses the memory; migrate the data to be migrated from the first memory to the second memory.
[0038] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, which includes: computer software instructions; when the computer software instructions are executed in a computing device, the computing device implements the method of the first aspect above.
[0039] In a sixth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on a computer, it enables the computer to execute the steps of the relevant method described in the first aspect above to implement the method of the first aspect above.
[0040] The beneficial effects of the second to sixth aspects mentioned above can be referred to the corresponding description of the first aspect and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] FIG1 is a schematic diagram of the composition of a computing device provided in an embodiment of the present application;
[0042] FIG2 is a schematic diagram of a connection between a local memory and a remote memory provided in an embodiment of the present application;
[0043] FIG3 is a schematic diagram showing the relationship between a multi-level delay memory provided by an embodiment of the present application;
[0044] FIG4 is a flow chart of a data migration method provided in Example 1 of the present application;
[0045] FIG5 is a flow chart of another data migration method provided in Example 1 of the present application;
[0046] FIG6 is a flow chart of another data migration method provided in Example 1 of the present application;
[0047] FIG7 is a flow chart of a data migration method provided in Example 2 of the present application;
[0048] FIG8 is a flow chart of a data migration method provided in Example 3 of the present application;
[0049] FIG9 is a flow chart of a data migration method provided in Example 4 of the present application;
[0050] FIG10 is a schematic diagram of a system architecture provided in an embodiment of the present application;
[0051] FIG11 is a schematic diagram of the composition of a data migration device provided in an embodiment of the present application;
[0052] FIG12 is a schematic diagram of the composition of another computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0053] 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 only part of the embodiments of this application, not all of the embodiments. 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.
[0054] It should be noted that in the embodiments of this application, words such as "exemplarily" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described in the embodiments of this application as "exemplarily" or "for example" should not be interpreted as being more preferred or advantageous than other embodiments or designs. Rather, the use of words such as "exemplarily" or "for example" is intended to present the relevant concepts in a concrete manner.
[0055] In order to facilitate a clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "first" and "second" are used to distinguish between identical or similar items with basically the same functions and effects. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order.
[0056] To facilitate understanding of the technical solutions of the embodiments of the present application, the following is a brief introduction to the terms involved in the text.
[0057] 1. Data migration: This technology moves frequently used data to low-latency memory and infrequently used data to high-latency memory to increase data access speed and improve application performance.
[0058] 2. Compute Express Link (CXL) is an open, industry-standard bus architecture that provides high-bandwidth, low-latency connectivity between dedicated compute, memory, I / O, and storage elements within a data center. CXL memory expansion for compute devices can increase memory bandwidth and capacity, making them more suitable for memory-intensive applications.
[0059] As described in the background technology, in order to meet the memory capacity and memory bandwidth requirements of diverse applications, CXL is often used in related technologies to enable computing devices to connect to more memories, thereby expanding the memory capacity and memory bandwidth of computing devices. Since CXL itself has a certain latency, the memory connected through CXL has a longer read and write access latency than traditional directly connected memory. Therefore, after connecting the memory through CXL, the computing device will have memories with different access latencies. When applications randomly access memories with different latencies without distinction, it may cause the performance of the application to degrade. Therefore, at present, data used by applications is generally migrated from high-latency memory to low-latency memory through data migration, ensuring that applications can read data as quickly as possible, thereby improving the performance of applications.
[0060] The computing device mentioned here can be a tower server, a rack server, or a blade server. The embodiments of the present application do not limit the specific form of the computing device.
[0061] Figure 1 is a schematic diagram of the structure of a computing device provided by an embodiment of the present application. As shown in Figure 1, the hardware part of the computing device may include a motherboard, multiple processors (two are shown as an example in the figure) and a basic input output system (BIOS) chip. The BIOS chip and the multiple processors are arranged on the motherboard. The BIOS chip is connected to the multiple processors respectively, and each of the multiple processors is connected to at least one memory. It should be noted that the multiple processors can be connected to each other in pairs or in sequence to form a ring. The specific configuration can be determined according to the actual scenario, and the embodiment of the present application does not impose specific restrictions on this. In addition, the software part of the computing device may include an operating system (OS) kernel (the OS kernel may also be called an OS management unit) and a BIOS. The OS kernel may be located in one or more processors, and the BIOS is located in the BIOS chip.
[0062] In the embodiment of the present application, the processor may be a processor based on the x86 architecture or the ARM (advanced RISC machines) architecture. For example, the processor may be a central processing unit (CPU).
[0063] Taking the CPU as an example, in a multi-CPU computing device, the CPU idle state may fluctuate during application execution. Therefore, a single application process may execute on different CPUs, resulting in dynamic changes. Furthermore, each CPU is connected to memory. Therefore, when an application running on a CPU (e.g., the first CPU) requests memory, if the memory capacity connected to the first CPU satisfies the application, the memory connected to the first CPU is allocated to the application. For the application, this memory is considered local memory. If the memory capacity connected to the first CPU is insufficient, the application can be allocated memory connected to another CPU (e.g., the second CPU). This memory is not connected to the first CPU and is considered non-local memory or remote memory. Generally speaking, the access latency of remote memory is greater than the access latency of local memory. Therefore, in a multi-CPU computing device, when accessing memory, the application may directly access local memory (with lower latency) or non-local memory (with higher latency). This leaves room for optimization in memory access.
[0064] Figure 2 is a schematic diagram of the connection between a local memory and a remote memory provided in an embodiment of the present application. As shown in Figure 1, CPU0 is connected to memory 0, CPU1 is connected to memory 1, and CPU0 is connected to CPU1. For example, memory 0 and memory 1 here can be dual-inline-memory-modules (DIMMs). Taking CPU0 as the first CPU mentioned above as an example, CPU0 accesses memory 0 directly, that is, accesses local memory. CPU0 accesses memory 1 across CPU1, that is, accesses non-local memory or accesses remote memory. Therefore, when an application accesses data in non-local memory, certain technical means can be used to migrate the data in non-local memory to local memory under the premise that the local memory capacity is sufficient, so that the application running in CPU0 can read and write data from the local memory with smaller latency, so as to improve the memory access performance of the application.
[0065] For different processors, after the memory is expanded through CXL, each processor in the computing device will have a memory with different access latency. For example, Figure 3 is a schematic diagram of the relationship between a multi-level latency memory provided in an embodiment of the present application. The computing device may include two processors, namely CPU0 and CPU1. CPU0 is directly connected to memory 1, connected to memory 3 and memory 4 through CXL, and connected to memory 7 and memory 8 through a CXL switch chip (CXL Switch). CPU1 is directly connected to memory 2, connected to memory 5 and memory 6 through CXL, and connected to memory 9 and memory 10 through a CXL switch chip. The above-mentioned direct connection refers to the direct connection between the memory and the pins provided by the CPU. The CXL switch chip is a switch chip based on the CXL protocol, which can be used to expand the connection of multiple memories and configure the processor corresponding to the expanded connected memory according to actual needs. For example, in Figure 3, the CXL switch chip connects memory 7-memory 10, where memory 7 and 8 are configured as the memory connected to CPU0, and memory 9 and 10 are configured as the memory connected to CPU1.
[0066] Currently, during data migration, the target memory (e.g., the second memory) is typically selected based on its actual access latency. Actual access latency refers to the time it takes for a processor to wait for a memory response before it is ready to execute a read or write operation. For example, as illustrated in Figure 3, using CPU0 as an example, the actual access latency for CPU0 accessing local memory (Memory 1) is approximately 100 nanoseconds, the actual access latency for accessing remote memory (Memory 2) is approximately 180 nanoseconds, the actual access latency for accessing local CXL memory (Memory 3 or Memory 4) is approximately 260 nanoseconds, the actual access latency for accessing remote CXL memory (Memory 5 or Memory 6) is approximately 440 nanoseconds, the actual access latency for accessing local CXL Switch memory (Memory 7 or Memory 8) is approximately 500 nanoseconds, and the actual access latency for accessing remote CXL Switch memory (Memory 9 or Memory 10) is approximately 600 nanoseconds.
[0067] If the data that CPU0 is accessing is located on memory 7, when the data needs to be migrated to a low-latency memory, memory 3 or memory 2 can be selected as the target for migration. It can be seen that although the actual access latency of memory 2 is less than that of memory 3, for CPU0, memory 2 is a remotely accessed memory. If memory 2 is used as the second memory for data migration, it will cause the frequently used data in the local memory to be frequently migrated to the remote memory (such as memory 2 connected to CPU1) when the local memory is tight. In this case, for CPU1, since memory 2 is occupied, when CPU1 performs data migration, there is also the problem of local memory tightness, which forces the data to be migrated to the memory connected to CPU0, which in turn causes the applications running on CPU0 or CPU1 to frequently access the data in the remote memory, thereby causing a decline in application performance.
[0068] In other words, current data migration solutions only consider the actual access latency of memory, without factoring in cross-processor memory access. This cross-processor factor has a greater impact on application performance, especially when the latency of accessing remote memory (the actual access latency of path 1 in Figure 3) and accessing local CXL memory (the actual latency of path 2 in Figure 3) are similar.
[0069] Based on this, an embodiment of the present application provides a data migration method. When performing data migration, this method comprehensively considers the actual access delay and the performance loss when accessing the memory to determine the second memory to be migrated, optimizes the shortcomings of the data migration solution in the related technology, and thus effectively improves the performance of the application.
[0070] The data migration method provided in the embodiment of the present application can be applied to the scenario shown in Figure 1 or Figure 3. It should be noted that the specific execution steps of the data migration method provided in the embodiment of the present application are similar for each processor, and the following description will be given using any processor (such as the first processor) as an example. Among them, the first memory accessed by the first processor includes the data to be migrated. It should be noted that the first memory here is any memory in the computing device.
[0071] Example 1
[0072] FIG4 is a flow chart of a data migration method provided in Example 1 of the present application. For example, as shown in FIG4 , the data migration method provided in Example 1 of the present application may include the following steps:
[0073] S401: In response to a data migration instruction, the first processor determines a second memory from a data migration mapping table.
[0074] The data migration instruction is used to instruct the first processor to perform a migration operation on the data to be migrated. The data migration instruction can come from the operating system kernel. The embodiment of the present application does not limit the specific timing of the operating system kernel sending the data migration instruction. For example, a user manually sends the data migration instruction to the first processor through the operating system. Alternatively, the operating system kernel itself supports memory management functions. The operating system kernel can periodically scan the attribute information of each memory (such as utilization, remaining space, etc.) and issue the data migration instruction when the attribute information meets preset conditions.
[0075] In an embodiment of the present application, when an application running on a first processor is accessing a first memory, if the first processor receives a data migration instruction, it can determine a second memory (i.e., the migration target) from a data migration mapping table in response to the data migration instruction.
[0076] The data migration mapping table includes a memory set corresponding to the first memory, with the second memory being one of the memory sets. The memory set corresponding to the first memory is determined based on the combined access latency of each memory. The combined access latency of each memory is determined based on the actual access latency from the first processor to the memory and the equivalent access latency from the first processor to the memory. The individual memories here refer to multiple memories connected to multiple processors in a computing device. The equivalent access latency indicates the performance loss when the first processor accesses the memory, or the performance loss caused by the first processor accessing the memory across processors.
[0077] It should be noted that, in an embodiment of the present application, the above-mentioned data migration mapping table can be constructed in advance by any processor in the computing device and stored in the memory of the computing device. Exemplarily, the memory can be a random access memory, a dynamic storage device, a disk storage medium or any other form of storage device in the computing device. Specifically, S401 can be implemented as, in response to the data migration instruction, obtaining the data migration mapping table from the memory, and then determining the second memory from the data migration mapping table. It should be understood that the data migration mapping table is established and saved in the memory in advance, and the processor can directly call and use it when performing data migration, without spending extra time and computing power to create the data migration mapping table, thereby improving the efficiency of data migration while reducing the waste of computing resources.
[0078] The comprehensive access delay of each memory in the data migration mapping table satisfies the following expression: T_total = T_equal + T_real
[0079] Where T_total represents the total access delay, T_real represents the real access delay, and T_equal represents the equivalent access delay. The equivalent access delay satisfies the following expression: T_equal = α × T_remote
[0080] Among them, α indicates whether the memory belongs to the first processor. When the memory is connected to the first processor, α is the first value; when the memory is connected to the second processor, α is the second value; the second processor is one of the multiple processors except the first processor, and the second value is greater than the first value. The above-mentioned T_remote represents the delay conversion coefficient corresponding to the performance loss when the first processor accesses the memory when the memory is connected to the second processor. Among them, the value of T_remote can be determined based on experimental accumulation. In addition, the size of T_remote is related to the number of cross-processors. For example, when accessing memory across one processor, the value of T_remote can be 100 nanoseconds, and when accessing memory across two processors, the value of T_remote can be 200 nanoseconds, and so on.
[0081] It should be noted that data in computing devices includes hot data and cold data. Accordingly, data migration is categorized as hot data migration and cold data migration. Hot data migration indicates that the data is frequently used, so it is necessary to migrate the hot data from memory with higher latency to memory with lower latency to improve access efficiency. Cold data migration indicates that the data is less frequently used, so it is necessary to migrate the cold data from memory with lower latency to memory with higher latency to ensure that the memory with lower latency has greater capacity.
[0082] The embodiment of the present application does not limit the specific method of distinguishing between hot data and cold data. As an example, the operating system kernel can use a special statistical counter to count. If the number of data accesses is greater than a certain threshold, it is determined to be hot data. If the number of data accesses is less than or equal to a certain threshold, it is determined to be cold data. As another example, the least recently used (LRU) algorithm currently used in memory management in the industry can also be used to divide hot data and cold data. For details, please refer to the relevant technology. The embodiment of the present application will not be described in detail. Depending on the difference between hot and cold data, the data migration instruction issued by the operating system kernel may include a data migration direction, and the data migration direction is used to indicate the migration direction of hot data or the migration direction of cold data. The detailed steps for determining the second memory based on the difference between hot and cold data in the embodiment of the present application are described as follows:
[0083] In one embodiment, the data migration direction includes a first data migration direction. The first data migration direction is used to indicate the migration direction of hot data, and the data to be migrated in the first memory is hot data. Based on this, as shown in FIG5 , the above S401 can be specifically implemented as follows S401a-S401b.
[0084] S401a: The first processor determines, from a data migration mapping table, a first memory set corresponding to the first memory in a first data migration direction.
[0085] The comprehensive access delay of each memory in the first memory set is smaller than the comprehensive access delay of the first memory.
[0086] S401b: The first processor uses the target memory in the first memory set as the second memory.
[0087] The comprehensive access delay of the target memory is less than the comprehensive access delay of other memories in the first memory set.
[0088] As previously described, the data migration table includes a memory set corresponding to the first memory. After receiving the data migration instruction, the first processor determines, based on the first data migration direction, from the data migration mapping table a first memory set corresponding to the first memory in the first data migration direction, and then selects a memory (i.e., a candidate memory) from the first memory set with the smallest comprehensive access latency as the second memory to which the hot data needs to be migrated.
[0089] It should be understood that hot data migration can place hot data in a memory with lower latency, shortening the time it takes for the processor to access the hot data, thereby ensuring the memory access performance of the application.
[0090] In another embodiment, the data migration direction includes a second data migration direction. The second data migration direction is used to indicate the migration direction of cold data, and the data to be migrated in the first memory is cold data. As shown in FIG6 , the above S401 can be specifically implemented as S401c-S401d.
[0091] S401c: The first processor determines, from the data migration mapping table, a second memory set corresponding to the first memory in the second data migration direction.
[0092] The comprehensive access delay of each memory in the second memory set is greater than the comprehensive access delay of the first memory.
[0093] S401d: The first processor uses a memory in the second memory set as the second memory.
[0094] As mentioned above, the data migration table includes a memory set corresponding to the first memory. After receiving the data migration instruction, the first processor determines the first memory set corresponding to the second data migration direction of the first memory from the data migration mapping table according to the second data migration direction, and then selects a memory from the first memory set as the second memory to be migrated as cold data. It should be noted that the memory selected here can be the memory with the smallest comprehensive access delay, the memory with the largest comprehensive access delay, or a random selection, which can be determined according to the actual scenario, and the embodiment of the present application does not make specific limitations on this.
[0095] It should be understood that migrating cold data can free up more memory capacity with lower latency, so that more hot data can be migrated to memory with lower latency, further ensuring the memory access performance of the application.
[0096] The above two implementation modes are described in detail below with reference to specific examples.
[0097] In conjunction with the schematic diagram shown in Figure 3 and the comprehensive memory access latency expression, let's take the example of α taking the first value of 0, the second value of 1, and T_remote taking the value of 100 nanoseconds. For example, if the first processor is CPU0 and memory 1 is connected to CPU0, then the value of α is 0, and the comprehensive access latency of memory 1 is 0×100+100=100 nanoseconds, which means that the comprehensive access latency of memory 1 is equivalent to the actual access latency. If memory 2 is not connected to CPU0, then the value of α is 1, and the comprehensive access latency of memory 2 is 1×100+180=280 nanoseconds. Similarly, the comprehensive access latency of memory 3 and memory 4 is 260 nanoseconds, the comprehensive access latency of memory 5 and memory 6 is 540 nanoseconds, the comprehensive access latency of memory 7 and memory 8 is 500 nanoseconds, and the comprehensive access latency of memory 9 and memory 10 is 600 nanoseconds.
[0098] Furthermore, based on a comparison of comprehensive access latency, for memory 1, no other memory has a shorter comprehensive access latency than memory 1, and the comprehensive access latency of memories 2 through 10 is longer than that of memory 1. Therefore, the first memory set for memory 1 in the hot data migration direction is determined to be empty (NA), and the second memory set for memory 2 in the cold data migration direction includes: memory 3, memory 4, memory 2, memory 7, memory 8, memory 5, memory 6, memory 9, and memory 10 (sorted by comprehensive access latency from smallest to largest). Based on the principles of the above analysis, the data migration mapping table is determined as shown in Table 1 below.
[0099] Table 1
[0100] In Table 1, for CPU0, each memory corresponds to the first memory set in the hot data migration direction and the second memory set in the cold data migration direction. When CPU0 receives the data migration instruction, it can select the second memory set for migration based on Table 1.
[0101] For example, referring to Table 1, if the data accessed by an application running on CPU 0 is located in Memory 5, then Memory 5 is the first memory. After receiving the hot data migration instruction, the CPU can determine from Table 1 that the memory 1, Memory 3, Memory 4, Memory 2, Memory 7, and Memory 8 have a combined access latency less than that of Memory 5. Memory 1 (the target memory) has the shortest combined access latency and is therefore designated as the second memory to which the hot data in Memory 5 should be migrated.
[0102] Similarly, after receiving the cold data migration instruction, CPU 0 can determine from Table 1 that the combined access latency of memory 9 and memory 10 is greater than that of memory 5. Therefore, memory 9 and memory 10 constitute the second memory subset. Since the combined access latency of memory 9 and memory 10 is the same, one of them can be selected as the second memory to which the cold data in memory 5 needs to be migrated.
[0103] It should be noted that the data migration mapping table shown in Table 1 is for CPU0. If it is for CPU1, the data migration mapping table established is as shown in Table 2 below.
[0104] Table 2
[0105] In Table 2, for CPU 1, each memory corresponds to a first memory set in the hot data migration direction and a second memory set in the cold data migration direction. When CPU 1 receives a data migration instruction, it can select the second memory set for migration based on Table 2.
[0106] S402: The first processor migrates the data to be migrated from the first memory to the second memory.
[0107] In an embodiment of the present application, after determining the target location of the data to be migrated, i.e., the second memory, the first processor can migrate the data to be migrated from the first memory to the second memory. The embodiment of the present application does not limit the specific migration process. As an example, the CPU provides a function for data migration (page migration), and the CPU can call this function to implement data migration. As another example, the CPU can establish a process to implement page copying to achieve the purpose of data migration.
[0108] It should be noted that during the data migration process, you may encounter insufficient memory capacity, which will cause the migration to fail. In this case, you need to re-determine a memory for data migration, as described below:
[0109] In one embodiment, in the case of hot data migration, after S402 , the data migration method provided in the embodiment of the present application may further include the following S403 a.
[0110] S403a: In case of migration failure, the memory next to the target memory in the first memory set is used as the second memory in ascending order of comprehensive access latency.
[0111] The next memory refers to a memory in the first memory set that has a larger comprehensive access latency than the target memory but a smaller comprehensive access latency than other memories.
[0112] It should be understood that if hot data migration fails, it indicates that the currently determined second memory capacity is insufficient to accommodate the data to be migrated. Therefore, the first processor can re-determine the next memory from the first memory subset as the new second memory in ascending order of comprehensive latency and perform the data migration operation.
[0113] In some other implementations, in the case of cold data migration, after S402, the data migration method provided in the embodiment of the present application further includes the following S403b.
[0114] S403b: In case of migration failure, a memory is selected from the second memory set as the second memory according to the comprehensive access latency.
[0115] Similarly, if cold data migration fails, the first processor can re-determine the next memory from the second memory subset as the new second memory based on the comprehensive access latency and perform the data migration operation. The selection method here can be selected in order of comprehensive access latency from smallest to largest, or from largest to smallest, depending on the actual scenario and is not specifically limited in this embodiment of the application.
[0116] It should be understood that in the event of migration failure, reselecting the second memory node to retry the migration according to the comprehensive access latency can ensure full utilization of memory capacity while meeting data migration requirements, further ensuring application performance.
[0117] The data migration process is described in detail with examples based on Table 1 or Table 2.
[0118] Taking hot data migration as an example, when CPU0 receives a data migration instruction and needs to migrate the data on memory 5, the first memory set corresponding to memory 5 in the hot data migration direction is determined according to Table 1, which are memory 1, memory 3, memory 4, memory 2, memory 7 and memory 8 from left to right. Therefore, when performing data migration, CPU0 first migrates to memory 1 with the smallest comprehensive access delay. If the migration fails, it then attempts to migrate to memory 3, memory 4, memory 2, memory 7 and memory 8 in turn. It should be understood that when a certain memory migration is successful, it ends and the migration process is no longer attempted on the subsequent memory. When all attempted migrations fail, the migration of the data in memory 5 is canceled.
[0119] Taking cold data migration as an example, when CPU1 receives a data migration instruction and needs to migrate memory 10, CPU1 determines the second memory set corresponding to memory 10 in the cold data migration direction according to Table 2, which are memory 3, memory 4, memory 7 and memory 8 from left to right. Therefore, when performing data migration, CPU1 can select the second memory to attempt migration in the order of comprehensive access latency from small to large (i.e., the order from left to right in the table). It can also select the second memory to attempt migration in the order of comprehensive access latency from large to small (i.e., the order from right to left in the table). Similarly, when a memory migration is successful, it ends and the subsequent memory migration process will not continue. When all migration attempts fail, the migration of the data in memory 10 is canceled.
[0120] The technical solutions provided by the above embodiments bring at least the following beneficial effects. The data migration method provided by the embodiment of the present application, after receiving the data migration instruction, determines the second memory from the data migration mapping table determined based on the comprehensive access delay of each memory, and migrates the data to be migrated to the second memory. Among them, the comprehensive access delay not only takes into account the real access delay of the processor accessing the memory, but also takes into account the performance loss caused by the processor accessing the memory. Compared with the traditional method of determining the second memory to be migrated by considering only the real access delay, the data migration method provided by the embodiment of the present application is more in line with the performance loss that will exist when accessing memory across processors in actual scenarios. Data migration based on this method can give full play to the hardware performance and effectively improve the memory access performance of the application.
[0121] Furthermore, in the event of data migration failure, new memory can be selected for retry based on the size of the comprehensive access latency, ensuring full utilization of memory capacity while meeting the needs of data migration, and further ensuring the memory access performance of the application.
[0122] It should be noted that in the first embodiment, the data migration mapping table is established in advance and is directly used during data migration. In other embodiments, the data migration mapping table can be obtained after the first processor receives the data migration instruction. For detailed description, see the following embodiments 2 to 4.
[0123] Example 2
[0124] FIG7 is a flow chart of a data migration method provided in Example 2 of the present application. For example, as shown in FIG7 , the data migration method provided in Example 2 of the present application may specifically include the following steps:
[0125] S701. In response to a data migration instruction, obtain memory information of each memory; based on the memory information, obtain a memory relationship mapping table; based on the memory relationship mapping table, obtain a memory latency table; based on the memory latency table and the memory's comprehensive access latency size sorting, obtain a data migration mapping table.
[0126] The memory relationship mapping table includes the connection mode between each processor in the plurality of processors and the memory connected thereto, and the memory latency table includes the comprehensive access latency from the first processor to each memory.
[0127] In an embodiment of the present application, when the computing device is started, multiple processors all perform a self-test process to select a processor (such as a main processor) from the multiple processors, and the main processor is responsible for calling the BIOS to start the process of executing the power-on self-test. Furthermore, during the power-on self-test process, the BIOS can scan the memory in the computing device and obtain relevant information about the memory, including the identification of the memory, the memory timing, the connection method between the memory and the processor, etc. Among them, the memory timing is a parameter that describes the performance of the memory and can determine the actual access delay of the memory. In some implementations, the BIOS can also scan the memory in the computing device to obtain information such as the memory size and the distance between the memory and the processor.
[0128] Furthermore, after the operating system is started, the operating system kernel can call the Advanced Configuration and Power Management Interface (ACPI) to obtain information such as memory identification, memory timing, and the connection method between the memory and the processor from the BIOS. Among them, ACPI is a standard interface that defines the communication interface between the operating system, firmware, and hardware. ACPI is usually implemented in the BIOS and controlled by the operating system driver. After the operating system kernel obtains the memory timing of each memory, it can measure the actual access delay of each processor accessing the memory based on the memory timing. For details, please refer to the relevant technology and will not be described in detail here.
[0129] After receiving the data migration instruction, the first processor may obtain memory information issued by the operating system kernel, such as a memory identifier, actual memory access latency, and a connection method between the memory and the processor. Based on this memory information, the first processor may obtain a memory relationship mapping table, which may be stored in a memory. The table is primarily used to reflect different connection methods between the processor and memory in the computing device.
[0130] For example, Table 3 is a memory mapping relationship table provided in an embodiment of the present application.
[0131] Table 3
[0132] Table 3 shows two processors (CPU0 and CPU1) and multiple memory devices connected to each processor. The memory devices are divided into three groups, and the connection methods between the memory devices and the corresponding processors in different groups vary. For example, the connection methods include direct connection, connection via CXL, and connection via a CXL switch chip.
[0133] Furthermore, in combination with the above Table 3, based on the above expression for determining the comprehensive access delay, a memory delay table is obtained, and the table can be stored in the memory.
[0134] Taking CPU0 as the first processor as an example, it can be seen from Table 3 that memory 1, memory 3, memory 4, memory 7, and memory 8 are memories connected to CPU0. According to the above analysis, it can be determined that the combined access delay of these memories is the real access delay. Other memories are not connected to the CPU, so the value of α is 1. For example, continuing to take the value of T_remote as 100 nanoseconds, the combined access delay of memory 2 is 1×100+180=280 nanoseconds, the combined access delay of memory 5 and memory 6 is 1×100+440=540 nanoseconds, and the combined access delay of memory 9 and memory 10 is 1×100+500=600 nanoseconds. Based on the above analysis, the memory latency table obtained by the first processor is shown in Table 4 below.
[0135] Table 4
[0136] Similarly, taking CPU1 as the first processor as an example, the memory latency table obtained by the first processor is shown in Table 5 below:
[0137] Table 5
[0138] Finally, based on the memory latency table and the memory's comprehensive access latency ranking, the first processor can obtain a data migration table. For example, taking CPU0 as the first processor, the data migration table obtained by the first processor based on Table 4 is shown in Table 1. Taking CPU1 as the first processor, the data migration table obtained by the first processor based on Table 5 is shown in Table 2.
[0139] S702: The first processor determines a second memory from a data migration mapping table.
[0140] S703: The first processor migrates the data to be migrated from the first memory to the second memory.
[0141] For the related descriptions of S702 and S703 above, reference can be made to the related descriptions in the aforementioned embodiment 1, which will not be repeated here.
[0142] Example 3
[0143] FIG8 is a flow chart of a data migration method provided in Example 3 of the present application. For example, as shown in FIG8 , the data migration method provided in Example 3 of the present application may specifically include the following steps:
[0144] S801 . In response to a data migration instruction, obtain a memory latency table based on a memory relationship mapping table; and obtain a data migration mapping table based on the memory latency table and the size sorting of the comprehensive access latency of the memory.
[0145] In an embodiment of the present application, the BIOS can obtain the identifier of each memory and the connection relationship between the memory and the processor during the power-on self-test process, and construct a memory relationship mapping table as described in Table 3 above based on this information, or report this information to the operating system kernel, and the operating system kernel instructs any processor to construct a memory relationship mapping table and store it in the memory. When the first processor receives the data migration instruction, it can obtain the memory relationship mapping table from the memory, and based on the memory relationship mapping table and the actual access delay of the memory, obtain the memory delay table shown in Table 4 or Table 5 above. Then, based on the memory delay table and the comprehensive access delay size sorting of the memory, obtain the data migration mapping table shown in Table 1 or Table 2 above.
[0146] S802: The first processor determines a second memory from a data migration mapping table.
[0147] S803: The first processor migrates the data to be migrated from the first memory to the second memory.
[0148] For the related descriptions of S802 and S803 above, reference may be made to the related descriptions in the aforementioned embodiment 1, which will not be repeated here.
[0149] Example 4
[0150] FIG9 is a flow chart of a data migration method provided in Example 4 of the present application. For example, as shown in FIG9 , the data migration method provided in Example 4 of the present application may include the following steps:
[0151] S901. In response to a data migration instruction, obtain a memory latency table; and obtain a data migration table based on the memory latency table and the size sorting of the comprehensive access latency of the memory.
[0152] In an embodiment of the present application, the operating system kernel can, in conjunction with memory-related information reported by the BIOS, instruct any one or more processors to pre-build a memory latency table corresponding to each processor and store it in the memory. Upon receiving the data migration instruction, the first processor can retrieve the corresponding memory latency table from the memory, and then, based on the memory latency table and the memory's comprehensive access latency ranking, retrieve the data migration table shown in Table 1 or Table 2 above.
[0153] S902: Determine a second memory from the data migration mapping table.
[0154] S903: Migrate the data to be migrated from the first memory to the second memory.
[0155] For the related descriptions of S902 and S903 above, please refer to the related descriptions in the aforementioned embodiment 1, which will not be repeated here.
[0156] The beneficial effects of the above-mentioned embodiments 2 to 4 can be found in the relevant description of embodiment 1.
[0157] Figure 10 is a schematic diagram of a system architecture provided by an embodiment of the present application. As shown in Figure 10, from top to bottom in the figure are application (application, APP), user state and kernel state. Among them, user state and kernel state are two operating levels of the operating system. Most applications (application, APP) used directly by users, such as Redis database or HANA memory database, run in user state. When the application involves operations on hardware (for example, migrating data in memory in the embodiment of the present application), the operating level of user state only supports the execution of hardware operation-related instructions, and it is necessary to switch to kernel state to execute the relevant instructions of hardware operations. Among them, the glibc library is a C runtime library that can run in user state. The glibc library provides the application programming interface (application programming interface, API) at the bottom of the operating system. Users can configure the policy of the data migration method provided by the embodiment of the present application based on the API interface provided by the glibc library. The kernel state includes a memory relationship mapping table creation module, a cold and hot data migration target memory calculation module and a page migration module. These modules are implemented by users writing code through the API interface. Among them, the memory relationship mapping table creation module is used to establish a memory mapping relationship table (Table 3 above) according to the user-configured policy. Further, the hot and cold data migration target memory calculation module establishes a hot data migration target memory list and a cold data migration target memory list (Table 1 or Table 2 above) of different computing nodes based on the relationship mapping table, and the page migration module performs page migration scheduling (data migration).
[0158] It can be seen that the above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. In order to achieve the above functions, the embodiment of the present application provides a hardware structure and / or software module corresponding to the execution of each function. Those skilled in the art should easily appreciate that, in combination with the modules 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 function is executed in a hardware or computer software driven hardware manner 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 be beyond the scope of this application.
[0159] In an exemplary embodiment, the embodiment of the present application further provides a data migration device. The data migration device may include one or more functional modules for implementing the data migration method of the above method embodiment. For example, Figure 11 is a schematic diagram of the composition of a data migration device provided in an embodiment of the present application. The data migration device can be applied to a first processor, which is one of a plurality of processors included in a computing device, and each of the plurality of processors is connected to at least one memory; the first memory accessed by the first processor includes data to be migrated. As shown in Figure 11, the device includes: a determination module 1101 and a migration module 1102.
[0160] The determination module 1101 is used to determine the second memory from the data migration mapping table; the data migration mapping table includes a memory set corresponding to the first memory, the second memory is one of the memory sets, the memory set corresponding to the first memory is obtained based on the comprehensive access delay of each memory, the comprehensive access delay of each memory is determined based on the actual access delay from the first processor to the memory, and the equivalent access delay from the first processor to the memory, and the equivalent access delay is used to indicate the performance loss when the first processor accesses the memory.
[0161] The migration module 1102 is configured to migrate the data to be migrated from the first memory to the second memory.
[0162] In some embodiments, the data migration mapping table is stored in a memory of the computing device; the determination module 1101 is specifically configured to, in response to a data migration instruction, obtain the data migration mapping table from the memory; and determine the second memory from the data migration mapping table.
[0163] In some embodiments, the apparatus further includes an acquisition module 1103. The acquisition module 1103 is configured to acquire a memory latency table, the memory latency table including a comprehensive access latency from the first processor to each memory; and acquire a data migration mapping table based on the memory latency table and the memory's comprehensive access latency ranking.
[0164] In some embodiments, the acquisition module 1103 is also used to obtain a memory latency table based on a memory relationship mapping table; the memory relationship mapping table includes the connection method between each processor in a plurality of processors and the memory connected to it; the memory relationship mapping table is determined by the memory information of each memory; the memory latency table includes the comprehensive access delay from the first processor to each memory; based on the memory latency table and the comprehensive access delay size sorting of the memory, a data migration mapping table is obtained.
[0165] In some embodiments, the acquisition module 1103 is also used to obtain memory information of each memory; based on the memory information, obtain a memory relationship mapping table; the memory relationship mapping table includes the connection method between each processor in a plurality of processors and the memory connected to each processor; obtain a memory delay table based on the memory relationship mapping table; the memory delay table includes the comprehensive access delay from the first processor to each memory; based on the memory delay table and the comprehensive access delay size sorting of the memory, obtain a data migration mapping table.
[0166] In some embodiments, the comprehensive access latency of each memory in the data migration mapping table satisfies: T_total=T_equal+T_real
[0167] T_total represents the total access latency, T_real represents the real access latency, and T_equal represents the equivalent access latency.
[0168] In some embodiments, the equivalent access latency satisfies: T_equal=α×T_remote
[0169] Among them, when the memory is connected to the first processor, α is the first value; when the memory is connected to the second processor, α is the second value; the second processor is one of the multiple processors except the first processor; the second value is greater than the first value; T_remote represents the delay conversion coefficient corresponding to the performance loss when the first processor accesses the memory when the memory is connected to the second processor.
[0170] In some embodiments, a first data migration direction; the first data migration direction is used to indicate the migration direction of hot data; the determination module 1101 is specifically used to determine the first memory set corresponding to the first memory in the first data migration direction from the data migration mapping table; the comprehensive access delay of each memory in the first memory set is less than the comprehensive access delay of the first memory; the target memory in the first memory set is used as the second memory, and the comprehensive access delay of the target memory is less than the comprehensive access delay of other memories in the first memory set.
[0171] In some embodiments, the migration module 1102 is further configured to, in the event of migration failure, use the next memory of the target memory in the first memory set as the second memory in ascending order of comprehensive access latency.
[0172] In some embodiments, the data migration instruction includes: a second data migration direction; the second data migration direction is used to indicate the migration direction of cold data; the determination module 1101 is specifically used to determine the second memory set corresponding to the first memory in the second data migration direction from the data migration mapping table; the comprehensive access delay of each memory in the second memory set is greater than the comprehensive access delay of the first memory; and one of the memories in the second memory set is used as the second memory.
[0173] In some embodiments, the migration module 1102 is further configured to, in the event of a migration failure, reselect a memory from the second memory set as the second memory according to the comprehensive access latency.
[0174] In some embodiments, the connection mode between the at least one memory and the processor includes one or more of the following modes: direct connection, connection via a Compute Express Link (CXL), and connection via a CXL switch chip.
[0175] In the case of implementing the functions of the above-mentioned integrated modules in hardware, an embodiment of the present application provides a schematic diagram of the structure of a computing device, which can be the above-mentioned data migration device. As shown in Figure 12, the computing device 1200 includes: a processor 1202, a communication interface 1203, and a bus 1204. Optionally, the computing device may also include a memory 1201.
[0176] The processor 1202 may implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of the embodiments of this application. The processor 1202 may be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array, or other programmable logic device, a transistor logic device, a hardware component, or any combination thereof. The processor 1202 may implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of the embodiments of this application. The processor 1202 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
[0177] The communication interface 1203 is used to connect to other devices via a communication network, such as Ethernet, wireless access network, wireless local area network (WLAN), etc.
[0178] The memory 1201 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a 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.
[0179] As a possible implementation, memory 1201 can exist independently of processor 1202. Memory 1201 can be connected to processor 1202 via bus 1204 to store instructions or program codes. When processor 1202 calls and executes the instructions or program codes stored in memory 1201, the data migration method provided in the embodiments of the present application can be implemented.
[0180] In another possible implementation, the memory 1201 may also be integrated with the processor 1202 .
[0181] Bus 1204 can be an Extended Industry Standard Architecture (EISA) bus, etc. Bus 1204 can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, FIG12 shows only one thick line, but this does not mean that there is only one bus or only one type of bus.
[0182] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the data migration device can be divided into different functional modules to complete all or part of the functions described above.
[0183] The embodiment of the present application also provides a computer-readable storage medium. All or part of the processes in the above-mentioned method embodiment can be completed by computer instructions to the relevant hardware, and the program can be stored in the above-mentioned computer-readable storage medium. When the program is executed, it may include the processes of the above-mentioned method embodiments. The computer-readable storage medium can be the memory of any of the aforementioned embodiments. The above-mentioned computer-readable storage medium can also be an external storage device of the above-mentioned data migration device, such as a plug-in hard disk, a smart memory card (smart media card, SMC), a secure digital (secure digital, SD) card, a flash card (flash card), etc. equipped on the above-mentioned data migration device. Furthermore, the above-mentioned computer-readable storage medium can also include both the internal storage unit of the above-mentioned data migration device and an external storage device. The above-mentioned computer-readable storage medium is used to store the above-mentioned computer program and other programs and data required by the above-mentioned data migration device. The above-mentioned computer-readable storage medium can also be used to temporarily store data that has been output or is to be output.
[0184] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program product runs on a computer, it enables the computer to execute any one of the data migration methods provided in the above embodiments.
[0185] Although the present application is described herein in conjunction with various embodiments, in the process of implementing the claimed application, those skilled in the art may understand and implement other variations of the disclosed embodiments by reviewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "one" or "an" does not exclude multiple components. A single processor or other unit may implement several functions listed in the claims. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.
[0186] Although the present application has been described with reference to specific features and embodiments thereof, it is apparent that various modifications and combinations may be made thereto without departing from the spirit and scope of the present application. Accordingly, this specification and the drawings are merely illustrative of the present application as defined by the appended claims and are deemed to cover any and all modifications, variations, combinations or equivalents within the scope of the present application. Obviously, those skilled in the art may make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, the present application is intended to include such modifications and variations as fall within the scope of the claims of the present application and their equivalents.
[0187] The above are only specific embodiments of the present application, but the scope of protection of the present application is not limited thereto. Any changes or replacements 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 data migration method, characterized in that: Applied to a first processor, the first processor is one of a plurality of processors included in a computing device, each of the plurality of processors being connected to at least one memory; The first memory accessed by the first processor includes data to be migrated; the method includes: In response to the data migration instruction, determining a second memory from a data migration mapping table; the data migration mapping table includes a memory set corresponding to the first memory, the second memory is one of the memory sets, the memory set corresponding to the first memory is obtained based on the comprehensive access delay of each memory, the comprehensive access delay of each memory is determined according to the real access delay from the first processor to the memory, and the equivalent access delay from the first processor to the memory, the equivalent access delay is used to indicate the performance loss when the first processor accesses the memory; Migrate the data to be migrated from the first memory to the second memory.
2. The method according to claim 1, characterized in that The data migration mapping table is stored in the memory of the computing device; The step of determining the second memory from the data migration mapping table in response to the data migration instruction comprises: In response to the data migration instruction, acquiring the data migration mapping table from the memory; A second memory is determined from the data migration mapping table.
3. The method according to claim 1, characterized in that After responding to the data migration instruction, the method further includes: Obtain a memory latency table, where the memory latency table includes a comprehensive access latency from the first processor to each memory; Based on the memory latency table and the order of the comprehensive access latency of the memory, the data migration mapping table is obtained.
4. The method according to claim 1, characterized in that: After responding to the data migration instruction, the method further includes: Acquire a memory latency table based on a memory relationship mapping table; the memory relationship mapping table includes a connection mode between each processor of the multiple processors and the memory connected to each processor; the memory relationship mapping table is determined by the memory information of each memory; the memory latency table includes a comprehensive access latency from the first processor to each memory; Based on the memory latency table and the order of the comprehensive access latency of the memory, the data migration mapping table is obtained.
5. The method according to claim 1, characterized in that After responding to the data migration instruction, the method further includes: Obtaining memory information of each memory; Based on the memory information, a memory relationship mapping table is obtained; the memory relationship mapping table includes a connection mode between each processor in the plurality of processors and the memory connected to each processor; Acquire a memory latency table based on the memory relationship mapping table; the memory latency table includes a comprehensive access latency from the first processor to each memory; Based on the memory latency table and the order of the comprehensive access latency of the memory, the data migration mapping table is obtained.
6. The method according to any one of claims 1 to 5, characterized in that: The comprehensive access delay of each memory in the data migration mapping table satisfies: T_total = T_equal + T_real Among them, T_total represents the comprehensive access delay, T_real represents the real access delay, and T_equal represents the equivalent access delay.
7. The method according to claim 6, characterized in that The equivalent access delay satisfies: T_equal = α × T_remote When the memory is connected to the first processor, α is a first value; when the memory is connected to a second processor, α is a second value; the second processor is the processor except the first processor among the multiple processors. one of the processors; the second value is greater than the first value; the T_remote represents the delay conversion coefficient corresponding to the performance loss when the first processor accesses the memory when the memory is connected to the second processor.
8. The method according to any one of claims 1 to 7, characterized in that: The data migration instruction includes: a first data migration direction; the first data migration direction is used to indicate the migration direction of hot data; The determining the second memory from the data migration mapping table includes: Determine a first memory set corresponding to the first memory in the first data migration direction from the data migration mapping table; the comprehensive access delay of each memory in the first memory set is less than the comprehensive access delay of the first memory; A target memory in the first memory set is used as the second memory, and a comprehensive access delay of the target memory is smaller than a comprehensive access delay of other memories in the first memory set.
9. The method according to claim 8, characterized in that After migrating the data to be migrated from the first memory to the second memory, the method further includes: In the case of migration failure, the next memory of the target memory in the first memory set is used as the second memory in the order of the comprehensive access latency from small to large.
10. The method according to any one of claims 1 to 7, characterized in that: The data migration instruction includes: a second data migration direction; the second data migration direction is used to indicate the migration direction of cold data; The determining the second memory from the data migration mapping table includes: Determine from the data migration mapping table a second memory set corresponding to the first memory in the second data migration direction; the comprehensive access delay of each memory in the second memory set is greater than the comprehensive access delay of the first memory; A memory in the second memory set is used as the second memory.
11. The method according to any one of claims 1 to 10, characterized in that: The connection mode between the at least one memory and the processor includes one or more of the following modes: direct connection, connection through a computing express link CXL, and connection through a CXL switching chip.
12. A computing device, characterized in that: The computing device includes a plurality of processors, each of the plurality of processors is connected to at least one memory, a first processor is one of the plurality of processors, and the first processor is used to: In response to the data migration instruction, determining a second memory from a data migration mapping table; the data migration mapping table includes a memory set corresponding to the first memory, the second memory is one of the memory sets, the memory set corresponding to the first memory is obtained based on the comprehensive access delay of each memory, the comprehensive access delay of each memory is determined according to the real access delay from the first processor to the memory, and the equivalent access delay from the first processor to the memory, the equivalent access delay is used to indicate the performance loss when the first processor accesses the memory; Migrate the data to be migrated from the first memory to the second memory.
Citation Information
Patent Citations
Data migration method and device, equipment and medium
CN110413590A
Method, equipment, computer equipment and system for realizing memory sharing control
CN115080262A
Method and device for expanding memory and related equipment
CN115794669A
Data migration method and computing device
CN116521608A
Memory balancing method for virtual system
KR1020150097981A
