Heterogeneous memory page migration device and method and readable storage medium
By handling remote page migration by itself in heterogeneous memory page migration devices, the problem of remote page access delay in heterogeneous computing systems is solved, and more efficient memory page migration is achieved, and system performance is improved.
Patent Information
- Application Number
- CN202510884103.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-27
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2045-06-27
AI Technical Summary
In heterogeneous computing systems, the delay and performance overhead caused by triggering page errors when the computing unit accesses a remote page is long. The existing UM mechanism needs to wake up the central processor to process page migration, affecting the system efficiency.
Provides a heterogeneous memory page migration device and method, which handles remote page migration by the communicator and processor in the migration unit, directly transmits page content and updates page table entries in the local memory frame to avoid waking up the central processor.
Reduces the performance overhead and wake-up time of the central processor, saves heterogeneous memory page migration time, and improves system performance.
Smart Images

Figure CN120371550A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data processing, and particularly to a heterogeneous memory page migration device, method, and readable storage medium. Background Art
[0002] With the multiple requirements of multi-function, high-performance, and low-power consumption, heterogeneous computing systems have emerged. The system architecture consists of multiple different types of computing units, and each computing unit is usually equipped with specific memory resources, which together form a heterogeneous memory structure. When an application runs, it needs to migrate pages between heterogeneous memories to achieve efficient sharing of data between computing units. Therefore, how to handle the page migration between heterogeneous memories is crucial.
[0003] Currently, the migration of heterogeneous memory pages (also known as remote pages) usually relies on the Unified Memory (UM) mechanism, which enables different computing units to share data using the same pointer by providing a single virtual address space. However, when a computing unit accesses a remote page and triggers a page fault, an interrupt needs to be sent through a general standard interface (such as PCIe) to wake up the driver on the Central Processing Unit (CPU) to handle the page migration. Since this process involves CPU intervention and bus communication, it brings obvious latency and performance overhead to heterogeneous computing systems that require efficient processing. Summary of the Invention
[0004] This application provides a heterogeneous memory page migration device, method, and readable storage medium to at least solve the problem of long time consumption in the related art when a computing unit accesses a remote page and triggers a page fault.
[0005] This application provides a heterogeneous memory page migration device, including: A first computing unit, a migration unit, and a memory unit, and the first computing unit, the migration unit, and the memory unit are electrically connected respectively; The migration unit includes a communicator and a processor, and the communicator and the processor are electrically connected; The communicator is configured to: receive an address conversion request; the address conversion request is a request sent when the first computing unit accesses a target page and misses the address translation cache, and includes the virtual page identifier of the target page; The processor is configured to: When determining that the target page is a remote page according to the first page table entry corresponding to the virtual page identifier, determine a local memory frame from the memory unit to obtain the local physical frame number of the local memory frame; the remote page is a memory page corresponding to a second computing unit in the heterogeneous computing system; the first page table entry includes the mapping relationship between the virtual page identifier and the physical frame number; Transmit the page content of the remote page to the local memory frame according to the remote physical frame number in the first page table entry; Replace the remote physical frame number in the first page table entry with the local physical frame number to obtain a second page table entry; The communicator is further configured to: return the second page table entry to the first computing unit.
[0006] This application provides a method for migrating heterogeneous memory pages, including: Receive an address translation request; the address translation request is a request sent when the first computing unit in the heterogeneous computing system accesses the target page and misses the address translation cache, and includes the virtual page identifier of the target page; When determining that the target page is a remote page according to the first page table entry corresponding to the virtual page identifier, determine a local memory frame from the memory of the first computing unit to obtain the local physical frame number of the local memory frame; the remote page is a memory page corresponding to a second computing unit in the heterogeneous computing system; the first page table entry includes the mapping relationship between the virtual page identifier and the physical frame number; Transmit the page content of the remote page to the local memory frame according to the remote physical frame number in the first page table entry; Replace the remote physical frame number in the first page table entry with the local physical frame number to obtain a second page table entry, and return the second page table entry to the first computing unit.
[0007] This application further provides a device for migrating heterogeneous memory pages, including: An acquisition module, configured to receive an address translation request; the address translation request is a request sent when the first computing unit in the heterogeneous computing system accesses the target page and misses the address translation cache, and includes the virtual page identifier of the target page; A determination module, configured to determine a local memory frame from the memory of the first computing unit to obtain the local physical frame number of the local memory frame when determining that the target page is a remote page according to the first page table entry corresponding to the virtual page identifier; the remote page is a memory page corresponding to a second computing unit in the heterogeneous computing system; the first page table entry includes the mapping relationship between the virtual page identifier and the physical frame number; A transmission module, configured to transmit the page content of the remote page to the local memory frame according to the remote physical frame number in the first page table entry; A processing module, configured to replace the remote physical frame number in the first page table entry with a local physical frame number to obtain a second page table entry, and return the second page table entry to the first computing unit.
[0008] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned heterogeneous memory page migration method are implemented.
[0009] The present application also provides a computer program product, including a computer program. When the computer program is executed by a processor, the steps of the above-mentioned heterogeneous memory page migration method are implemented.
[0010] Through the present application, when it is determined that the target page in the address translation request is a remote page, the page content of the remote page can be automatically transferred to the local memory frame according to the remote physical frame number in the first page table entry, and the remote physical frame number in the first page table entry is replaced with the local physical frame number and returned to the first computing unit. This avoids waking up the central processing unit through a general standard interface and then asynchronously processing the migration of the remote page through the driver of the central processing unit. Therefore, there is no need to separately wake up the central processing unit in the heterogeneous computing system to asynchronously process the situation of remote page access errors. In this way, on the one hand, the impact on the performance overhead of the central processing unit is avoided, and the time for waking up the central processing unit is saved. On the other hand, the time overhead caused by asynchronous processing is also avoided, further saving the time for heterogeneous memory page migration. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] To more clearly illustrate the embodiments of the present application, the following will briefly introduce the drawings required in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0012] Figure 1 FIG. 18 is a schematic structural diagram of a heterogeneous interconnection system for multi-accelerators provided by an embodiment of the present application; Figure 2 FIG. 21 is a schematic structural diagram of a heterogeneous memory page migration device provided by an embodiment of the present application; Figure 3 FIG. 24 is one of the flowcharts of the heterogeneous memory page migration method provided by an embodiment of the present application; Figure 4 FIG. 27 is one of the application scenarios of the heterogeneous memory page migration method provided by an embodiment of the present application; Figure 5 FIG. 30 is the second flowchart of the heterogeneous memory page migration method provided by an embodiment of the present application; Figure 6The second application scenario of the heterogeneous memory page migration method provided by the embodiments of the present application; Figure 7 The third flowchart of the heterogeneous memory page migration method provided by the embodiments of the present application; Figure 8 The fourth flowchart of the heterogeneous memory page migration method provided by the embodiments of the present application; Figure 9 The fifth flowchart of the heterogeneous memory page migration method provided by the embodiments of the present application; Figure 10 The sixth flowchart of the heterogeneous memory page migration method provided by the embodiments of the present application; Figure 11 The seventh flowchart of the heterogeneous memory page migration method provided by the embodiments of the present application; Figure 12 The eighth flowchart of the heterogeneous memory page migration method provided by the embodiments of the present application; Figure 13 The structural schematic diagram of a heterogeneous memory page migration device provided by the embodiments of the present application. Detailed implementation manners
[0013] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0014] It should be noted that in the description of the present application, the terms "include", "comprise" or any other variant thereof are intended to cover a non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in the present application are used to distinguish similar objects and not to describe a specific order or sequence.
[0015] To enable those skilled in the art of the present technology to better understand the solution of the present application, the present application will be further described in detail below in conjunction with the accompanying drawings and specific implementation manners.
[0016] A heterogeneous computing system refers to a system composed of different types of computing units, such as CPUs, Graphics Processing Units (GPUs), Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), etc., which can achieve multi-functional, high-performance, and low-power consumption computing task processing.
[0017] Exemplarily, Figure 1 FIG. is a schematic structural diagram of a heterogeneous interconnection system for multiple accelerators provided by an embodiment of the present application. As Figure 1 shown, the system includes multiple heterogeneous computing systems 100 and an interconnection structure 200. Among them, the heterogeneous computing systems 100 can achieve high-speed consistent data sharing and communication through the interconnection structure 200.
[0018] In some embodiments, in the heterogeneous interconnection system for multiple accelerators as Figure 1 shown, each heterogeneous computing system respectively includes multiple computing nodes, such as ASICs, FPGAs, GPUs, CPUs, and multiple storage units, such as Storage-Class Memory (SCM), Dynamic Random Access Memory (DRAM).
[0019] In some embodiments, the interconnection structure 200 is a structure for high-speed communication between the heterogeneous computing systems 100. For example, the interconnection technology adopted can be Compute Express Link (CXL), Peripheral Component Interconnect Express (PCIe), Cache Coherent Interconnect for Accelerators (CCIX), etc.
[0020] In the above heterogeneous computing system, the application program needs to allocate tasks and share data among different computing nodes. The data sharing of traditional heterogeneous computing systems relies on users to manually perform memory copy operations, such as using the Memory Memcpy function for memory copy operations. This method not only requires relevant personnel to manage the data migration process tediously and is extremely error-prone, but also the copy operation will affect the execution of the core processing logic of the computing node, significantly increasing the execution time. At the same time, the memory capacity of some computing nodes is limited (such as ASIC), which restricts the scale of data processing, prompting people to seek more efficient memory management solutions.
[0021] In view of the above situation, the UM mechanism is proposed to provide a single virtual address space, enabling different computing nodes to share data using the same pointer and supporting memory oversubscription, significantly improving programming convenience. However, under the UM mechanism, when a computing node accesses a remote page and triggers a page fault, an interrupt needs to be issued through a general standard interface to wake up the driver on the central processing unit. Then, the driver is responsible for handling page migration and updating the page table. The software processing delay of this process is as high as 20µs - 50µs, resulting in frequent pauses in the execution of the computing node, making the execution efficiency of the computing node running under the UM mechanism much lower than that of the manual memory copy method. Although there are various prefetching and eviction mechanisms dedicated to reducing the UM overhead, such as sequential local prefetchers and tree-based neighborhood prefetchers, as well as different eviction strategies, such as variants related to Least Recently Used (LRU), these solutions can only reduce the number of page faults. Due to the still long page fault handling delay, when dealing with applications with irregular memory access patterns, the performance improvement is limited and may even lead to performance degradation.
[0022] In view of the above problems, the embodiments of the present application provide a heterogeneous memory page migration device, method, and readable storage medium. The method includes, when determining that the target page in the address translation request is a remote page, according to the remote physical frame number in the first page table entry, transmitting the page content of the remote page to the local memory frame, and replacing the remote physical frame number in the first page table entry with the local physical frame number and returning it to the first computing unit. In this way, it is avoided to wake up the central processing unit through the general standard interface and then asynchronously process the migration of the remote page through the driver of the central processing unit. There is no longer a need to wake up a separate central processing unit in the heterogeneous computing system to asynchronously process remote page access errors, thereby significantly reducing the pause time of the first computing unit and improving the system performance of the heterogeneous computing system.
[0023] Figure 2 It is a schematic structural diagram of a heterogeneous memory page migration device provided by an embodiment of the present application. Refer to Figure 1, the migration device of the heterogeneous memory page can be used as any computing node in the heterogeneous computing system to perform heterogeneous interactions (such as remote page access) with other computing nodes in the heterogeneous computing system. Therefore, the method for migrating heterogeneous memory pages in this application can be applied to the migration device of the heterogeneous memory page. Refer to Figure 2 As shown, the migration device of the heterogeneous memory page includes a first computing unit 21, a migration unit 20, and a memory unit 22. The first computing unit 21, the migration unit 20, and the memory unit 22 are electrically connected respectively. For example, they are electrically connected through a bus.
[0024] Among them, the first computing unit 21 serves as the computing core of the migration device of the heterogeneous memory page, and is mainly responsible for processing a large number of tasks assigned by the heterogeneous computing system correspondingly. For example, it performs remote page access to the memory of the computing unit in other computing nodes. The memory unit 22 is mainly used to store the task data corresponding to the first computing unit 21.
[0025] The migration unit 20 includes a processor 202 and a communicator 201.
[0026] Among them, the communicator 201 is electrically connected to the processor 902. The communicator 201 is used to interact with other devices. For example, the communicator 201 supports the migration unit 20 to receive the address translation request of the first computing unit 21, and supports returning the second page table entry to the first computing unit 21 when the processor 202 determines the second page table entry.
[0027] The processor 202 can be a central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of this application solution. For example, when the processor 202 determines that the target page is a remote page according to the first page table entry corresponding to the virtual page identifier, it determines the local memory frame from the memory unit 22 to obtain the local physical frame number of the local memory frame; the remote page is the memory page corresponding to the second computing unit in other nodes of the heterogeneous computing system; the first page table entry includes the mapping relationship between the virtual page identifier and the physical frame number; it transmits the page content of the remote page to the local memory frame according to the remote physical frame number in the first page table entry; it replaces the remote physical frame number in the first page table entry with the local physical frame number to obtain the second page table entry.
[0028] Such as Figure 2As shown, the migration unit 20 may further include a memory 203. The memory 203 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM), or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media, or other magnetic storage devices, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. Among them, the memory 203 may be used to store the application program code related to the implementation of the solution of this application and is controlled by the processor 202 for execution. For example, the memory stores the reverse page group table in the memory unit 22, and the memory stores the area available bitmap in the static random access memory (not shown in the figure) of the first computing unit 21.
[0029] As Figure 2 shown, the heterogeneous memory page migration device may further include a monitor 204. Among them, the monitor 204 may be used for real-time monitoring, recording, or analyzing the status of each hardware or software. For example, the monitor 204 monitors and maintains the number of frame numbers of the memory frame numbers in the target candidate queue.
[0030] It should be noted that Figure 2 the device structure shown in Figure 2 does not constitute a limitation on the heterogeneous memory page migration device. In addition to
[0031] the components shown, the heterogeneous memory page migration device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements. And the heterogeneous memory page migration device provided in the embodiments of this application can execute the heterogeneous memory page migration method provided in the method embodiments. The implementation principle and technical effects can be seen in the following method embodiments and will not be elaborated here. Figure 2The migration device for heterogeneous memory pages). When the migration device for heterogeneous memory pages is software, it can be installed in the above-mentioned hardware unit. It can be implemented as multiple software or software modules, or as a single software or software module. No specific limitation is made here.
[0032] Figure 3 This is a schematic flowchart of a method for migrating heterogeneous memory pages provided by an embodiment of the present application. As Figure 3 shown, the method for migrating heterogeneous memory pages may include the following steps: S11. Receive an address translation request.
[0033] Among them, the address translation request is a request sent when the first computing unit in the heterogeneous computing system accesses the target page and misses the translation lookaside buffer (TLB), and includes the virtual page identifier of the target page. The first computing unit is a computing core in any computing node (such as an ASIC) in the heterogeneous computing system.
[0034] Specifically, when the first computing unit in the heterogeneous computing system encounters a remote page access resulting in a TLB miss, the first computing unit generates an address translation request including the virtual page identifier of the remote page (i.e., the target page) and sends it to the migration unit. Exemplarily, in the scenario as Figure 4 shown, when the first computing unit encounters a remote page access resulting in a TLB miss, it generates an address translation request including the virtual page identifier of the remote page and sends it to the migration unit.
[0035] S12. When it is determined that the target page is a remote page according to the first page table entry corresponding to the virtual page identifier, determine a local memory frame from the memory of the first computing unit to obtain the local physical frame number of the local memory frame.
[0036] Among them, the remote page is a memory page corresponding to a second computing unit different from the first computing unit in the heterogeneous computing system. The first page table entry includes the mapping relationship between the virtual page identifier and the physical frame number, and this physical frame number can be the physical frame number of the local memory or the physical frame number of the remote memory. The page table is a data structure used to implement the mapping from the virtual address to the physical address. Multiple page table entries (Page Table Entries, PTEs) are maintained in the page table, and each page table entry records the mapping relationship between the virtual page identifier of a virtual page and the physical frame number. The virtual page identifier is an identifier that can uniquely identify a page. For example, it can be the number of the virtual page or the address of the virtual page.
[0037] First, determine whether the target page is a remote page according to the first page table entry corresponding to the virtual page identifier. Specifically, to determine whether the target page is a remote page, it can be achieved by analyzing the correspondence between its virtual page identifier and the current process page table or the system memory mapping. For example, check whether the virtual page identifier hits in the local page table; if not, then determine whether it exists in the page table of other computing units, or identify it as a remote page through the page directory flag.
[0038] In some embodiments, as Figure 4 shown, the migration unit of the heterogeneous memory page migration device may include a Page Table Walker (PTW) for obtaining the page table of the current process and traversing the first page table entry from the page table according to the virtual page identifier.
[0039] Secondly, when it is determined that the target page is a remote page, determine the local memory frame from the memory of the first computing unit to obtain the local physical frame number of the local memory frame.
[0040] Specifically, since the access to the target page by the first computing unit misses the TLB, it means that there is no corresponding page table entry cache in the TLB, and the physical frame number mapping corresponding to the virtual page identifier cannot be obtained. When the target page is a remote page, it is determined that the migration of the remote page is required, that is, the page content of the remote page needs to be migrated to the local physical memory corresponding to the first computing unit. For this purpose, it is necessary to determine the local memory frame in the memory of the first computing unit that can receive the page content of the remote page. The method of determining the local memory frame from the memory of the first computing unit to obtain the local physical frame number of the local memory frame can be to determine the available memory frames in the memory of the first computing unit as the local memory frames to obtain the local physical frame numbers of the local memory frames. Among them, the method of determining the available physical memory frames in the memory of the first computing unit can be to traverse the memory frames in the memory of the first computing unit to find the available physical memory frames.
[0041] In some embodiments, as Figure 4 shown, the migration unit of the heterogeneous memory page migration device may include a Destination Allocator (DA) for determining the available physical memory frames from the memory frames of the local memory of the first computing unit.
[0042] S13. Transmit the page content of the remote page to the local memory frame according to the remote physical frame number in the first page table entry.
[0043] Specifically, the method of transferring the page content of a remote page to a local memory frame according to the remote physical frame number in the first page table entry may be to transfer the page content of the corresponding remote page in the second computing unit to the local memory frame according to the remote physical frame number through a remote memory access mechanism, such as Remote Direct Memory Access (RDMA), a page pull protocol across computing units, PCIe fast transmission, etc.
[0044] In some embodiments, as Figure 4 shown, the migration unit of the heterogeneous memory page migration device may include a Page Migration Engine (PME) for transferring the page content of a remote page from the remote memory to the local memory frame in the local memory according to the remote physical frame number in the first page table entry through PCIe.
[0045] S14. Replace the remote physical frame number in the first page table entry with the local physical frame number to obtain a second page table entry, and return the second page table entry to the first computing unit.
[0046] Specifically, after transferring the page content of the remote page to the local memory frame according to the remote physical frame number in the first page table entry, it is determined that the local memory already includes the page content of the remote page. At this time, the remote physical frame number in the first page table entry is replaced with the local physical frame number to construct a second page table entry, and the second page table entry is returned to the first computing unit so that the first computing unit can access the local memory frame according to the second page table entry to read the page content.
[0047] In the above solution, since when it is determined that the target page in the address translation request is a remote page, the page content of the remote page can be transferred to the local memory frame according to the remote physical frame number in the first page table entry by itself, and the remote physical frame number in the first page table entry is replaced with the local physical frame number and returned to the first computing unit. It avoids waking up the central processing unit through a general standard interface and then asynchronously processing the migration of remote pages through the driver of the central processing unit. Therefore, there is no need to separately wake up the central processing unit in the heterogeneous computing system to asynchronously process the situation of remote page access errors. In this way, on the one hand, the impact on the performance overhead of the central processing unit is avoided, and the time for waking up the central processing unit is saved. On the other hand, the time overhead caused by asynchronous processing is also avoided, further saving the time for heterogeneous memory page migration.
[0048] In some embodiments, as Figure 5 shown, before determining the local memory frame from the memory of the first computing unit, the heterogeneous memory page migration method further includes: S120. Monitor the number of frame numbers of the memory frame numbers in the target candidate queue.
[0049] Among them, the Destination Candidate Queue (DCQ) maintains a list of available memory frames in the migration device of heterogeneous memory pages. By using the DCQ, local memory frames can be provided within an extremely short cycle, effectively reducing latency.
[0050] Specifically, as Figure 6 shown, the migration device of heterogeneous memory pages may include an Available Frame Manager (AFM) for continuously monitoring the number of frame numbers of the memory frame numbers in the destination candidate queue.
[0051] In some embodiments, when the migration device of heterogeneous memory pages includes a destination address allocator, the available frame manager may be a component in the destination address allocator.
[0052] S121. When the number of frame numbers is less than the first threshold, determine a first number of available memory frames from the memory of the first computing unit, and fill the frame numbers of the available memory frames into the destination candidate queue.
[0053] Among them, the sum of the number of frame numbers and the first number is equal to the second threshold, and the second threshold is greater than the first threshold. Both the first threshold and the second threshold are preset values, such as default values or values set by relevant personnel according to the actual situation. For another example, the first threshold is set to 32, and the second threshold is set to 64.
[0054] Specifically, when the number of frame numbers in the destination candidate queue is lower than the first threshold, the available frame manager will immediately start the search and filling process of a new candidate frame group to ensure that the destination candidate queue always maintains an adequate supply of available memory frames, providing continuous support for efficient page migration.
[0055] In some embodiments, the method of determining a first number of available memory frames from the memory of the first computing unit may be, when the number of available memory frames is less than the first number, randomly select a second number of unprotected memory frames as candidates for the available memory frames. Among them, the second number is the difference between the first number and the number of available memory frames. Specifically, as Figure 6 shown, the available frame manager can randomly select a second number of unprotected memory frames as candidates for the available memory frames through a pseudo-random code generation mechanism. In this way, when the number of available memory frames is insufficient to meet the first number, randomly select a second number (i.e., the difference part) of unprotected memory frames as candidates, effectively making up for the shortage of memory resources, improving the success rate of memory allocation, and avoiding allocation failures or delays caused by resource shortages. At the same time, randomly selecting unprotected frames reduces the risk of interfering with critical system data, taking into account both resource utilization efficiency and system stability.
[0056] In some embodiments, the frame number of the available memory frame is filled into the target candidate queue by filling the frame number of the available memory frame and the frame number of the candidate available memory frame into the target candidate queue. In this way, the range of optional memory frames is expanded, the flexibility and availability of the system in memory allocation are improved, the risk of memory allocation failure is reduced, and the memory utilization and overall system stability are improved.
[0057] In some embodiments, the frame number of the available memory frame and the frame number of the standby available memory frame are filled into the target candidate queue in such a way that when the frame number of the available memory frame and the frame number of the standby available memory frame are filled into the target candidate queue, the priority of the frame number of the available memory frame is higher than the frame number of the standby available memory frame. Among them, the frame number with a higher priority is ranked higher in the target candidate queue than the frame number with a lower priority. In this way, the priority mechanism is used to effectively distinguish between the directly available available memory frames and the standby available memory frames, ensuring that the directly available available memory frames are used first, reducing the dependence on the standby resources, and reducing the scheduling delay and resource competition risks.
[0058] In some embodiments, when the frame number of the standby available memory frame is filled into the target candidate queue, a swap flag is added to the frame number of the standby available memory frame. The swap flag is used to indicate that there is data content that needs to be processed in the standby available memory frame. In this way, by adding a swap flag to the frame number of the standby available memory frame, these frame numbers can be identified as objects that can be used for exchange during the subsequent page migration process, thereby avoiding critical data from being mistakenly occupied and improving the controllability and security of memory resource management.
[0059] Thus, the method of determining the local memory frame from the memory of the first computing unit may be: S122: Select a target frame number from the target candidate queue, and determine an available memory frame corresponding to the target frame number as a local memory frame.
[0060] Specifically, the method of selecting the target frame number from the target candidate queue and determining the available memory frame corresponding to the target frame number as the local memory frame can be to randomly select the frame number of the available memory frame in the target candidate queue as the target frame number, and determine the available memory frame corresponding to the target frame number as the local memory frame. It can also be to select the target frame number from the target candidate queue according to the arrangement order of the frame numbers in the target candidate queue, and determine the available memory frame corresponding to the target frame number as the local memory frame. This method of selecting the target frame number by utilizing the orderliness of the candidate queue can avoid repeated judgments and invalid traversals, improve the efficiency and certainty of frame number allocation, and help speed up the response speed of page migration, thereby enhancing the performance and controllability of the overall memory management mechanism.
[0061] In the above solution, by monitoring the number of memory frame numbers in the target candidate queue, it is ensured that the number of frame numbers in the queue is not less than the first threshold, and a first quantity of available memory frame numbers is dynamically supplemented from the memory of the first computing unit and filled into the target candidate queue to maintain the queue size between the first threshold and the second threshold, realizing the dynamic supplementation and reasonable management of available memory resources and ensuring the continuity and sufficiency of the memory frame supply. In this way, when selecting local memory frames, they are directly selected from the target candidate queue, simplifying the memory frame allocation process, improving the response speed and system stability of the allocation, and effectively supporting efficient and reliable memory management.
[0062] In some embodiments, as Figure 7 shown, before determining the first quantity of available memory frames from the memory of the first computing unit, the heterogeneous memory page migration method further includes the following steps: S1210. Construct an inverse page group table according to the occupancy and protection status of multiple memory frames.
[0063] Among them, the inverse page group table (InversePageGroupTable, IPgT) at least includes free status flags and protected status flags of multiple memory frames; the free status flags and protected status flags are used to indicate whether the memory frames are available.
[0064] Specifically, the inverse page group table is one of the core data hubs in the heterogeneous memory page migration device architecture for efficiently managing memory address mapping and related status information. The inverse page group table is indexed by the physical frame number (PhysicalFrame Group Number, PFgN), comprehensively covering key information such as physical address-virtual address mapping, free status flags, context identifiers (Identifier, ID), and protected status flags, providing a data basis for migration decisions. The free status flags are specifically used to quickly identify available frame group resources, providing a direct clue for target selection during the page migration process. The context ID ensures that in a complex environment of multi-task parallelism, the memory operations of different tasks can be accurately distinguished and managed. The protected status flag acts as a "security guard", effectively preventing non-UM areas (such as specific memory blocks allocated through Memory Malloc) from being accidentally migrated, thus maintaining the stability and security of memory operations.
[0065] In some embodiments, since the reverse page group table stores rich and fine-grained information, when dealing with a large-scale memory space, the scale of the reverse page group table is correspondingly large. For example, for an 80GB ASIC memory, approximately 1.25M entries of 8B size (10M) are required to completely store the relevant information. Therefore, considering the data volume and access frequency characteristics of the page group table, the reverse page group table can be stored in the memory of the first computing unit, so that it can be quickly accessed and queried by the migration device of the heterogeneous memory page during the page migration process, providing solid data support for determining the migration target and managing the memory state.
[0066] In some embodiments, as Figure 4 shown, the migration unit of the migration device of the heterogeneous memory page may include a destination address allocator for constructing and maintaining a reverse page group table. In this way, the way to determine the first quantity of available memory frames from the memory of the first computing unit may be: S1211. Determine the first quantity of available memory frames from multiple memory frames according to the free status flag and protected status flag of the memory frames in the reverse page group table.
[0067] Specifically, the way to determine the first quantity of available memory frames from multiple memory frames according to the free status flag and protected status flag of the memory frames in the reverse page group table may be to determine the first quantity of available memory frames from multiple memory frames according to the following judgment conditions and the free status flag and protected status flag of the memory frames in the reverse page group table. Among them, the judgment conditions include: when the free status flag of the memory frame indicates that the occupancy of the memory frame is free and the protected status flag indicates that the protected situation is unprotected, determine that the memory frame is an available memory frame. In this way, by setting clear judgment conditions and combining the free status flag and protected status flag of the memory frames recorded in the reverse page group table, the memory frames that meet the conditions of "free and unprotected" are accurately identified as available memory frames, effectively avoiding misoperations on the memory being used or protected, and improving the security and accuracy of memory allocation.
[0068] In the above solution, by constructing a reverse page group table containing the free status flags and protected status flags of multiple memory frames, a structured expression of the availability of memory frames is formed. On this basis, the required available memory frames can be efficiently filtered out from multiple memory frames directly according to the flag information, avoiding unnecessary traversal and complex judgment, and improving the accuracy and execution efficiency of memory resource scheduling.
[0069] In some embodiments, as Figure 8 shown, before determining the first quantity of available memory frames from the memory of the first computing unit, the heterogeneous memory page migration method further includes: S1212. Construct a reverse page group table according to the occupancy and protection status of multiple memory frames.
[0070] Among them, the reverse page group table includes multiple page group entries, and one page group entry corresponds to one memory frame; the page group entry at least includes an idle status flag and a protection status flag of the memory frame, and the idle status flag and the protection status flag are used to indicate whether the memory frame is available.
[0071] Specifically, the method of constructing the reverse page group table according to the occupancy and protection status of multiple memory frames is the same as that of S1210, which will not be elaborated here.
[0072] S1213. Construct a region availability bitmap of the memory according to the reverse page group table.
[0073] Among them, the region availability bitmap (Frame Region Availability Bitmap, FrAB) includes multiple page group sets, and one page group set includes multiple page group entries; when there are available memory frames in a page group set, the page group set also includes an available flag.
[0074] Specifically, in order to further accelerate the search process of idle memory frames, the heterogeneous memory page migration device introduces an efficient data structure, the region availability bitmap. The design concept of the region availability bitmap is based on the compression and integration of the information in the reverse page group table. It divides 32 64KB page group entries into a 2MB frame region, and uses a simple available flag bit to indicate whether there are available memory frames in this region. If there is at least one idle frame group in a certain region, the corresponding available flag is set to the valid state; otherwise, if all frame groups in this region have been occupied, the flag bit is cleared.
[0075] In some embodiments, the method of constructing the region availability bitmap of the memory according to the reverse page group table may also be to construct the region availability bitmap of the memory according to the position of the page group entry in the reverse page group table. In this way, the system can orderly reflect the availability of each memory region based on the organizational structure of the page group, so as to quickly identify and access the memory status of a specific region, improving the efficiency of memory management.
[0076] In some embodiments, the area available bitmap may be stored in the static random access memory (SRAM) of the first computing unit. In this way, since the scale of the constructed area available bitmap is small, for example, for 40GB of physical memory, it only requires 20K bits of storage space. Therefore, storing it in the static random access memory of the first computing unit has little impact on other storage tasks of the first computing unit, and at the same time can ensure the speed of accessing the area available bitmap, thereby indirectly improving the efficiency of remote page migration.
[0077] In some embodiments, the migration device for heterogeneous memory pages may include a destination address allocator for constructing an area available bitmap of the memory. In this way, the method for determining the first number of available memory frames from the memory of the first computing unit may be as follows: S1214. Determine the set of target page groups by taking the set of page groups with available flags in the area available bitmap as the set of target page groups.
[0078] Specifically, when determining the available memory frames, directly based on the available flags of the set of page groups, determine the set of page groups including the available memory frames as the set of target page groups. That is to say, it is possible to quickly skip those areas that do not contain available memory frames by virtue of the simple available flags of the area available bitmap, avoiding the long traversal operation on the entire reverse page group in the dynamic random access memory (DRAM).
[0079] S1215. Determine the first number of available memory frames according to the free status flag and the protected status flag of the memory frames corresponding to the page group items in the set of target page groups.
[0080] Specifically, after determining the set of target page groups including the available memory frames, only need to traverse and find the free status flag and the protected status flag of the memory frames corresponding to the page group items in the set of target page groups to determine the first number of available memory frames, greatly saving the traversal and search time.
[0081] In the above solution, a bottom-up memory availability recognition mechanism is formed by first constructing a reverse page group table and a region available bitmap. Among them, the reverse page group table records the free state and protected state of each memory frame in fine granularity, providing basic information for judging the availability of memory frames. By aggregating these page group items, a region available bitmap with an available flag is generated, which can quickly identify which memory regions contain available resources. In this way, when it is necessary to determine available memory frames, the region available bitmap can be quickly accessed, and by virtue of its simple flag information, regions that do not contain free frame groups can be quickly skipped, avoiding a long traversal operation on the entire reverse page group table, thus significantly improving the efficiency of searching for free frame groups and providing guarantee for quickly starting page migration. At the same time, the migration device of heterogeneous memory pages uses this pair of data structures, namely the reverse page group table and the region available bitmap, to quickly lock free frame groups at the hardware level, avoiding the long delay of software search, effectively ensuring that remote page data is quickly migrated to the proximal memory, and optimizing the data access time and migration target selection strategy.
[0082] In some embodiments, as Figure 9 shown, the method for constructing a region available bitmap of memory according to the reverse page group table may include: S12131. Aggregate the page group items in the reverse page group table into multiple page group sets of a preset size, or divide the page group items in the reverse page group table into multiple page group sets according to a preset quantity.
[0083] Specifically, when dividing the page group items in the reverse page group table into regions, it can be divided according to size (such as 64k) or according to quantity (such as 32).
[0084] S12132. For any page group set, if there are available memory frames in the page group set, add an available flag to the page group set.
[0085] Specifically, it can be determined whether there are available memory frames in the page group set according to the free state flag and protected state flag of the memory frames in the page group set. If there are available memory frames, add an available flag to the page group set.
[0086] S12133. Generate a region available bitmap of memory according to the multiple page group sets and the available flag.
[0087] In the above scheme, by aggregating or evenly dividing the page group items in the reverse page group table, multiple structured page group sets are constructed, and the sets containing available memory frames are further marked as available, thereby generating a regional available bitmap that reflects the overall memory availability status, improving the granularity and efficiency of memory management, enabling the system to locate allocatable memory areas more quickly, reducing the risk of fragmentation, and enhancing the scheduling flexibility of memory resources and system responsiveness.
[0088] In some embodiments, Figure 10 As shown, when there is a corresponding exchange flag in the local physical frame number, the method of transferring the page content of the remote page to the local memory frame according to the remote physical frame number in the first page table entry may include the following steps: S131. Perform a page eviction operation on the local memory frame to obtain a usable local memory frame.
[0089] Specifically, when there is a corresponding exchange flag in the local physical frame number, it is determined that the local memory resources are tight and the available memory frame cannot be directly allocated, and the page eviction operation is performed on the local memory frame to obtain a usable local memory frame. Among them, according to a predetermined page replacement algorithm, such as LRU, a custom heat evaluation mechanism, etc., the content in the local memory frame can be written back to the corresponding physical frame of the remote page or the backup storage, and the usable local memory frame can be obtained after the content in the local memory frame is cleared.
[0090] S132: Transfer the page content of the remote page to an available local memory frame according to the remote physical frame number in the first page table entry.
[0091] In the above scheme, when the local physical frame number has a corresponding exchange flag, the page content of the remote page is transferred to the available local memory frame after the page is ejected from the local memory frame, which effectively guarantees the continuity of page access and data consistency. At the same time, it improves the utilization efficiency of memory resources and reduces resource conflicts and access delays during the remote page call-in process, which helps maintain the stable operation of the system under high load or memory shortage.
[0092] In some embodiments, Figure 11 As shown, according to the first page table entry corresponding to the virtual page identifier, a method of determining that the target page is a remote page may include the following steps: S01. Obtain a page table of a first computing unit.
[0093] Specifically, Figure 4 As shown, the migration device of the heterogeneous memory page may include a page walker for obtaining the page table of the first computing unit.
[0094] S02. Traverse the page table to find the first page table entry corresponding to the virtual page identifier, and obtain the target flag corresponding to the first page table entry.
[0095] Among them, the target flag is used to indicate whether the page corresponding to the virtual page identifier is a remote page. For example, the target flag can be the A flag.
[0096] Specifically, as Figure 4 shown, the page traverser can be used to traverse the page table to find the first page table entry corresponding to the virtual page identifier, and obtain the target flag corresponding to the first page table entry.
[0097] S03. When the value of the target flag is a preset value, determine that the target page is a remote page.
[0098] In some embodiments, after replacing the remote physical frame number in the first page table entry with the local physical frame number to obtain the second page table entry, the heterogeneous memory page migration method further includes clearing the indication of the target flag for the remote page in the second page table entry. For example, when the target flag is the A flag, after replacing the remote physical frame number in the first page table entry with the local physical frame number to obtain the second page table entry, the A flag is deleted. In this way, the consistency between the page table and the actual physical memory location is ensured, the accidental triggering of the remote access path in subsequent accesses is avoided, and the stability of the system is guaranteed.
[0099] In the above solution, the first page table entry is found from the page table of the first computing unit according to the virtual page identifier, and whether the target page is a remote page is determined according to the target flag corresponding to the first page table entry, so as to execute the heterogeneous memory page migration method in this application when it is determined that the target page is a remote page, saving the migration time of the remote page.
[0100] In some embodiments, as Figure 12 shown, when the number of virtual page identifiers in the address translation request is multiple, before transmitting the page content of the remote page to the local memory frame according to the remote physical frame number in the first page table entry, the heterogeneous memory page migration method further includes: S133. Obtain the transmission priorities of the target pages corresponding to the multiple virtual page identifiers.
[0101] Among them, the transmission priority of the target page is related to multiple aspects such as the importance, urgency, execution order, access frequency, etc. of the task corresponding to the target page in the heterogeneous computing system.
[0102] Specifically, the way to obtain the transmission priorities of the target pages corresponding to the multiple virtual page identifiers can be to first comprehensively determine the key index of the target page from multiple aspects such as the importance, urgency, execution order, access frequency, etc. of the task corresponding to the target page, and then determine the transmission priority of the target page according to the key index.
[0103] In this way, the method of transferring the page content of a remote page to a local memory frame according to the remote physical frame number in the first - page table entry includes the following steps: S134. Transfer the page content of the remote page to the local memory frame according to the remote physical frame number in the first - page table entry in accordance with the transfer priority.
[0104] In the above solution, when the number of virtual page identifiers in the address - translation request is multiple, the page content corresponding to the key page with a relatively high transfer priority is preferentially transferred, making full use of the parallel - processing ability of the hardware and the high - bandwidth characteristics of PCIe to ensure that the data most critical to the current computing task can quickly reach the target memory, thereby effectively reducing the computing latency caused by remote - page migration and improving the overall performance of the system.
[0105] In some embodiments, when the heterogeneous - memory - page migration device includes a page - table traverser, a destination - address allocator, and a page - migration engine, its overall operation process is as follows: When the page - table traverser identifies the page - table entry of a remote page and sends a request for an available memory frame to the destination - address allocator, the destination - address allocator immediately extracts relevant information from its internal target - candidate queue for response. Each entry in the target - candidate queue not only contains the frame number of the available memory frame but also clearly indicates whether a page - replacement operation is required through a swap flag, providing a key decision basis for subsequent migration operations.
[0106] If the available memory frame provided in the target - candidate queue does not require page replacement (i.e., the frame group is in an idle state), the heterogeneous - memory - page migration device will quickly instruct the page - migration engine to start the data - migration process to efficiently migrate the remote page to the locally available memory frame. During the migration process, the page - migration engine adopts an optimized transfer strategy to preferentially transfer the key pages in the page group, making full use of the parallel - processing ability of the hardware and the high - bandwidth characteristics of PCIe to ensure that the key data can reach the target location at the fastest speed, thereby effectively reducing the computing latency caused by page migration and improving the overall performance of the system.
[0107] If the available memory frame needs to be swapped, the heterogeneous - memory - page migration device will precisely perform the page - swap operation based on the remote physical address recorded in the page - migration engine and the local address provided by the destination - address allocator. After the swap is completed, the virtual heterogeneous - memory management unit will synchronously update the page - table entries of the source - page group and the target - page group to ensure the accuracy and consistency of the memory - mapping relationship and avoid memory - access errors caused by page migration and replacement.
[0108] In some embodiments, the migration device for heterogeneous memory pages may include an available frame manager for searching for available memory frames in the supplementary target candidate queue. Its operation process is as follows: The search process of the available frame manager first focuses on the free frame group resources. It quickly locates the frame area containing available memory frames by rapidly traversing the region available bitmap. In this process, the wide SRAM feature of the region available bitmap plays an important role, allowing the available frame manager to check multiple regions at once, greatly improving the search efficiency. Once the target region is determined, the available frame manager further reads the entries in the reverse page group table of the frame group in that region, filters out the eligible (i.e., free and unprotected) available memory frames from them, and orderly adds them to the target candidate queue. In each search process, the available frame manager can fill up to 32 free frame groups at most, thus quickly replenishing the resource reserve of the target candidate queue.
[0109] However, in the special scenario of memory oversubscription, if the available frame manager fails to find available free frame groups after a comprehensive search, it will quickly switch the strategy and randomly select replacement candidates from the used frame groups using a pseudo-random number generator. During the selection process, the available frame manager carefully checks the protected status flags of each candidate frame group to ensure that only unprotected memory frames will be included in the target candidate queue and the corresponding swap flags are set, preparing for possible page replacement operations in the future.
[0110] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases, the former is a better implementation method.
[0111] The embodiments of the present application also provide a migration device for heterogeneous memory pages, as Figure 13 described, the device includes: An acquisition module 701, configured to receive an address translation request; the address translation request is a request sent when a first computing unit in a heterogeneous computing system accesses an address transformation cache and misses the target page, and includes a virtual page identifier of the target page; a determination module 702, configured to determine a local memory frame from the memory of the first computing unit to obtain the local physical frame number of the local memory frame when it is determined according to the first page table entry corresponding to the virtual page identifier that the target page is a remote page; the remote page is a memory page corresponding to a second computing unit in the heterogeneous computing system; the first page table entry includes a mapping relationship between the virtual page identifier and the physical frame number; a transmission module 703, configured to transmit the page content of the remote page to the local memory frame according to the remote physical frame number in the first page table entry; a processing module 704, configured to replace the remote physical frame number in the first page table entry with the local physical frame number to obtain a second page table entry, and return the second page table entry to the first computing unit.
[0112] In some embodiments, the heterogeneous memory page migration device further includes a monitoring module; the monitoring module is configured to monitor the number of frame numbers of the memory frame numbers in the target candidate queue before determining the local memory frame from the memory of the first computing unit; the determining module 702 is further configured to, when the number of frame numbers is less than the first threshold, determine a first number of available memory frames from the memory of the first computing unit, and fill the frame numbers of the available memory frames into the target candidate queue; wherein, the sum of the number of frame numbers and the first number is equal to the second threshold, and the second threshold is greater than the first threshold; the determining module 702 is specifically configured to select a target frame number from the target candidate queue, and determine the available memory frame corresponding to the target frame number as the local memory frame.
[0113] In some embodiments, the heterogeneous memory page migration device further includes a building module; the building module is configured to build a reverse page group table according to the occupancy and protection conditions of multiple memory frames before determining a first number of available memory frames from the memory of the first computing unit; the reverse page group table at least includes free status flags and protected status flags of multiple memory frames, and the free status flags and protected status flags are used to indicate whether the memory frames are available; the determining module 702 is specifically configured to determine a first number of available memory frames from multiple memory frames according to the free status flags and protected status flags of the memory frames in the reverse page group table.
[0114] In some embodiments, the determining module 702 is specifically configured to: determine a first number of available memory frames from multiple memory frames according to the following judgment conditions and the free status flags and protected status flags of the memory frames in the reverse page group table; the judgment conditions include: when the free status flag of the memory frame indicates that the occupancy of the memory frame is free and the protected status flag indicates that the protection condition is unprotected, determine that the memory frame is an available memory frame.
[0115] In some embodiments, the heterogeneous memory page migration apparatus further includes a construction module; the construction module is configured to construct a reverse page group table according to the occupancy and protection status of multiple memory frames before determining a first number of available memory frames from the memory of the first computing unit; the reverse page group table includes multiple page group entries, and one page group entry corresponds to one memory frame; the page group entry at least includes an idle status flag and a protection status flag of the memory frame, and the idle status flag and the protection status flag are used to indicate whether the memory frame is available; the construction module is further configured to construct a region available bitmap of the memory according to the reverse page group table; the region available bitmap includes multiple page group sets, and one page group set includes multiple page group entries; when there is an available memory frame in a page group set, the page group set further includes an available flag; the determination module 702 is specifically configured to: determine the page group set with the available flag in the region available bitmap as the target page group set; and determine a first number of available memory frames according to the idle status flag and the protection status flag of the memory frames corresponding to the page group entries in the target page group set.
[0116] In some embodiments, the construction module is specifically configured to: aggregate the page group entries in the reverse page group table into multiple page group sets of a preset size, or divide the page group entries in the reverse page group table into multiple page group sets evenly according to a preset number; for any page group set, if there is an available memory frame in the page group set, add an available flag to the page group set; and generate a region available bitmap of the memory according to the multiple page group sets and the available flag.
[0117] In some embodiments, the construction module is specifically configured to construct a region available bitmap of the memory according to the positions of the page group entries in the reverse page group table.
[0118] In some embodiments, the reverse page group table is stored in the memory of the first computing unit.
[0119] In some embodiments, the region available bitmap is stored in the static random access memory of the first computing unit.
[0120] In some embodiments, the determination module 702 is specifically configured to randomly select a second number of unprotected memory frames as candidate available memory frames when the number of available memory frames is less than the first number; the second number is the difference between the first number and the number of available memory frames.
[0121] In some embodiments, the determination module 702 is specifically configured to fill the frame numbers of the available memory frames and the frame numbers of the candidate available memory frames into the target candidate queue.
[0122] In some embodiments, the determining module 702 is specifically configured to, when filling the frame numbers of available memory frames and the frame numbers of candidate available memory frames into the target candidate queue, the priority of the frame number of the available memory frame is higher than that of the frame number of the candidate available memory frame; the frame number with a higher priority is sorted more forward in the target candidate queue than the frame number with a lower priority.
[0123] In some embodiments, the determining module 702 is specifically configured to select a target frame number from the target candidate queue according to the arrangement order of the frame numbers in the target candidate queue, and determine the available memory frame corresponding to the target frame number as the local memory frame.
[0124] In some embodiments, the determining module 702 is further configured to, when filling the frame number of the candidate available memory frame into the target candidate queue, add a swap flag to the frame number of the candidate available memory frame.
[0125] In some embodiments, the transmission module 703 is specifically configured to: when there is a corresponding swap flag for the local physical frame number, perform a page eviction operation on the local memory frame to obtain an available local memory frame; transfer the page content of the remote page to the available local memory frame according to the remote physical frame number in the first page table entry.
[0126] In some embodiments, the determining module 702 is specifically configured to: obtain the page table of the first computing unit; traverse and search in the page table for the first page table entry corresponding to the virtual page identifier, and obtain the target flag corresponding to the first page table entry; when the value of the target flag is a preset value, determine the target page as a remote page.
[0127] In some embodiments, the heterogeneous memory page migration device further includes a clearing module; the clearing module is configured to, after replacing the remote physical frame number in the first page table entry with the local physical frame number to obtain a second page table entry, clear the indication of the target flag for the remote page in the second page table entry.
[0128] In some embodiments, the obtaining module 701 is further configured to, when the number of virtual page identifiers in the address translation request is multiple, obtain the transmission priorities of the target pages corresponding to the multiple virtual page identifiers before transferring the page content of the remote page to the local memory frame according to the remote physical frame number in the first page table entry; the transmission module 703 is specifically configured to transfer the page content of the remote page to the local memory frame according to the transmission priorities according to the remote physical frame number in the first page table entry.
[0129] For the descriptions of the features in the embodiments corresponding to the heterogeneous memory page migration device, reference can be made to the relevant descriptions of the embodiments corresponding to the heterogeneous memory page migration method, which will not be elaborated here one by one.
[0130] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, and the computer program is configured to execute the steps in any of the above-described embodiments of the heterogeneous memory page migration method when running.
[0131] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: various media that can store computer programs such as USB flash drives, read-only memories (ROM), random access memories (RAM), external hard drives, magnetic disks, or optical discs.
[0132] An embodiment of the present application further provides a computer program product, the above computer program product includes a computer program, and when the computer program is executed by a processor, it implements the steps in any of the above-described embodiments of the heterogeneous memory page migration method.
[0133] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the steps in any of the above-described embodiments of the heterogeneous memory page migration method.
[0134] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to their functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods for each specific application to implement the described functions, but such implementation should not be considered to exceed the scope of the present application.
[0135] The above has introduced in detail a heterogeneous memory page migration device, method, and readable storage medium provided by the present application. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application. It should be noted that for those of ordinary skill in the art in the technical field, without departing from the principle of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the protection scope of the claims of the present application.
Claims
1. A migration device for heterogeneous memory pages, characterized in that Including: A first computing unit, a migration unit, and a memory unit, and the first computing unit, the migration unit, and the memory unit are electrically connected respectively; The migration unit includes a communicator and a processor, and the communicator and the processor are electrically connected; The communicator is configured to: receive an address translation request; the address translation request is a request sent when the first computing unit accesses an address of a target page and misses the address translation cache, and includes a virtual page identifier of the target page; The processor is configured to: When determining that the target page is a remote page according to a first page table entry corresponding to the virtual page identifier, determine a local memory frame from the memory unit to obtain a local physical frame number of the local memory frame; The remote page is a memory page corresponding to a second computing unit in a heterogeneous computing system; the first page table entry includes a mapping relationship between a virtual page identifier and a physical frame number; Transmit the page content of the remote page to the local memory frame according to the remote physical frame number in the first page table entry; Replace the remote physical frame number in the first page table entry with the local physical frame number to obtain a second page table entry; The communicator is further configured to: return the second page table entry to the first computing unit.
2. The device according to claim 1, wherein The migration unit further includes a monitor, and the monitor is electrically connected to the processor; The monitor is configured to: Monitor the number of frame numbers of memory frame numbers in a target candidate queue; When the number of frame numbers is less than a first threshold, determine a first number of available memory frames from the memory unit and fill the frame numbers of the available memory frames into the target candidate queue; wherein, the sum of the number of frame numbers and the first number is equal to a second threshold, and the second threshold is greater than the first threshold; The processor is specifically configured to: select a target frame number from the target candidate queue and determine the available memory frame corresponding to the target frame number as the local memory frame.
3. The device according to claim 2, wherein The monitor is further configured to: Before determining a first number of available memory frames from the memory unit, construct a reverse page group table according to the occupancy and protection status of multiple memory frames; the reverse page group table at least includes free status flags and protection status flags of the multiple memory frames, and the free status flags and protection status flags are used to indicate whether the memory frames are available; The monitor is specifically configured to: Determine a first number of available memory frames from the multiple memory frames according to the free status flags and protection status flags of the memory frames in the reverse page group table.
4. The device according to claim 3, wherein The monitor is specifically configured to: Determine a first number of available memory frames from the multiple memory frames according to the following judgment conditions and the free status flags and protection status flags of the memory frames in the reverse page group table; The determination condition includes: when the free status flag of the memory frame indicates that the occupancy of the memory frame is free and the protected status flag indicates that the protected situation is unprotected, determining that the memory frame is an available memory frame.
5. The device according to claim 2, wherein the monitor is further configured to: Before determining a first number of available memory frames from the memory cells, construct a reverse page group table according to the occupancy and protected status of multiple memory frames; the reverse page group table includes multiple page group entries, and one page group entry corresponds to one memory frame; the page group entry at least includes the free status flag and the protected status flag of the memory frame, and the free status flag and the protected status flag are used to indicate whether the memory frame is available; Construct a region available bitmap of the memory according to the reverse page group table; The region available bitmap includes multiple page group sets, and one page group set includes multiple page group entries; when there are available memory frames in a page group set, the one page group set further includes an available flag; Specifically, the monitor is configured to: Determine the page group set with the available flag in the region available bitmap as the target page group set; Determine a first number of available memory frames according to the free status flag and the protected status flag of the memory frames corresponding to the page group entries in the target page group set.
6. The device according to claim 5, wherein Specifically, the monitor is configured to: Aggregate the page group entries in the reverse page group table into multiple page group sets of a preset size, or divide the page group entries in the reverse page group table into multiple page group sets evenly according to a preset quantity; For any page group set, if there are available memory frames in the page group set, add an available flag to the page group set; Generate a region available bitmap of the memory according to the multiple page group sets and the available flag.
7. The device according to claim 5 or 6, wherein Specifically, the monitor is configured to: Construct the region available bitmap of the memory according to the positions of the page group entries in the reverse page group table.
8. The device according to any one of claims 3 to 6, characterized in that The migration unit further includes a memory, and the memory is electrically connected to the monitor and the processor respectively; The memory is configured to: store the reverse page group table in the memory cell.
9. The device according to claim 5 or 6, characterized in that, The device further includes a static random access memory; the migration unit further includes a memory, and the memory is electrically connected to the monitor and the processor respectively; The memory is configured to: store the region available bitmap in the static random access memory.
10. The device according to claim 2, wherein Specifically, the monitor is configured to: When the number of the available memory frames is less than the first number, randomly select a second number of unprotected memory frames as candidate available memory frames for the available memory frames; The second number is the difference between the first number and the number of the available memory frames.
11. The device according to claim 10, wherein Specifically, the monitor is configured to: Fill the frame numbers of the available memory frames and the frame numbers of the candidate available memory frames into the target candidate queue.
12. The device according to claim 11, wherein: The monitor is specifically configured to: When filling the frame numbers of the available memory frames and the frame numbers of the candidate available memory frames into the target candidate queue, the priority of the frame number of the available memory frame is higher than that of the frame number of the candidate available memory frame; the frame number with a higher priority is sorted more forward in the target candidate queue than the frame number with a lower priority.
13. The device according to claim 12, wherein: The processor is specifically configured to: select a target frame number from the target candidate queue according to the arrangement order of the frame numbers in the target candidate queue, and determine the available memory frame corresponding to the target frame number as the local memory frame.
14. The device according to claim 11 or 12, wherein: The monitor is further configured to: When filling the frame number of the candidate available memory frame into the target candidate queue, add a swap flag to the frame number of the candidate available memory frame.
15. The device according to claim 14, wherein: The processor is specifically configured to: When there is a corresponding swap flag for the local physical frame number, perform a page eviction operation on the local memory frame to obtain an available local memory frame; Transmit the page content of the remote page to the available local memory frame according to the remote physical frame number in the first page table entry.
16. The device according to claim 1, wherein: The processor is specifically configured to: Obtain the page table of the first computing unit; Traverse and search for the first page table entry corresponding to the virtual page identifier in the page table, and obtain the target flag corresponding to the first page table entry; When the value of the target flag is a preset value, determine that the target page is a remote page.
17. The device according to claim 16, wherein: The processor is further configured to: After replacing the remote physical frame number in the first page table entry with the local physical frame number to obtain a second page table entry, clear the indication of the target flag for the remote page in the second page table entry.
18. The device according to claim 1, wherein: The processor is further configured to: When the number of virtual page identifiers in the address translation request is multiple, Obtain the transmission priorities of the target pages corresponding to the multiple virtual page identifiers; The processor is specifically configured to: Transmit the page content of the remote page to the local memory frame according to the transmission priority and the remote physical frame number in the first page table entry.
19. A method for migrating heterogeneous memory pages, characterized in that, including: Receiving an address translation request; The address translation request is a request sent when the first computing unit in the heterogeneous computing system accesses the target page and misses the address translation cache, and includes the virtual page identifier of the target page; When determining that the target page is a remote page according to the first page table entry corresponding to the virtual page identifier, determine a local memory frame from the memory of the first computing unit to obtain the local physical frame number of the local memory frame; The remote page is a memory page corresponding to a second computing unit in the heterogeneous computing system; the first page table entry includes a mapping relationship between a virtual page identifier and a physical frame number; Transmit the page content of the remote page to the local memory frame according to the remote physical frame number in the first page table entry; Replace the remote physical frame number in the first page table entry with the local physical frame number to obtain a second page table entry, and return the second page table entry to the first computing unit.
20. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, wherein when the computer program is executed by a processor, the steps of the method for migrating heterogeneous memory pages as described in claim 19 are implemented.
21. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, the steps of the method for migrating heterogeneous memory pages as described in claim 19 are implemented.
Citation Information
Patent Citations
Non-stop memory page migration system of heterogeneous memory virtual machine
CN110134492A
PML-based virtual machine page migration method and system
CN115576644A
Page transport and copy method based on operation system reverse page table
CN1560746A
Cited By
Virtual machine live migration method and device, electronic equipment, storage medium and computer program product
CN120762819A
Data processing method and device, electronic equipment, storage medium and program product
CN122173437A