Heterogeneous memory page migration device, method and readable storage medium

By handling remote page migration by itself in heterogeneous memory page migration devices, the delay problem caused by central processor intervention in the existing technology is solved, and more efficient memory page migration is achieved, and the performance of heterogeneous computing systems is improved.

CN120371550BActive Publication Date: 2025-08-22INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510884103.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-27
Publication Date
2025-08-22
Estimated Expiration
2045-06-27

AI Technical Summary

Technical Problem

In heterogeneous computing systems, when migrating heterogeneous memory pages, the prior art requires intervention and bus communication through central processors, resulting in delay and performance overhead, especially when processing page errors are long.

Method used

Provides a heterogeneous memory page migration device and method, which handles remote page migration by the processor and communicator 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.

Benefits of technology

It reduces the performance overhead and wake-up time of the central processor, shortens the migration time of heterogeneous memory pages, and improves system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371550B_ABST
    Figure CN120371550B_ABST
Patent Text Reader

Abstract

The present application discloses a device, method and readable storage medium for migrating heterogeneous memory pages, relating to the field of data processing technology, comprising a first computing unit, a migration unit and a memory unit, wherein the migration unit comprises a communicator and a processor; the communicator is configured to receive an address translation request; the processor is configured to, when determining that the target page in the address translation request is a remote page, transfer the page content of the remote page to a local memory frame according to the remote physical frame number in the first page table entry, and replace the remote physical frame number in the first page table entry with the local physical frame number; the communicator is further configured to return a second page table entry to the first computing unit, thereby solving the problem in the related art that when the computing unit accesses the remote page and triggers a page error, it takes a long time, thereby saving the time consumed in migrating heterogeneous memory pages.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a device, method, and readable storage medium for migrating heterogeneous memory pages. Background Art

[0002] Heterogeneous computing systems have emerged to meet the demands for multi-functionality, high performance, and low power consumption. These systems are composed of multiple different types of computing units, each typically equipped with specific memory resources. Together, these memory resources form a heterogeneous memory structure. At runtime, applications require efficient data sharing between heterogeneous memory units by migrating pages between them. Therefore, handling page migration between heterogeneous memories is crucial.

[0003] Currently, the migration of heterogeneous memory pages (also known as remote pages) typically relies on the Unified Memory (UM) mechanism, which provides a single virtual address space, enabling different computing units to share data using the same pointer. However, when a computing unit accesses a remote page and triggers a page fault, an interrupt must be issued through a common standard interface (such as PCIe) to wake up the driver on the Central Processing Unit (CPU) to handle the page migration. Because this process involves CPU intervention and bus communication, it introduces significant latency and performance overhead for heterogeneous computing systems that require efficient processing. Summary of the Invention

[0004] The present application provides a heterogeneous memory page migration device, method and readable storage medium to at least solve the problem in the related art that it takes a long time when a computing unit accesses a remote page and triggers a page fault.

[0005] This application provides a heterogeneous memory page migration device, including:

[0006] A first computing unit, a migration unit, and a memory unit, wherein the first computing unit, the migration unit, and the memory unit are electrically connected respectively;

[0007] The migration unit includes a communicator and a processor, and the communicator and the processor are electrically connected;

[0008] The communicator is configured to: receive an address translation request; the address translation request is a request issued when the first computing unit accesses a target page but misses the address translation cache, and includes a virtual page identifier of the target page;

[0009] The processor is configured to:

[0010] When the target page is determined to be a remote page based on the first page table entry corresponding to the virtual page identifier, a local memory frame is determined 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 the 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;

[0011] 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;

[0012] Replace the remote physical frame number in the first page table entry with the local physical frame number to obtain the second page table entry;

[0013] The communicator is further configured to return the second page table entry to the first computing unit.

[0014] This application provides a method for migrating heterogeneous memory pages, including:

[0015] receiving an address translation request; the address translation request is a request issued by a first computing unit in a heterogeneous computing system when accessing a target page misses an address translation cache, and includes a virtual page identifier of the target page;

[0016] When the target page is determined to be a remote page based on the first page table entry corresponding to the virtual page identifier, a local memory frame is determined from the memory of the first computing unit to obtain a local physical frame number of the local memory frame; the remote page is a memory page corresponding to the 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;

[0017] 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;

[0018] The remote physical frame number in the first page table entry is replaced with the local physical frame number to obtain a second page table entry, and the second page table entry is returned to the first computing unit.

[0019] The present application also provides a heterogeneous memory page migration device, comprising:

[0020] An acquisition module is configured to receive an address translation request; the address translation request is a request issued when a first computing unit in a heterogeneous computing system accesses a target page and misses the address translation cache, and includes a virtual page identifier of the target page;

[0021] a determination module configured to, when determining, based on a first page table entry corresponding to a virtual page identifier, that a target page is a remote page, determine a local memory frame from a memory of the first computing unit and 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 the heterogeneous computing system; and the first page table entry includes a mapping relationship between the virtual page identifier and the physical frame number;

[0022] 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;

[0023] The processing module is 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.

[0024] 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.

[0025] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned heterogeneous memory page migration method when executed by a processor.

[0026] 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. It avoids waking up the central processing unit through a universal standard interface and then asynchronously processing the migration of the remote page through the driver of the central processing unit. Therefore, it is no longer necessary to separately wake up the central processing unit in the heterogeneous computing system to asynchronously process 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 avoided, further saving the time for heterogeneous memory page migration. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0028] Figure 1 A schematic diagram of the system structure of a heterogeneous interconnected system for multiple accelerators provided in an embodiment of the present application;

[0029] Figure 2 A schematic diagram of the structure of a heterogeneous memory page migration device provided in an embodiment of the present application;

[0030] Figure 3 One of the flow charts of the heterogeneous memory page migration method provided in an embodiment of the present application;

[0031] Figure 4 This is one of the application scenarios of the heterogeneous memory page migration method provided in the embodiment of the present application;

[0032] Figure 5 The second flowchart of the heterogeneous memory page migration method provided in the embodiment of the present application;

[0033] Figure 6 This is the second application scenario of the heterogeneous memory page migration method provided in the embodiment of the present application;

[0034] Figure 7 Flowchart 3 of the heterogeneous memory page migration method provided in an embodiment of the present application;

[0035] Figure 8 Flowchart 4 of the heterogeneous memory page migration method provided in an embodiment of the present application;

[0036] Figure 9 Flowchart 5 of the heterogeneous memory page migration method provided in an embodiment of the present application;

[0037] Figure 10 Flowchart 6 of the heterogeneous memory page migration method provided in an embodiment of the present application;

[0038] Figure 11 Flowchart seven of the heterogeneous memory page migration method provided in an embodiment of the present application;

[0039] Figure 12 Flowchart 8 of the heterogeneous memory page migration method provided in an embodiment of the present application;

[0040] Figure 13 A schematic diagram of the structure of a heterogeneous memory page migration device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0041] The following will be combined with the accompanying 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 them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0042] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.

[0043] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0044] A heterogeneous computing system refers to a system composed of different types of computing units, such as CPU, graphics processing unit (GPU), field programmable gate array (FPGA), application-specific integrated circuit (ASIC), etc., which can realize multi-functional, high-performance and low-energy computing task processing.

[0045] For example, Figure 1 This is a schematic diagram of the system structure of a heterogeneous interconnected system for multiple accelerators provided in an embodiment of the present application. Figure 1 As shown, the system includes multiple heterogeneous computing systems 100 and an interconnection structure 200. The heterogeneous computing systems 100 can achieve high-speed and consistent data sharing and communication through the interconnection structure 200.

[0046] In some embodiments, Figure 1 In the heterogeneous interconnected system for multiple accelerators shown in the figure, each heterogeneous computing system includes multiple computing nodes, such as ASICs, FPGAs, GPUs, and CPUs, and multiple storage units, such as storage-class memory (SCM) and dynamic random access memory (DRAM).

[0047] In some embodiments, the interconnect structure 200 is a structure for high-speed communication between heterogeneous computing systems 100. For example, the interconnect technology used may be Compute Express Link (CXL), Peripheral Component Interconnect Express (PCIe), Cache Coherent Interconnect for Accelerators (CCIX), etc.

[0048] In the aforementioned heterogeneous computing systems, applications need to distribute tasks and share data across different compute nodes. Traditionally, data sharing in heterogeneous computing systems relies on manual memory copy operations, such as using the Memory Memcpy function. This approach not only requires personnel to manage the tedious data migration process, which is prone to errors, but also affects the execution of the core processing logic of the compute nodes, significantly increasing execution time. Furthermore, the limited memory capacity of some compute nodes (such as ASICs) limits the scale of data processing, prompting the search for more efficient memory management solutions.

[0049] To address this situation, the UM mechanism was proposed to provide a single virtual address space, enabling different compute nodes to share data using the same pointers and supporting memory oversubscription, significantly improving programming convenience. However, under the UM mechanism, when a compute node accesses a remote page and triggers a page fault, an interrupt must be issued through a common standard interface to wake up the driver on the CPU. The driver is then responsible for handling the page migration and updating the page table. This process incurs software processing latency of up to 20µs to 50µs, causing frequent stalls in the compute node execution and making the execution efficiency of compute nodes running under the UM mechanism significantly lower than that of manual memory copying. Although various prefetching and eviction mechanisms have been proposed to reduce UM overhead, such as sequential local prefetchers and tree-based neighborhood prefetchers, as well as various eviction strategies such as variants of the least recently used (LRU) mechanism, these schemes only reduce the number of page faults. Due to the still-long page fault handling latency, performance gains are limited and may even degrade when handling applications with irregular memory access patterns.

[0050] To address the above-mentioned issues, embodiments of the present application provide a heterogeneous memory page migration device, method, and readable storage medium. The method includes, upon determining that the target page in an address translation request is a remote page, transferring the page content of the remote page to a local memory frame based on the remote physical frame number in the first page table entry, replacing the remote physical frame number in the first page table entry with the local physical frame number, and returning the result to the first computing unit. This avoids the need to wake up the central processing unit through a universal standard interface and then asynchronously process the migration of the remote page through the driver of the central processing unit. It is no longer necessary to wake up a separate central processing unit in a 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.

[0051] Figure 2 A schematic diagram of a heterogeneous memory page migration device provided in an embodiment of the present application. Figure 1 , the heterogeneous memory page migration device can act as any computing node in a heterogeneous computing system to perform heterogeneous interaction (such as remote page access) with other computing nodes in the heterogeneous computing system. Therefore, the heterogeneous memory page migration method in this application can be applied to the heterogeneous memory page migration device. Figure 2 As shown, the heterogeneous memory page migration device 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, for example, via a bus.

[0052] The first computing unit 21, serving as the computing core of the heterogeneous memory page migration device, is primarily responsible for processing a large number of tasks assigned to the heterogeneous computing system, such as remote page access to the memory of computing units in other computing nodes. Memory unit 22 is primarily used to store task data corresponding to the first computing unit 21.

[0053] The migration unit 20 includes a processor 202 and a communicator 201 .

[0054] The communicator 201 is electrically connected to the processor 902. The communicator 201 is used to exchange information with other devices. For example, the communicator 201 supports the migration unit 20 in receiving an address translation request from 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.

[0055] 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 the present application. For example, when the processor 202 determines that the target page is a remote page based on the first page table entry corresponding to the virtual page identifier, it determines the local memory frame from the memory unit 22 and obtains the local physical frame number of the local memory frame; the remote page is a memory page corresponding to the second computing unit of another node in the heterogeneous computing system; the first page table entry includes a mapping relationship between the virtual page identifier and the physical frame number; the page content of the remote page is transferred to the local memory frame based on 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 to obtain a second page table entry.

[0056] like Figure 2 As shown, the migration unit 20 may further include a memory 203. The memory 203 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, an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, an optical disc storage (including a compact disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to these. The memory 203 may be used to store application code related to executing the solution of the present application, and the execution thereof is controlled by the processor 202. For example, the memory stores the inverted page group table in the memory unit 22 , and the memory stores the region availability bitmap in a static random access memory (not shown) of the first computing unit 21 .

[0057] like Figure 2 As shown, the heterogeneous memory page migration device may further include a monitor 204. The monitor 204 may be configured to monitor, record, or analyze the status of hardware or software in real time. For example, the monitor 204 may monitor and maintain the number of memory frame numbers in the target candidate queue.

[0058] It should be pointed out that Figure 2 The device structure shown in does not constitute a limitation on the migration device of the heterogeneous memory page, except Figure 2 In addition to the components shown, the heterogeneous memory page migration device may include more or fewer components than shown, or a combination of certain components, or a different arrangement of components. Furthermore, the heterogeneous memory page migration device provided in the embodiments of the present application can execute the heterogeneous memory page migration method provided in the method embodiment. The implementation principles and technical effects of the heterogeneous memory page migration method can be found in the method embodiment below and will not be further described here.

[0059] In addition, the heterogeneous memory page migration method provided in the embodiment of the present application can be executed by a heterogeneous memory page migration device, which can be a hardware unit or a software module. When the heterogeneous memory page migration device is hardware, it can be a hardware set composed of multiple hardware units with a heterogeneous memory page migration function (such as the above-mentioned Figure 2 When the heterogeneous memory page migration device 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 given here.

[0060] Figure 3 A flow chart of a heterogeneous memory page migration method provided in an embodiment of the present application. Figure 3 As shown, the method for migrating heterogeneous memory pages may include the following steps:

[0061] S11. Receive an address translation request.

[0062] The address translation request is a request issued by a first computing unit in a heterogeneous computing system when accessing a target page and the request misses the address translation lookaside buffer (TLB). The request includes the virtual page identifier of the target page. The first computing unit is a computing core in any computing node (e.g., an ASIC) in the heterogeneous computing system.

[0063] Specifically, when a first computing unit in a heterogeneous computing system encounters a remote page access resulting in a TLB miss, the first computing unit generates an address translation request including a virtual page identifier of the remote page (ie, the target page) and sends the request to the migration unit. Figure 4 In the illustrated scenario, when the first computing unit encounters a remote page access resulting in a TLB miss, it generates an address translation request including a virtual page identifier of the remote page and sends the request to the migration unit.

[0064] S12. When the target page is determined to be a remote page according to the first page table entry corresponding to the virtual page identifier, a local memory frame is determined from the memory of the first computing unit to obtain a local physical frame number of the local memory frame.

[0065] The remote page is a memory page corresponding to a second computing unit different from the first 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. The 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 virtual addresses to physical addresses. Multiple page table entries (PTEs) are maintained in the page table. Each page table entry records the mapping relationship between the virtual page identifier and the physical frame number of a virtual page. 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.

[0066] First, based on the first page table entry corresponding to the virtual page identifier, determine whether the target page is a remote page. Specifically, determining whether the target page is a remote page can be achieved by analyzing the correspondence between its virtual page identifier and the current process page table or system memory mapping. For example, check whether the virtual page identifier is a hit in the local page table; if not, then determine whether it exists in the page table of another computing unit, or identify it as a remote page through the page directory mark.

[0067] In some embodiments, as Figure 4 As shown, the migration unit of the heterogeneous memory page migration device may include a page table walker (PTW) for obtaining a page table of a current process and traversing a first page table entry from the page table according to a virtual page identifier.

[0068] Secondly, when it is determined that the target page is a remote page, a local memory frame is determined from the memory of the first computing unit, and a local physical frame number of the local memory frame is obtained.

[0069] Specifically, since the first computing unit does not hit the TLB when accessing the target page, 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 remote page needs to be migrated, that is, the page content of the remote page needs to be migrated to the local physical memory corresponding to the first computing unit. To this end, it is necessary to determine a 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 and obtaining the local physical frame number of the local memory frame can be to determine the available memory frame in the memory of the first computing unit as the local memory frame and obtain the local physical frame number of the local memory frame. Among them, the method of determining the available physical memory frame in the memory of the first computing unit can be to traverse the memory frames in the memory of the first computing unit and search for available physical memory frames.

[0070] In some embodiments, as Figure 4 As shown, the migration unit of the heterogeneous memory page migration device may include a destination address allocator (DA) configured to determine an available physical memory frame from the memory frames of the local memory of the first computing unit.

[0071] S13. 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.

[0072] Specifically, 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 can be to copy 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.

[0073] In some embodiments, as Figure 4 As shown, the migration unit of the migration device of the heterogeneous memory page may include a page migration engine (PME), which is used to transfer the page content of the remote page from the remote memory to the local memory frame of the local memory through PCIe according to the remote physical frame number in the first page table entry.

[0074] 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.

[0075] Specifically, after the page content of the remote page is transferred to the local memory frame according to the remote physical frame number in the first page table entry, it is determined that the page content of the remote page is already included in the local memory. At this time, the remote physical frame number in the first page table entry is replaced with the local physical frame number, a second page table entry is constructed, 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.

[0076] In the above scheme, since 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 universal standard interface and then asynchronously processing the migration of the remote page through the driver of the central processing unit. Therefore, it is no longer necessary to separately wake up the central processing unit in the heterogeneous computing system to asynchronously process 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 avoided, further saving the time for heterogeneous memory page migration.

[0077] In some embodiments, as Figure 5 As shown, before determining the local memory frame from the memory of the first computing unit, the heterogeneous memory page migration method further includes:

[0078] S120: Monitor the number of frame numbers stored in the target candidate queue.

[0079] The Destination Candidate Queue (DCQ) maintains a list of available memory frames in the migration device for heterogeneous memory pages. The DCQ can provide local memory frames in a very short cycle, effectively reducing latency.

[0080] Specifically, such as Figure 6 As shown, the migration device of the heterogeneous memory page may include an available frame manager (AFM) for continuously monitoring the number of memory frame numbers in the target candidate queue.

[0081] In some embodiments, when the migration device for heterogeneous memory pages includes a destination address allocator, the available frame manager may be a component in the destination address allocator.

[0082] S121. When the number of frame numbers is less than a 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.

[0083] 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 first threshold and the second threshold are both preset values, such as default values ​​or values ​​set by relevant personnel based on actual conditions. For another example, the first threshold is set to 32, and the second threshold is set to 64.

[0084] Specifically, when the number of frame numbers in the target candidate queue is lower than the first threshold, the available frame manager will immediately start the search and fill process of the new candidate frame group to ensure that the target candidate queue always maintains a sufficient supply of available memory frames, providing continuous support for efficient page migration.

[0085] In some embodiments, the first number of available memory frames is determined from the memory of the first computing unit by randomly selecting 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. Specifically, Figure 6 As shown, the available frame manager can use a pseudo-random code generation mechanism to randomly select a second number of unprotected memory frames as candidate available memory frames. This way, when the number of available memory frames is insufficient to meet the first requirement, the second number (i.e., the difference) of unprotected memory frames is randomly selected as candidate frames. This effectively compensates for insufficient memory resources, improves the success rate of memory allocation, and avoids allocation failures or delays caused by resource shortages. Furthermore, randomly selecting unprotected frames reduces the risk of interference with critical system data, balancing resource utilization efficiency and system stability.

[0086] In some embodiments, the target candidate queue can be populated with the frame numbers of available memory frames and the frame numbers of candidate available memory frames. This expands the range of selectable memory frames, improves the flexibility and availability of the system during memory allocation, helps reduce the risk of memory allocation failure, and improves memory utilization and overall system stability.

[0087] 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.

[0088] In some embodiments, when the frame numbers of the candidate available memory frames are filled into the target candidate queue, a swap flag is added to the frame numbers of the candidate available memory frames. The swap flag is used to indicate that the candidate available memory frames contain data content that needs to be processed. In this way, by adding the swap flag to the frame numbers of the candidate available memory frames, these frame numbers can be identified as objects that can be swapped during subsequent page migrations, thereby preventing critical data from being mistakenly occupied and improving the controllability and security of memory resource management.

[0089] Thus, the method of determining the local memory frame from the memory of the first computing unit may be:

[0090] S122: 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.

[0091] 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, help speed up the response speed of page migration, and thus enhance the performance and controllability of the overall memory management mechanism.

[0092] In the above scheme, by monitoring the number of memory frame numbers in the target candidate queue, ensuring that the number of frame numbers in the queue is not less than a first threshold, and dynamically replenishing the first number of available memory frame numbers from the memory of the first computing unit, filling them into the target candidate queue, maintaining the queue size between the first and second thresholds, dynamic replenishment and reasonable management of available memory resources are achieved, ensuring the continuity and adequacy of 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 allocation response speed and system stability, and effectively supporting efficient and reliable memory management.

[0093] In some embodiments, as Figure 7 As shown, before determining the first number of available memory frames from the first computing unit memory, the heterogeneous memory page migration method further includes the following steps:

[0094] S1210: Construct a reverse page group table according to the occupancy and protection status of multiple memory frames.

[0095] The Inverse Page Group Table (IPgT) includes at least idle state flags and protected state flags of a plurality of memory frames; the idle state flags and protected state flags are used to indicate whether the memory frames are available.

[0096] Specifically, the reverse page group table (RPG) is one of the core data hubs in the heterogeneous memory page migration architecture, used to efficiently manage memory address mappings and related status information. Indexed by the physical frame group number (PFgN), the RPG table comprehensively encompasses key information such as physical-to-virtual address mapping, idle state flags, context identifiers (IDs), and protected state flags, providing the data foundation for migration decisions. The idle state flag is used to quickly identify available frame group resources, providing direct clues for target selection during page migration. The context ID ensures that memory operations of different tasks can be accurately distinguished and managed in complex multi-tasking environments. The protected state flag acts as a "safeguard," effectively preventing the accidental migration of non-UM areas (such as specific memory blocks allocated via Memory Malloc), thereby maintaining the stability and security of memory operations.

[0097] In some embodiments, because the inverse page group table stores rich information with fine granularity, the size of the inverse page group table is correspondingly large when processing large-scale memory spaces. For example, for an 80GB ASIC memory, approximately 1.25M 8B (10M) entries are required to fully store the relevant information. To this end, considering the data volume and access frequency characteristics of the page group table, the inverse 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 status.

[0098] In some embodiments, as Figure 4 As shown, the migration unit of the heterogeneous memory page migration device may include a destination address allocator for constructing and maintaining a reverse page group table.

[0099] Thus, the method of determining the first number of available memory frames from the memory of the first computing unit may be:

[0100] S1211 : Determine a first number of available memory frames from a plurality of memory frames according to the idle state flags and protected state flags of the memory frames in the reverse page group table.

[0101] Specifically, the method of determining the first number of available memory frames from a plurality of memory frames based on the idle state flag and the protected state flag of the memory frame in the reverse page group table may be to determine the first number of available memory frames from a plurality of memory frames based on the following judgment conditions and the idle state flag and the protected state flag of the memory frame in the reverse page group table. The judgment conditions include: when the idle state flag of the memory frame indicates that the occupancy status of the memory frame is idle, and the protected state flag indicates that the protection status is unprotected, determining that the memory frame is an available memory frame. In this way, by setting clear judgment conditions and combining the idle state flag and the protected state flag of the memory frame recorded in the reverse page group table, the memory frames that meet the "idle and unprotected" conditions can be accurately identified as available memory frames, effectively avoiding misoperation of the memory in use or protected, and improving the security and accuracy of memory allocation.

[0102] In this solution, a structured representation of memory frame availability is formed by constructing an inverted page group table containing multiple memory frame idle and protected status flags. This allows efficient selection of available memory frames from multiple memory frames based on this flag information, avoiding unnecessary traversal and complex judgments, and improving the accuracy and efficiency of memory resource scheduling.

[0103] In some embodiments, as Figure 8 As shown, before determining the first number of available memory frames from the first computing unit memory, the heterogeneous memory page migration method further includes:

[0104] S1212: Construct a reverse page group table according to the occupancy and protection status of multiple memory frames.

[0105] The reverse page group table includes multiple page group entries, one page group entry corresponds to one memory frame; the page group entry includes at least an idle state flag and a protected state flag of the memory frame, and the idle state flag and the protected state flag are used to indicate whether the memory frame is available.

[0106] 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 S1210 and will not be repeated here.

[0107] S1213. Construct a memory area availability bitmap according to the reverse page group table.

[0108] The Frame Region Availability Bitmap (FrAB) includes multiple page group sets, and one page group set includes multiple page group items. When there are available memory frames in a page group set, the page group set also includes an available flag.

[0109] Specifically, to further accelerate the search for free memory frames, the heterogeneous memory page migration device introduces a highly efficient data structure called a regional availability bitmap. The regional availability bitmap is designed based on the compression and integration of information in the inverted page group table. It divides 32 64KB page group entries into a 2MB frame region and uses a simple availability flag to indicate whether there are available memory frames within the region. If there is at least one free frame group within a region, the corresponding availability flag is set to valid; conversely, if all frame groups within the region are occupied, the flag is cleared.

[0110] In some embodiments, the memory region availability bitmap may be constructed based on the inverted page group table, or alternatively, the memory region availability bitmap may be constructed based on the position of the page group entries in the inverted page group table. This allows the system to systematically reflect the availability of each memory region based on the organizational structure of the page groups, facilitating rapid identification and access to the memory status of a specific region, thereby improving memory management efficiency.

[0111] In some embodiments, the region availability bitmap can be stored in the static random access memory (SRAM) of the first computing unit. Because the constructed region availability bitmap is relatively small—for example, for 40GB of physical memory, it only requires 20K bits of storage space—storing it in the SRAM of the first computing unit has little impact on other storage tasks of the first computing unit. It also ensures high access speed to the region availability bitmap, thereby indirectly improving the efficiency of remote page migration.

[0112] In some embodiments, the migration device of the heterogeneous memory page may include a destination address allocator for constructing a region availability bitmap of the memory.

[0113] Thus, the method of determining the first number of available memory frames from the memory of the first computing unit may be:

[0114] S1214: Determine the page group set with available flags in the regional available bitmap as the target page group set.

[0115] Specifically, when determining available memory frames, the page group set containing the available memory frames is directly determined as the target page group set based on the available flags of the page group sets. In other words, regions that do not contain available memory frames can be quickly skipped using the concise available flags of the region available bitmap, avoiding the lengthy traversal of the entire reverse page group in the dynamic random access memory (DRAM).

[0116] S1215 : Determine a first number of available memory frames according to the idle state flags and protected state flags of the memory frames corresponding to the page group items in the target page group set.

[0117] Specifically, after determining the target page group set including available memory frames, it is only necessary to traverse and search the idle state flags and protected state flags of the memory frames corresponding to the page group items in the target page group set to determine the first number of available memory frames, which greatly saves the traversal and search time.

[0118] In the above solution, a bottom-up memory availability identification mechanism is first established by constructing a reverse page group table and a regional availability bitmap. The reverse page group table records the idle and protected status of each memory frame in a fine-grained manner, providing essential information for determining memory frame availability. By aggregating these page group entries and generating a regional availability bitmap with available flags, it is possible to quickly identify which memory regions contain available resources. Therefore, when determining available memory frames, the regional availability bitmap can be quickly accessed. Its concise flag information allows for rapid skipping of regions without idle frame groups, avoiding lengthy traversals of the entire reverse page group table. This significantly improves the efficiency of idle frame group searches and ensures rapid page migration. Furthermore, the heterogeneous memory page migration device leverages this data structure to quickly locate idle frame groups at the hardware level, avoiding the lengthy software search delays. This effectively ensures the rapid migration of remote page data to local memory, optimizing data access timeliness and migration target selection.

[0119] In some embodiments, as Figure 9 As shown, the method of constructing the memory area available bitmap according to the inverted page group table may include:

[0120] S12131. Aggregate the page group items in the reverse page group table into multiple page group sets of preset sizes, or evenly divide the page group items in the reverse page group table into multiple page group sets according to a preset number.

[0121] Specifically, when dividing the page group items in the reverse page group table into regions, the regions may be divided according to size (eg, 64k) or according to number (eg, 32).

[0122] 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.

[0123] Specifically, whether there are available memory frames in the page group set can be determined according to the idle state flag and the protected state flag of the memory frames in the page group set. If there are available memory frames, an available flag is added to the page group set.

[0124] S12133. Generate a memory area availability bitmap based on multiple page group sets and available flags.

[0125] 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 availability 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.

[0126] In some embodiments, as Figure 10 As shown, when a corresponding swap flag exists in the local physical frame number, a 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:

[0127] S131 , performing a page eviction operation on the local memory frame to obtain a usable local memory frame.

[0128] Specifically, when a corresponding swap flag is present in a local physical frame number, and it is determined that local memory resources are insufficient and an available memory frame cannot be directly allocated, a page eviction operation is performed on the local memory frame to obtain a usable local memory frame. Furthermore, based on a predetermined page replacement algorithm, such as LRU or a custom heat evaluation mechanism, the contents of the local memory frame are written back to the corresponding physical frame of the remote page or to backup storage, and the contents of the local memory frame are cleared to obtain a usable local memory frame.

[0129] 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.

[0130] In this solution, when a corresponding swap flag is present in the local physical frame number, the local memory frame is evicted before the remote page contents are transferred to the available local memory frame. This effectively ensures page access continuity and data consistency. This also improves memory resource utilization and reduces resource conflicts and access latency during remote page loads, helping to maintain stable system operation under high load or memory shortages.

[0131] In some embodiments, as Figure 11 As shown, the method of determining that the target page is a remote page according to the first page table entry corresponding to the virtual page identifier may include the following steps:

[0132] S01. Obtain a page table of a first computing unit.

[0133] Specifically, such as Figure 4 As shown, the heterogeneous memory page migration device may include a page walker for obtaining the page table of the first computing unit.

[0134] 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.

[0135] 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 may be an A flag.

[0136] Specifically, such as Figure 4 As shown, the page walker 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.

[0137] S03: When the value of the target flag is a preset value, determine that the target page is a remote page.

[0138] 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 target flag in the second page table entry indicating the remote page. For example, when the target flag is the A flag, the remote physical frame number in the first page table entry is replaced with the local physical frame number, and after obtaining 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, avoiding the false triggering of the remote access path in subsequent accesses, and ensuring the stability of the system.

[0139] In the above scheme, the first page table entry is searched 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 that when the target page is determined to be a remote page, the heterogeneous memory page migration method in this application is executed, saving the migration time of the remote page.

[0140] In some embodiments, as Figure 12 As shown, when the number of virtual page identifiers in the address translation request is multiple, 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 heterogeneous memory page migration method further includes:

[0141] S133: Obtain the transmission priorities of the target pages corresponding to the multiple virtual page identifiers.

[0142] The transmission priority of the target page is related to the importance, urgency, execution order, access frequency and other aspects of the task corresponding to the target page in the heterogeneous computing system.

[0143] Specifically, the method of obtaining the transmission priority of the target page corresponding to 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, and access frequency of the task corresponding to the target page, and then determine the transmission priority of the target page based on the key index.

[0144] In this way, 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 includes the following steps:

[0145] S134 , 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 according to the transfer priority.

[0146] In the above scheme, when there are multiple virtual page identifiers in the address translation request, the page contents corresponding to the key pages with higher priorities are transmitted first, making full use of the parallel processing capabilities of the hardware and the high bandwidth characteristics of PCIe to ensure that the data most critical to the current computing task can reach the target memory quickly, thereby effectively reducing the computing delay caused by remote page migration and improving the overall system performance.

[0147] In some embodiments, when the heterogeneous memory page migration device includes a page table walker, a destination address allocator, and a page migration engine, its overall operational process is as follows: When the page table walker identifies a page table entry for a remote page and issues a request for an available memory frame to the destination address allocator, the destination address allocator immediately responds by extracting relevant information from its internal target candidate queue. Each entry in the target candidate queue not only contains the frame number of the available memory frame but also clearly indicates, via a swap flag, whether a page replacement operation is required, providing a critical decision-making basis for subsequent migration operations.

[0148] If the available memory frames in the target candidate queue do not require page replacement (i.e., the frame group is idle), the heterogeneous memory page migration device quickly instructs the page migration engine to initiate the data migration process, efficiently migrating the remote pages to the locally available memory frames. During the migration process, the page migration engine employs an optimized transmission strategy, prioritizing the transfer of critical pages within the page group. This fully leverages the hardware's parallel processing capabilities and the high bandwidth of PCIe to ensure that critical data reaches its target location as quickly as possible, effectively reducing computational latency caused by page migration and improving overall system performance.

[0149] If an available memory frame needs to be swapped, the heterogeneous memory page migration device accurately executes 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 synchronously updates the page table entries of the source and target page groups to ensure the accuracy and consistency of the memory mapping relationship and avoid memory access errors caused by page migration and replacement.

[0150] In some embodiments, the heterogeneous memory page migration device may include an available frame manager for searching for available memory frames to replenish the target candidate queue. The available frame manager's search process first focuses on free frame group resources. It rapidly traverses the region availability bitmap to quickly locate frame regions containing available memory frames. The wide SRAM feature of the region availability bitmap plays a significant role in this process, allowing the available frame manager to examine multiple regions simultaneously, significantly improving search efficiency. Once the target region is identified, the available frame manager further reads the entries in the reverse page group table for the frame groups within that region, filters out available memory frames that meet the criteria (i.e., free and unprotected), and adds them to the target candidate queue in an orderly manner. During each search, the available frame manager can populate up to 32 free frame groups, thereby rapidly replenishing the resource reserve of the target candidate queue.

[0151] However, in the special scenario of memory oversubscription, if the Available Frame Manager fails to find an available free frame group after a comprehensive search, it will quickly switch strategies and use a pseudo-random number generator to randomly select replacement candidates from the used frame groups. During the selection process, the Available Frame Manager carefully checks the protection status flag of each candidate frame group to ensure that only unprotected memory frames are included in the target candidate queue and the corresponding swap flag is set, preparing for possible subsequent page replacement operations.

[0152] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.

[0153] The embodiment of the present application also provides a device for migrating heterogeneous memory pages, such as Figure 13 Said device comprises:

[0154] An acquisition module 701 is used to receive an address translation request; the address translation request is a request issued when the first computing unit in the heterogeneous computing system accesses a target page and misses the address translation cache, and includes a virtual page identifier of the target page; a determination module 702 is used to determine a local memory frame from the memory of the first computing unit when determining that the target page is a remote page based on the first page table entry corresponding to the virtual page identifier, and obtain a local physical frame number of the local memory frame; the remote page is a memory page corresponding to the 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 is used 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 is used to replace the remote physical frame number in the first page table entry with the local physical frame number, obtain a second page table entry, and return the second page table entry to the first computing unit.

[0155] In some embodiments, the migration device of heterogeneous memory pages also includes a monitoring module; the monitoring module is used to monitor the number of frame numbers of memory frame numbers in the target candidate queue before determining the local memory frame from the memory of the first computing unit; the determination module 702 is also used to determine a first number of available memory frames from the memory of the first computing unit when the number of frame numbers is less than a first threshold, 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 determination module 702 is specifically used 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.

[0156] In some embodiments, the heterogeneous memory page migration device also includes a construction module; the construction module is used to construct a reverse page group table based on the occupancy and protection status of multiple memory frames before determining the first number of available memory frames from the first computing unit memory; the reverse page group table includes at least idle state flags and protected state flags of multiple memory frames, and the idle state flags and protected state flags are used to indicate whether the memory frames are available; the determination module 702 is specifically used to determine the first number of available memory frames from multiple memory frames based on the idle state flags and protected state flags of the memory frames in the reverse page group table.

[0157] In some embodiments, the determination module 702 is specifically used to: determine a first number of available memory frames from multiple memory frames based on the following judgment conditions and the idle state flag and protected state flag of the memory frame in the reverse page group table; the judgment conditions include: when the idle state flag of the memory frame indicates that the occupancy status of the memory frame is idle, and the protected state flag indicates that the protection status is unprotected, determining that the memory frame is an available memory frame.

[0158] In some embodiments, the heterogeneous memory page migration device also includes a construction module; the construction module is used to construct a reverse page group table based on the occupancy and protection status of multiple memory frames before determining the first number of available memory frames from the first computing unit memory; the reverse page group table includes multiple page group items, and one page group item corresponds to one memory frame; the page group item includes at least an idle state flag and a protected state flag of the memory frame, and the idle state flag and the protected state flag are used to indicate whether the memory frame is available; the construction module is also used to construct a regional available bitmap of the memory based on the reverse page group table; the regional available bitmap includes multiple page group sets, and one page group set includes multiple page group items; when there are available memory frames in a page group set, one page group set also includes an available flag; the determination module 702 is specifically used to: determine the page group set with an available flag in the regional available bitmap as the target page group set; and determine the first number of available memory frames based on the idle state flag and the protected state flag of the memory frame corresponding to the page group item in the target page group set.

[0159] In some embodiments, the construction module is specifically used to: aggregate the page group items in the reverse page group table into multiple page group sets of preset sizes, or divide the page group items in the reverse page group table into multiple page group sets according to a preset number; 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; and generate an area available bitmap of the memory based on the multiple page group sets and the available flags.

[0160] In some embodiments, the construction module is specifically configured to construct a region availability bitmap of the memory according to the position of the page group entry in the inverted page group table.

[0161] In some embodiments, the inverted page group table is stored in a memory of the first computing unit.

[0162] In some embodiments, the region availability bitmap is stored in a static random access memory of the first computing unit.

[0163] 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 for the 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.

[0164] In some embodiments, the determination module 702 is specifically configured to fill the target candidate queue with the frame numbers of the available memory frames and the frame numbers of the candidate available memory frames.

[0165] In some embodiments, the determination module 702 is specifically used to, when filling the frame numbers of the available memory frames and the frame numbers of the standby available memory frames into the target candidate queue, determine that the priority of the frame numbers of the available memory frames is higher than the frame numbers of the standby available memory frames; the frame numbers with higher priority are ranked higher in the target candidate queue than the frame numbers with lower priority.

[0166] In some embodiments, the determination 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.

[0167] In some embodiments, the determination module 702 is further configured to add a swap flag to the frame number of the candidate available memory frame when filling the frame number of the candidate available memory frame into the target candidate queue.

[0168] In some embodiments, the transmission module 703 is specifically used to: when a corresponding exchange flag exists in the local physical frame number, perform a page eviction operation on the local memory frame to obtain a usable local memory frame; and transmit the page content of the remote page to the usable local memory frame according to the remote physical frame number in the first page table entry.

[0169] In some embodiments, the determination module 702 is specifically used to: obtain the page table of the first computing unit; 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; when the value of the target flag is a preset value, determine that the target page is a remote page.

[0170] In some embodiments, the migration device of heterogeneous memory pages also includes a clearing module; the clearing module is used to clear the indication of the target flag for the remote page in the second page table entry 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.

[0171] In some embodiments, the acquisition module 701 is also used to obtain the transmission priority 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 when there are multiple virtual page identifiers in the address conversion request; the transmission module 703 is specifically used to 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 according to the transmission priority.

[0172] For the description of the features in the embodiment corresponding to the heterogeneous memory page migration device, please refer to the relevant description of the embodiment corresponding to the heterogeneous memory page migration method, which will not be repeated here.

[0173] An embodiment of the present application further provides a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps of any of the above-mentioned heterogeneous memory page migration method embodiments when running.

[0174] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.

[0175] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps of any of the above-mentioned heterogeneous memory page migration method embodiments are implemented.

[0176] An embodiment of the present application also provides another computer program product, including a non-volatile computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps in any of the above-mentioned heterogeneous memory page migration method embodiments.

[0177] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0178] The above is a detailed introduction to a heterogeneous memory page migration device, method, and readable storage medium provided by the present application. This article uses specific examples to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of ​​the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.

Claims

1. A heterogeneous memory page migration device, characterized in that: include: A first computing unit, a migration unit, and a memory unit, wherein 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 issued when the first computing unit accesses a target page but misses the address translation cache, and includes a virtual page identifier of the target page; The processor is configured to: When the target page is determined to be a remote page according to the first page table entry corresponding to the virtual page identifier, a local memory frame is determined 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 the 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; 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; 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; The communicator is further configured to return the second page table entry to the first computing unit.

2. The device according to claim 1, characterized in that 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 in the target candidate queue; When the number of frame numbers is less than a first threshold, determining a first number of available memory frames from the memory unit, and filling 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, characterized in that The monitor is further configured to: Before determining a first number of available memory frames from the memory unit, constructing a reverse page group table according to occupancy and protection status of the plurality of memory frames; the reverse page group table includes at least idle state flags and protected state flags of the plurality of memory frames, the idle state flags and protected state flags being used to indicate whether the memory frames are available; The monitor is specifically configured as follows: A first number of available memory frames is determined from the plurality of memory frames according to the idle state flags and the protected state flags of the memory frames in the reverse page group table.

4. The device according to claim 3, characterized in that The monitor is specifically configured as follows: Determine a first number of available memory frames from the plurality of memory frames according to the following judgment conditions and the idle state flag and the protected state flag of the memory frame in the reverse page group table; The judgment condition includes: when the idle state flag of the memory frame indicates that the occupancy status of the memory frame is idle, and the protected state flag indicates that the protection status is unprotected, determining that the memory frame is an available memory frame.

5. The device according to claim 2, characterized in that The monitor is further configured to: Before determining a first number of available memory frames from the memory unit, constructing a reverse page group table based on occupancy and protection status of the plurality of memory frames; the reverse page group table includes a plurality of page group entries, one page group entry corresponding to one memory frame; the page group entry includes at least an idle state flag and a protected state flag of the memory frame, the idle state flag and the protected state flag being used to indicate whether the memory frame is available; Constructing a region available bitmap of the memory according to the reverse page group table; The area available bitmap includes a plurality of page group sets, and one page group set includes a plurality of page group items; when there is an available memory frame in a page group set, the page group set further includes an available flag; The monitor is specifically configured as follows: Determine the page group set with available flags in the regional available bitmap as the target page group set; A first number of available memory frames is determined according to the idle state flags and protected state flags of the memory frames corresponding to the page group items in the target page group set.

6. The device according to claim 5, characterized in that The monitor is specifically configured as follows: Aggregating the page group items in the reverse page group table into a plurality of page group sets of a preset size, or evenly dividing the page group items in the reverse page group table into a plurality of page group sets according to a preset number; For any page group set, if there are available memory frames in the page group set, an available flag is added to the page group set; A region availability bitmap of a memory is generated according to the plurality of page group sets and the availability flag.

7. The device according to claim 5 or 6, characterized in that The monitor is specifically configured as follows: According to the position of the page group entry in the inverted page group table, a region availability bitmap of the memory is constructed.

8. The device according to any one of claims 3 to 6, characterized in that The migration unit further includes a memory, the memory being electrically connected to the monitor and the processor respectively; The memory is configured to store the inverted page group table in the memory unit.

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, the memory being electrically connected to the monitor and the processor respectively; The memory is configured to store the area availability bitmap in the static random access memory.

10. The device according to claim 2, characterized in that The monitor is specifically configured as follows: When the number of the available memory frames is less than the first number, randomly selecting a second number of unprotected memory frames as candidate available memory frames for the available memory frames; The second number is a difference between the first number and the number of available memory frames.

11. The device according to claim 10, characterized in that The monitor is specifically configured as follows: The frame number of the available memory frame and the frame number of the candidate available memory frame are filled into the target candidate queue.

12. The device according to claim 11, characterized in that The monitor is specifically configured as follows: 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; the frame number with a higher priority is ranked higher in the target candidate queue than the frame number with a lower priority.

13. The device according to claim 12, characterized in that 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, characterized in that The monitor is further configured to: When the frame numbers of the candidate available memory frames are filled into the target candidate queue, a swap flag is added to the frame numbers of the candidate available memory frames.

15. The device according to claim 14, characterized in that The processor is specifically configured to: When the local physical frame number has a corresponding swap flag, performing a page eviction operation on the local memory frame to obtain a usable local memory frame; The page content of the remote page is transferred 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, characterized in that The processor is specifically configured to: Obtaining a page table of the first computing unit; Traversing the page table to find a first page table entry corresponding to the virtual page identifier, and obtaining a target flag corresponding to the first page table entry; When the value of the target flag is a preset value, it is determined that the target page is a remote page.

17. The device according to claim 16, characterized in that The processor is further configured to: After the remote physical frame number in the first page table entry is replaced with the local physical frame number to obtain the second page table entry, the indication of the remote page by the target flag in the second page table entry is cleared.

18. The device according to claim 1, characterized in that The processor is further configured to: When the number of virtual page identifiers in the address translation request is multiple, Obtaining the transmission priorities of target pages corresponding to multiple virtual page identifiers; The processor is specifically configured to: The page content of the remote page is transmitted 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: include: receiving an address translation request; The address translation request is a request issued by a first computing unit in a heterogeneous computing system when accessing a target page and the request misses the address translation cache, and includes a virtual page identifier of the target page; 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, a local memory frame is determined from the memory of the first computing unit to obtain a local physical frame number of the local memory frame; The remote page is a memory page corresponding to the 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; 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 remote physical frame number in the first page table entry is replaced with the local physical frame number to obtain a second page table entry, and the second page table entry is returned to the first computing unit.

20. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the heterogeneous memory page migration method as claimed 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 heterogeneous memory page migration method as claimed in claim 19 are implemented.

Citation Information

Patent Citations

  • PML-based virtual machine page migration method and system

    CN115576644A

  • Page transport and copy method based on operation system reverse page table

    CN1560746A