WO2024060710A1 - 一种页面换入方法以及装置 - Google Patents
一种页面换入方法以及装置 Download PDFInfo
- Publication number
- WO2024060710A1 WO2024060710A1 PCT/CN2023/100492 CN2023100492W WO2024060710A1 WO 2024060710 A1 WO2024060710 A1 WO 2024060710A1 CN 2023100492 W CN2023100492 W CN 2023100492W WO 2024060710 A1 WO2024060710 A1 WO 2024060710A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- host
- page
- target page
- swap
- memory
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/08—Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
- G06F12/10—Address translation
- G06F12/1009—Address translation using page tables, e.g. page table structures
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/08—Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
- G06F12/10—Address translation
- G06F12/109—Address translation for multiple virtual address spaces, e.g. segmentation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45583—Memory management, e.g. access or allocation
Definitions
- the present application relates to the field of communication technology, and in particular, to a page switching method and device.
- the processor in the host can swap out the inactive pages in the memory of the host to the swap partition, thereby releasing the memory space of the host, thereby realizing the memory expansion of the host.
- the swap A partition is considered a type of virtual memory, and the swap partition will typically be located on the host's hard drive.
- the processor in the host needs to call these pages that have been swapped out to the swap partition, the processor will obtain the page from the swap partition and swap the page into the host's memory.
- swapping pages from the swap partition to the host's memory will occupy processor resources, making the processor unable to provide more computing power to support business-type work in the host.
- the present application provides a page switching method and device to reduce the occupation of the processor by the page switching operation.
- the present application provides a page swapping method, in which an acceleration device connected to a host communication system bus can replace the processor in the host to swap pages from a storage device into the memory of the host.
- the acceleration device in the host receives a swap-in command, and the swap-in command is used to instruct the target page to be swapped into the memory of the host.
- the acceleration device obtains the target page from the storage device, swaps the target page into the memory, and notifies the host (such as the processor or MMU in the host) that the target page has been swapped into the memory.
- the page swap operation can be performed by the acceleration device.
- the processor in the host no longer needs to swap the target page from the storage device into the host's memory, effectively releasing the processor's computing power and reducing the need for page swaps.
- the occupation of the processor ensures the execution efficiency of business work in the host.
- the acceleration device may receive the swap instruction from a processor in the host or an MMU in the host. For example, when the MMU finds a page missing in the PT, it can send a swap command to the acceleration device. After the acceleration device swaps the target page into the host's memory, the acceleration device notifies the MMU that the target page has been swapped into the memory. For another example, when the processor determines that there is enough memory space in the memory, it can send a swap command to the acceleration device. After the acceleration device swaps the target page into the memory of the host, the acceleration device notifies the processor that the target page has been swapped into the memory. middle.
- the processor and MMU in the host only need to send a swap command, and the target page can be swapped into the memory of the host through the acceleration device without the participation of the processor.
- the page swap method is simpler and faster.
- the acceleration device when the acceleration device obtains the target page from the storage device, it first obtains the corresponding relationship between the virtual address of the target page and the exchange address of the target page.
- the exchange address of the target page is the address of the target page in the storage device. .
- the acceleration device determines the exchange address of the target page according to the corresponding relationship. Then obtain the target page from the storage device according to the exchange address of the target page.
- the acceleration device can communicate with the storage device and send Send a data request carrying the exchange address of the target page to request to obtain the target page. After receiving the data request, the storage device can feed back the target page to the acceleration device.
- the acceleration device After the acceleration device obtains the corresponding relationship, it can use the corresponding relationship to obtain the exchange address of the target page, so as to communicate with the storage device and request to obtain the target page.
- the storage device can provide storage space as the virtual memory of the host.
- the storage device may be a storage device deployed outside the host and connected to the host through a network.
- the storage device can also be local to the host.
- the storage device can also be deployed in the cloud.
- the storage device can be storage space pre-allocated for the host in a private cloud or public cloud.
- the corresponding relationship may be recorded when the acceleration device swaps out the target page from the memory to the storage device.
- the corresponding relationship may also be obtained by the acceleration device from the processor of the host.
- the corresponding relationship may be recorded when the processor swaps out the target page from the memory to the storage device.
- the host further includes a processor, and the acceleration device is connected to the processor through a system bus.
- the acceleration device swaps the target page into the memory, it can receive a notification sent by the processor, and the notification is used to instruct the processor.
- the physical address configured for the target page in the memory; after the acceleration device obtains the physical address, it can write the target page to the physical address through DMA.
- the acceleration device After the acceleration device obtains the physical address, it can use DMA to write the target page into the memory, bypassing the processor and further reducing the processor occupancy.
- the acceleration device may also perform a swap-out operation of the target page.
- the acceleration device receives a swap-out instruction sent by the processor of the host.
- the swap-out instruction is used to instruct the target page in the host memory to be swapped out to the storage device.
- the swap-out instruction includes the virtual address of the target page and the target page; the acceleration device After receiving the swap-out command, the target page is swapped out to the storage device and the corresponding relationship is recorded.
- the acceleration device undertakes the main operations of page swapping in and page swapping out, which can reduce the occupation of the processor and ensure that the host processor can provide sufficient computing power to support business-type work.
- the acceleration device also has a data decompression function.
- the acceleration device obtains the compressed target page from the storage device, the acceleration device decompresses the compressed target page to obtain the target page, and then converts the target page The page is swapped into the host's memory.
- the acceleration device can decompress the compressed target page by itself without the participation of the processor, further releasing the computing power of the processor.
- the acceleration device when the acceleration device swaps out the target page to the storage device, in order to reduce the storage space occupied by the target page, the acceleration device compresses the target page and then swaps it out to the storage device.
- this application also provides a page switching device.
- the page switching device has the function of implementing the behavior in the method example of the first aspect.
- Functions can be implemented by hardware, or by hardware executing corresponding software.
- Hardware or software includes one or more units corresponding to the above functions.
- the structure of the device includes a receiving module (for receiving swap-in instructions or swap-out instructions), and a swap-out module (for swapping out the target page to the storage device).
- it also includes Swap-in modules (used to swap the target page from the storage device into the host's memory). These modules can perform the corresponding functions of the DPU in the above-mentioned method examples in the first aspect. For details, please refer to the detailed description in the method examples, which will not be described here. .
- the present application also provides an acceleration device, which includes a processor with processing functions such as a DPU, GPU, NPU, or TPU.
- a processor with processing functions such as a DPU, GPU, NPU, or TPU.
- the types of processors listed above are only examples, and this application does not limit the types of processors in the acceleration device.
- the specific types of processors included are described below only by taking the processor included in the acceleration device as a DPU as an example.
- it also includes a power supply circuit and memory. The power supply circuit is used to power the DPU.
- the DPU has the function of implementing the behavior of the DPU in the method examples in the above-mentioned first aspect and various possible implementation methods of the first aspect.
- the beneficial effects can be found in the description of the first aspect and will not be repeated here.
- computer program instructions are stored in a memory, and the DPU is coupled to the memory.
- the DPU can call computer execution instructions stored in the memory to execute the method executed by the DPU in the above-mentioned first aspect and various possible implementations of the first aspect.
- embodiments of the present application also provide a computing device.
- the computing device may be the host mentioned in the first aspect.
- the beneficial effects can be found in the description of the first aspect and will not be described again here.
- the computing device includes an accelerator. device and memory.
- the acceleration device receives the swap-in instruction, which is used to instruct the target page to be swapped into the memory of the computing device. After the acceleration device receives the swap-in instruction, the acceleration device obtains the target page from the storage device; swaps the target page into Memory, notifies the computing device that the target page has been swapped into memory.
- the acceleration device receives a swap instruction from a processor or MMU of the computing device.
- the acceleration device when the acceleration device obtains the target page from the storage device, it first obtains the correspondence between the virtual address of the target page and the exchange address of the target page.
- the exchange address of the target page is the address of the target page in the storage device.
- the acceleration device determines the exchange address of the target page based on the corresponding relationship.
- the acceleration device communicates with the storage device and obtains the target page from the storage device according to the exchange address of the target page.
- the storage device is a storage device deployed outside the computing device and connected to the computing device through a network, or is a local storage device of the computing device, or is allocated to the computing device in a public cloud or a private cloud. of storage space.
- the corresponding relationship is recorded when the acceleration device swaps out the target page from the memory to the storage device.
- the corresponding relationship may also be obtained by the acceleration device from the processor of the computing device, and the corresponding relationship may be recorded when the processor swaps out the target page from the memory to the storage device.
- the computing device further includes a processor, and the acceleration device is connected to the processor through a system bus.
- the processor may send a notification to the acceleration device, and the notification is used to indicate the physical address configured by the processor for the target page in the memory. After receiving the notification, the acceleration device writes the target page to the physical address through DMA.
- the processor of the computing device sends a swap-out instruction to the acceleration device.
- the swap-out instruction is used to instruct the target page in the memory of the computing device to be swapped out to the storage device.
- the swap-out instruction includes the target page. Virtual address and target page.
- the acceleration device After receiving the swap-out command, the acceleration device swaps out the target page to the storage device and records the corresponding relationship.
- the acceleration device obtains the compressed target page from the storage device, decompresses the compressed target page, obtains the target page, and swaps the target page into the memory.
- the acceleration device when the acceleration device swaps out the target page to the storage device, it compresses the target page and then swaps it out to the storage device.
- this application provides a data processing system.
- the data processing system includes a host and a storage device.
- the storage device communicates with the host through an internal bus or network, and the host is equipped with an acceleration device.
- the host sends a swap-out command to the acceleration device, and the swap-out command contains data.
- the acceleration device compresses the data and saves the compressed data in the memory of the acceleration device or in the memory of the host.
- the acceleration device compresses the data so that the data takes up less space in the memory of the acceleration device or in the host memory. Reduce or improve the utilization of acceleration devices in memory or host memory.
- the compressed data is stored in the memory of the acceleration device.
- the acceleration device can ensure that the free memory space in the memory of the acceleration device is less than the first free threshold, or the access frequency of the compressed data is less than When the threshold is reached, the compressed data is migrated to the storage device, which can reduce the memory usage in the acceleration device.
- the compressed data is stored in the memory of the host, and the acceleration device can be used when the free memory space in the memory of the host is less than the second idle threshold, or the access frequency of the compressed data is lower than the threshold.
- the compressed data is migrated to the memory of the acceleration device, which can reduce the memory usage in the host.
- the host sends a swap instruction to the acceleration device, and the swap instruction instructs to obtain data.
- the acceleration device After receiving the swap command, the acceleration device obtains the compressed data, decompresses the compressed data, and after decompression, stores the decompressed data in the memory of the host.
- the acceleration device obtains the compressed data from the storage device, and if the compressed data is stored in the memory of the acceleration device or the memory of the host, the acceleration device The device can accelerate the memory in the device or the memory of the host to obtain the compressed data.
- the present application further provides a computer-readable storage medium, in which instructions are stored, and when the computer-readable storage medium is run on a computer, the computer executes the method in the above-mentioned first aspect and various possible implementations of the first aspect.
- the present application also provides a computer program product containing instructions that, when run on a computer, cause the computer to execute the method in the above-mentioned first aspect and each possible implementation of the first aspect.
- this application also provides a computer chip, which is connected to a memory.
- the chip is used to read and execute the software program stored in the memory, and execute the method in the above-mentioned first aspect and each possible implementation of the first aspect. .
- Figure 1 is a schematic diagram of the virtualization architecture of a host provided by this application.
- Figure 2 is a schematic structural diagram of a host provided by this application.
- FIG. 3 is a schematic diagram of a page swapping method provided by this application.
- Figure 4 is a schematic diagram of a page switching method provided by this application.
- Figure 5 is a schematic structural diagram of a page switching device provided by this application.
- Virtualization technology computing instance, container, virtual machine (VM).
- Virtualization is a resource management technology that abstracts and transforms the host's physical resources, such as processors, memory, and interfaces, and presents them. Virtualization is a resource configuration method from a logical perspective and is a logical abstraction of physical resources.
- the host can use virtualization technology to form a software module with an independent operating environment on the host.
- the software module with an independent operating environment formed on the host is called a computing instance.
- the computing instance can be a virtual machine or a container.
- a virtual machine is a "complete computer" with complete hardware system functions simulated through virtual machine technology and running in a completely isolated environment. Everything that can be done on a physical computer can be done on a virtual machine.
- a virtual machine has components such as a processor (the processor is also called a virtual processor), memory, and a hard disk.
- the processor, memory, and hard disk of the virtual machine are The software is virtualized by the host's processor, memory, hard disk and other components.
- An operating system is installed on the virtual machine, and the operating system on the virtual machine is independent of the operating system of the host itself. In order to distinguish between these two different operating systems, the operating system on the host is usually called the host operating system (hostOS), and the operating system on the virtual machine is usually called the guest operating system (guestOS). ).
- hostOS host operating system
- guestOS guest operating system
- a container is an independent operating environment simulated through virtualization technology.
- the container is similar to a lightweight sandbox, which shields the software and hardware outside the container.
- the container implements virtualization at the operating system level and directly replicates the environment. Use the host operating system.
- a compute instance is viewed as a special "process.” This "process” will perform computing tasks and occupy the host's processor, memory, hard disk and other resources.
- the host operating system configures a memory space dedicated to the computing instance for the computing instance, and the computing instance occupies the memory space to support the computing tasks that the computing instance needs to perform.
- MMU Memory management unit
- MMU is also called paged memory management unit (PMMU).
- PMMU paged memory management unit
- the MMU is a hardware device located between the core of the processor and the bus connecting cache and memory.
- the MMU is usually considered to be part of the processor. In this case, the operations performed by the MMU can be considered as part of the processor. The operation performed.
- the MMU is an independent hardware device and is only explained as an example.
- the MMU is mainly used to process memory access requests initiated by the processor.
- the MMU has an address translation function and can convert between the virtual address of the memory and the physical address of the memory.
- the MMU can parse the access request issued by the processor, convert the virtual address of the memory carried in the access request into the physical address of the memory, and write the data carried in the access request to the physical address of the memory (access A request is used to request to write data at the virtual address of the memory); or to read data from the physical address of the memory and feed the data back to the processor (an access request is used to request to read data at the virtual address of the memory) ).
- the MMU also has memory protection functions and cache control functions for the processor.
- MMU can manage memory space at page granularity (that is, page memory management). In the management of memory space at page granularity, the memory space is divided into blocks of fixed size, and one block is a page. The MMU can allocate, manage, and protect memory in units of pages.
- the MMU In order to convert a virtual address to a physical address, the MMU needs to obtain an address translation table, which is called a page table (PT).
- the page table includes one or more page table entries (PTE). .
- PTE page table entries
- Each page table entry corresponds to a page and records the correspondence between the virtual address of the page and the physical address of the page as well as some control information.
- the address translation table is maintained by the host operating system and stored in the host's memory. That is to say, the host operating system can perform some updates on the PT, such as adding page table entries, deleting page table entries, modifying page table entries, etc. operation and save the updated page table in the host's memory.
- the MMU needs to perform address translation, it calls the PT from the host's memory.
- the virtual addresses of pages used by different processes running on the host may be the same, in order to avoid confusion between the virtual addresses used by different processes.
- the host operating system maintains the corresponding PT for each process on the host (the process here also includes computing instances).
- the PT corresponding to the computing instance records the mapping relationship between the virtual address and the physical address of the memory space of the host occupied by the computing instance.
- Table 1 abstracts PT into a table, and each row of the table indicates a PTE. Each row records the virtual address (VA) of a page and the physical address (PA) of the page.
- VA virtual address
- PA physical address
- the PTE also includes a flag bit. This flag bit is used to identify whether the PTE is accessed. In the embodiment of this application, the flag bit is 1, which indicates that the PTE is accessed.
- the access of the PTE indicates that the memory space indicated by the physical address in the PTE is accessed; the flag bit indicates that the PTE is accessed. If the flag bit is 0, it means that the PTE has not been accessed. If the PTE is accessed, it means that the memory space indicated by the physical address in the PTE has not been accessed.
- Each time the MMU reads a PTE it will set the flag bit in the PTE to 1. If the PTE is not read again within a specific period of time after the flag bit is set to 1, the flag bit of the PTE will flip to 0 on its own.
- the computing instance When the computing instance needs to write data to virtual address V1, the computing instance will send access request 1 to the MMU (from the perspective of hardware interaction, the access request 1 is sent to the MMU by the processor), and the access request 1 Used to request to write data at virtual address V1.
- This access request 1 also carries the virtual address V1 of the page and the data that needs to be written.
- the MMU finds the PT corresponding to the computing instance, and searches the PT to see whether there is a physical address corresponding to the virtual address V1. If the PTE recording the virtual address V1 is not found in the PT, the MMU will trigger the page fault process and send an exception signal indicating the page fault interrupt to the host operating system. The host operating system calculates the page fault in the memory.
- the instance allocates a section of free memory space (that is, a free page), and the physical address P1 of the memory space is used as the physical address corresponding to the virtual address V1.
- the host operating system updates the PT, that is, adds a PTE to the PT, and the PTE records the correspondence between the physical address P1 and the virtual address V1.
- the host operating system saves the updated PT in the host's memory and notifies the MMU to continue processing.
- the MMU obtains the updated PT, searches for the PTE that records the virtual address V1, determines the physical address P1 corresponding to the virtual address V1, and sets the flag position in the PTE to 1.
- the MMU writes the data to the physical address P1.
- the computing instance When the computing instance needs to read data from virtual address V1, the computing instance will send access request 2 to the MMU (from the perspective of hardware interaction, the access request 2 is sent to the MMU by the processor), and the access request 2 is used to A request is made to read data at virtual address V1.
- This access request 2 also carries the virtual address V1 of the page.
- the MMU finds the PT corresponding to the computing instance, and searches the PT to see whether there is a physical address corresponding to the virtual address V1. If the PTE recording the virtual address V1 is found in the PT, the MMU reads the data from the physical address corresponding to the virtual address, feeds the data back to the computing instance, and sets the flag bit to 1.
- Scenario 1 There is a switching mechanism in the host and a switching module is deployed.
- the MMU can trigger the page fault interrupt process and obtain the data on the virtual address V1 through the switching module.
- the process by which the MMU obtains the data at the virtual address V1 through the switching module can be found in the following description of the switching mechanism, which will not be described again here.
- Scenario 2 There is no switching mechanism in the host. The MMU will trigger the page fault interrupt process and send an exception signal indicating the page fault interrupt to the host operating system, which will be handed over to the host operating system for continued processing.
- the swap mechanism refers to memory swapping.
- the swap mechanism proposes two concepts: physical memory and virtual memory.
- the physical memory is the actual memory of the host, which may also be referred to as the host's memory in the present embodiment of the application.
- the virtual memory is the swap partition, which is usually located in the local storage device of the host.
- the local storage device of the host refers to the storage device connected to the host through the system bus, such as the hard disk of the host.
- the virtual memory may also be located in a remote storage device.
- the remote storage device refers to the storage device connected to the host through the network, such as a storage node in a remote storage system.
- the memory can also be deployed in a private cloud or a public cloud, that is, it can also be located in a cloud data center.
- the virtual memory is a storage space pre-allocated for the host in the cloud data center, and the storage space is distributed on one or more devices. That is, the virtual memory can be deployed in the cloud, and the device where the virtual memory is located is located in the cloud.
- the exchange mechanism it is allowed to open up a part of the storage space from the host's storage device (the storage device here includes the host's local storage device, remote storage device, and device in the cloud), and virtualize this part of the storage space into the host's memory space as virtual memory.
- the host's memory space is insufficient, data is exchanged between the physical memory and the virtual memory.
- the switching module is essentially a software module running on the host and is a part of the host operating system.
- the exchange mechanism is implemented as follows:
- the switch module may swap out some pages in the physical memory to the virtual memory, and save the data in these pages to the virtual memory to free up some memory space in the physical memory. This process is called page swap out, and these swapped pages can be called swapped-out pages.
- the PTE of the swapped-out page in the PT i.e., the PTE that records the correspondence between the virtual address of the swapped-out page and the physical address of the swapped-out page
- the switch module needs to record the correspondence between the virtual address of the swapped-out page and the address of the swapped-out page in the virtual memory.
- the swap module needs to call these pages on the host (for example, the MMU receives access request 2 initiated by a process on the host, and the access request carries the virtual address of the swapped-out page), or there is enough free space in the host's physical memory. (For example, if the size of free memory space in physical memory is greater than the preset threshold), the swap module can swap out pages from virtual memory into physical memory. This process is page swap in. These swapped-in pages may be called swapped-in pages. In this process, since the swap-in page is saved in physical memory, the host operating system needs to allocate a new physical address for the swap-in page in physical memory (this physical address is called the physical address of the swap-in page).
- the MMU uses The PTE about the swapped-in page will be added to the PT (that is, the PTE that records the previous correspondence between the virtual address of the swapped-in page and the physical address of the swapped-in page).
- the swap module will also delete the previously recorded correspondence between the virtual address of the swapped-in page and the address of the swapped-in page in the virtual memory.
- the following combines the workflow of the MMU and the switching module to further explain the processing flow of a common access request initiated for a computing instance to read page A. Since the switching module is usually considered a part of the host operating system, this processing In the description of the process, the switching module and the host operating system are no longer distinguished, and they are collectively referred to as the host operating system.
- the computing instance initiates an access request, which is used to request to read the data in page A.
- the access request carries the virtual address V1 of page A.
- the MMU obtains the access request and obtains the PT corresponding to the computing instance from the memory.
- the MMU searches for the PTE that records the virtual address V1 from the PT.
- the MMU determines the physical address P1 corresponding to the virtual address V1, sends the physical address P1 to the memory, and feeds back the data returned by the memory on the physical address P1. Give calculation examples.
- the MMU will trigger the page fault process and send a page fault exception signal to the host operating system, and the host operating system will suspend the operation of the computing instance.
- the host operating system looks for the correspondence between the virtual address V1 recorded when page A was swapped out and the address X1 of the data in page A in the virtual memory, swaps the data in page A from the virtual memory to the host's memory according to the address X1, and reallocates a free memory space for page A.
- the host operating system reallocates the physical address P2 of the free memory space for the page, and uses the physical address P2 as the physical address corresponding to the virtual address V1 to update the PT.
- the host operating system adds a PTE to the PT, and the PTE records the correspondence between the physical address P2 and the virtual address V1.
- the host operating system PT saves the updated PT in the host's memory, notifies the MMU to continue processing, and starts the operation of the computing instance.
- the MMU obtains the updated PT, searches for the PTE that records the virtual address V1, determines the physical address P2 corresponding to the virtual address V1, and sets the flag position in the PTE to 1.
- the MMU sends the physical address P2 to the host's memory, and feeds back the data fed back from the host's memory to the computing instance.
- the computing instances can occupy the memory space of the host (that is, occupy some pages in the memory), but the computing instances (especially virtual machines) use the occupied memory space. situation, the host operating system cannot sense it.
- the host operating system determines which page or pages in memory will be swapped out.
- a common method is that the host operating system will use the least recently used (LRU) algorithm to determine the least recently used page or pages in the memory, and swap out the determined page or pages to the virtual memory. in memory.
- LRU least recently used
- the host operating system cannot obtain the usage of the pages occupied by the computing instance (such as a virtual machine). For example, the host operating system cannot obtain whether each page occupied by the computing instance is the core of the computing instance. The host operating system cannot know the occupied pages or pages occupied by applications in the computing instance. The host operating system cannot know the frequency of access to the occupied pages by the computing instance. In view of this, the host operating system will use some of the more important pages of the computing instance as swap-out pages and swap them out into the virtual memory. When the computing instance needs to call these pages, the MMU will trigger the page fault interrupt process, and the page fault interrupt process will be accompanied by The page swap operation increases the delay, causing the computing instance to freeze and affecting the work efficiency of the computing instance.
- embodiments of the present application propose a page swapping method.
- the computing instance can send a page tag to the host operating system.
- the page tag indicates the importance of each page occupied by the computing instance in the host's memory.
- the host operating system determines the target page in the host's memory that needs to be swapped out based on the page label, and transfers the determined The target page is swapped out to this storage device.
- the computing instance can inform the host operating system of the importance of the occupied pages, the host operating system can avoid swapping out the pages of the computing instance that occupy the higher importance to the storage device.
- the MMU will not trigger the page fault interrupt process, and the computing instance will not be suspended.
- the host operating system when the host operating system swaps out pages to the storage device, the host operating system sends a swap out command to the host's acceleration device.
- the swap out command is used to instruct the acceleration device to swap out the page.
- the swap out command carries the virtual address of the page as well as the page.
- the acceleration device obtains the page, stores the page in the storage device, and records the correspondence between the virtual address of the page and the address of the page in the storage device. That is to say, the acceleration device can replace the host operating system (ie, the processor) to swap pages from the host's memory to the storage device, which can reduce the occupation of the processor and release the computing power of the processor.
- the acceleration device of the host can replace the processor in the host (which can also be understood as the host operating system) to swap the page from the storage device to Host memory.
- the MMU in the host sends a swap command to the acceleration device.
- the swap command is used to instruct the page to be swapped into the memory.
- the swap command can carry the virtual address of the page.
- the acceleration device receives the swap command.
- the page can be swapped from the storage device into the memory of the host according to the swap instruction, and the MMU is notified that the page has been swapped into the memory of the host.
- the acceleration device can determine the address of the page in the storage device based on the recorded correspondence, obtain the page from the storage device based on the address of the page in the storage device, and write the page into the memory of the host. . This can further reduce processor usage.
- swapping out pages to a storage device outside the memory refers to swapping out pages to a swap partition, where the storage device is a storage device with a swap partition deployed. That is to say, the two expressions of swapping out pages to a storage device outside the memory and swapping out pages to a swap partition are essentially the same. In the following, they are unified as swapping out pages to a swap partition. However, it should be understood that swapping out the page to the swap partition means swapping the page into the storage device and storing the page in the storage device.
- swapping pages from the storage device into the host's memory means swapping pages from the swap partition into the host's memory, swapping pages from the storage device into the host's memory, and swapping pages from the swap partition into the host.
- the essence expressed by the two expressions of memory is the same. In the following, they are unified as pages being swapped from the swap partition to the host's memory. That is to say, in order to make the expression more clear, in the process of swapping in and swapping out pages, the swap partition will be used to refer to the storage device where the swap partition is located.
- FIG1 a schematic diagram of a virtualization architecture of a host provided in an embodiment of the present application is shown.
- Virtualization technology is applied to a host 10 to form a virtualization architecture as shown in FIG1 .
- the virtualization architecture of the host 10 includes underlying hardware 100, a host operating system 200, a computing instance management unit 300, and at least one computing instance 400.
- the host 10 is a computing device.
- the host 10 can be a computing device such as a server, a mobile terminal, or a tablet computer.
- the underlying hardware 100 refers to some hardware components in the host 10, such as a processor 110, a memory 120, an input output (I/O) interface 130, etc.
- the underlying hardware 100 can be understood as physical resources on the host 10, which are objects that need to be virtualized in the virtualization technology.
- the host 10 runs software modules such as a host operating system 200, a computing instance management unit 300, and a computing instance 400.
- the host operating system 200 runs on the processor 110 and is used to implement the basic functions of the host 10; the basic functions include but are not limited to: management functions for the underlying hardware 100, input/output devices (such as monitors, keyboards) connected to the host 10 , mouse, etc.) and the management of processes in the host 10.
- the embodiments of this application mainly involve management functions for the underlying hardware 100.
- the host operating system 200 can monitor the occupancy of the memory 120 and allocate memory space; the host operating system 200 can monitor the occupancy of the memory 120 and allocate memory space. 200 can also detect the access frequency of pages in the memory 120; the host operating system 200 can implement page exchange between the memory 120 of the host 10 and the swap partition 160.
- the host operating system 200 can obtain the page tag of the computing instance 400 from the computing instance 400.
- the page tag indicates the importance of the page occupied by the computing instance 400 in the memory 120 of the host 10.
- the host operating system 200 can also obtain the page access frequency of each page occupied by the computing instance 400.
- the host operating system 200 can swap out pages from the host 10 based on some or all of the page labels, page access frequencies, and user-configured page swap parameters. Determine the target page within the inner page.
- the host operating system 200 swaps out the determined target page to the swap partition 160 .
- the host operating system 200 may also swap the pages swapped out to the swap partition 160 into the memory 120 of the host 10 .
- the host operating system 200 includes an instance page identification module 210 and a switching module 220 .
- the instance page identification module 210 can obtain the page tag from the computing instance 400, and can also obtain the page access frequency of each page occupied by the computing instance 400 according to the access status of the MMU to the PT corresponding to the computing instance 400.
- the instance page identification module 210 can also provide a parameter configuration interface for users, allowing users to configure page exchange parameters.
- the page exchange parameters indicate the filter conditions of the target page.
- the page swap parameters include but are not limited to: the identification of the computing instance 400 that is allowed to swap out the page, the page scanning frequency, the cold page determination threshold, and the maximum memory space that the computing instance 400 is allowed to occupy.
- the instance page identification module 210 When a page needs to be swapped out from the memory 120 of the host 10 to the swap partition 160, the instance page identification module 210 Some or all of the page tags, page access frequencies, and page exchange parameters of the computing instance 400 are used to filter the target page from the pages occupied by the computing instance 400.
- the target page is a page that is allowed to be swapped out among the pages occupied by the computing instance 400. .
- the instance page identification module 210 sends the virtual address of the target page to the switching module 220.
- the swap module 220 is used to implement page swapping between the memory 120 of the host 10 and the swap partition 160 . That is, the swap module 220 can swap out pages in the memory 120 of the host 10 to the swap partition 160 and swap pages in the swap partition 160 into the memory 120 of the host 10 .
- the swap module 220 When the swap module 220 needs to swap a page in the memory 120 of the host 10 to the swap partition 160 , the swap module 220 swaps out the target page to the swap partition 160 .
- the exchange module 220 can also update the PT corresponding to the computing instance 400 and delete the PTE related to the target page.
- the swap module 220 When the swap module 220 swaps out the target page to the swap partition 160, it may send the target page to the swap partition 160, that is, the swap module 220 itself completes swapping out the target page.
- the swap module 220 may also instruct the acceleration device 150 of the host 10 to perform swapping out of the target page. For example, the swap module 220 sends a swap out instruction to the acceleration device 150 of the host 10, telling the acceleration device 150 to swap out the target page to the swap partition 160.
- the swap out instruction carries the virtual address of the target page.
- the swap module 220 can directly obtain the target page from the swap partition 160 and swap the acquired target page into the memory 120 of the host 10 .
- the swap module 220 may also instruct the acceleration device 150 of the host 10 to perform page swapping. For example, the swap module 220 sends a swap command to the acceleration device 150 of the host 10, telling the acceleration device 150 to swap the target page into the memory 120 of the host 10.
- the swap command carries the virtual address of the target page.
- each functional module in the embodiment of the present application can be integrated into one processing module, or each module can exist physically alone, or two or more modules can be integrated into one module.
- the above integrated modules can be implemented in the form of hardware or software function modules.
- the computing instance management unit 300 is used to manage the computing instance 400.
- the computing instance management unit 300 can virtualize the underlying hardware 100 to provide a running environment for the computing instance 400.
- the computing instance management unit 300 provides a running environment to the computing instance 400.
- the computing instance management unit 300 can simulate the running environment for the computing instance 400 through software.
- the computing instance 400 may pass the underlying hardware 100 (such as the memory 120) directly to the computing instance 400.
- the computing instance management unit 300 When the computing instance 400 is a virtual machine, the computing instance management unit 300 includes QEMU (quick emulator) and a virtual machine monitor (VMM). When the computing instance 400 is a container, the computing instance management unit 300 can be a container engine.
- QEMU quick emulator
- VMM virtual machine monitor
- the computing instance management unit 300 may transmit the page tag of the computing instance 400 to the host operating system 200 .
- the computing instance management unit 300 may be built into the host operating system 200.
- the host operating system 200 has the function of the computing instance management unit 300 . That is to say, the host operating system 200 can directly obtain the page tag of the computing instance 400 from the computing instance 400 .
- the computing instance 400 has an independent operating environment.
- the computing instance 400 occupies the physical resources of the host 10 and can perform various tasks and implement related services based on the occupied physical resources.
- the computing instances 400 are independent of each other and do not affect each other.
- the computing instance 400 may be a virtual machine, a container, or other modules formed by virtualization of the physical resources of the host 10 .
- the computing instance 400 can evaluate the memory occupied by the computing instance 400 in the memory 120 of the host 10 Based on the importance of the page, a page label of the calculation instance 400 is generated.
- the computing instance 400 may also send the page information of the computing instance 400 to the host operating system 200 .
- the host 10 includes an I/O interface 130, a processor 110, a memory 120, and Acceleration device 150.
- the I/O interface 130, the processor 110, the memory 120, and the acceleration device 150 may be connected through a system bus.
- the system bus may be a peripheral component interconnect express (PCIe) bus or a computing bus.
- PCIe peripheral component interconnect express
- Fast interconnect compute express link, CXL
- universal serial bus universal serial bus
- USB universal serial bus
- Figure 2 illustrates one of the connection methods.
- the acceleration device 150 can be directly inserted into the card slot on the motherboard of the host 10, and exchanges data with the processor 110 through the PCIe bus 140.
- the I/O interface 130 is used to communicate with devices located external to the host 10 . For example, data sent by a device other than the host 10 is received through the I/O interface 130 or data is sent to a device other than the host 10 through the I/O interface 130 .
- the processor 110 is the computing core and control core of the host 10. It can be a central processing unit (CPU) or other specific integrated circuits.
- the processor 110 can also be other general-purpose processors, digital signal processing (DSP), application specific integrated circuit (ASIC), field programmable gate array (field programmable gate array, FPGA) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
- DSP digital signal processing
- ASIC application specific integrated circuit
- FPGA field programmable gate array
- Programmable logic devices discrete gate or transistor logic devices, discrete hardware components, etc.
- the memory 120 is generally used to store computer program instructions related to the host operating system 200, the computer program instructions related to the computing instance management unit 300, and the computing instance 400, and during the running process of the host operating system 200, the computing instance management unit 300, and the computing instance 400. the data generated.
- the memory 120 has the advantage of fast access speed.
- the memory 120 usually uses dynamic random access memory (DRAM).
- DRAM dynamic random access memory
- the memory 120 can also be other random access memories, such as static random access memory (Static random access memory, SRAM), storage class memory (storage class memory, SCM), etc.
- the memory 120 may also be a read only memory (ROM).
- read-only memory can be programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), etc.
- the memory 120 may also be a dual in-line memory module (dual in-line memory module, DIMM), flash memory medium (FLASH), hard disk drive (hard disk drive, HDD) or solid state drive (solid state disk). , SSD), etc.
- the processor 110 is connected to the memory 120 through a double data rate (DDR) bus or other types of buses.
- DDR double data rate
- the memory 120 is understood as the memory 120 (internal memory) of the host 10, and the memory 120 is also called main memory (main memory).
- the processor 110 can form software modules such as the host operating system 200, the computing instance management unit 300, and the computing instance 400 in the host 10 by calling computer program instructions in the memory 120. As the computing core and control core of the host 10 , the processor 110 can support the steps executed by the host operating system 200 and the computing instance 400 in the embodiment shown in FIG. 3 .
- the acceleration device 150 is connected to the host 10 , and can be used as an external device of the host 10 ; the acceleration device 150 can also be deployed inside the host 10 , for example, the acceleration device 150 is located on the motherboard or backplane of the host 10 .
- FIG. 2 is a schematic diagram of the acceleration device 150 deployed inside the host 10 .
- the acceleration device 150 can be used as a module with a data processing function attached to the host 10 and assume part of the functions of the host 10 . That is to say, part of the functions of the host 10 are offloaded to the acceleration device 150, and the acceleration device 150 replaces the host.
- the machine 10 (such as the processor 110 in the host 10) processes data and performs some tasks to reduce the pressure on the processor 110 in the host 10 and release the computing power of the processor 110.
- the acceleration device 150 can realize data access to the swap partition 160.
- the data access here includes swapping out pages from the memory 120 of the host 10 to the swap partition 160, and swapping in pages from the swap partition 160 to the swap partition 160.
- Host 10 has memory 120.
- the acceleration device 150 may receive a swap-out instruction sent by the host operating system 200.
- the swap-out instruction carries the virtual address of the page and the page (the page may be the target page in the embodiment shown in FIG. 3).
- the swap out instruction also includes the identification of the process (the process may be the computing instance 400).
- the acceleration device 150 sends the page to the storage device where the swap partition 160 is located, so as to save the page. It is stored in the swap partition 160 and saves the corresponding relationship between the virtual address of the page (optionally, also including the identity of the process) and the address of the page in the swap partition 160 .
- the acceleration device 150 may receive a swap-in instruction sent by the MMU, which instructs to swap a page (the page may be a target page in the embodiment shown in FIG. 4 ) into the memory 120 of the host 10.
- the acceleration device 150 swaps the page from the swap partition 160 into the memory 120 of the host 10 according to the swap-in instruction.
- the swap-in instruction received by the acceleration device 150 carries the virtual address of the page.
- the swap-out instruction also includes the identifier of the process (the process may be the computing instance 400).
- the acceleration device 150 determines the address of the page in the swap partition 160 based on the virtual address of the page, obtains the page from the swap partition 160 based on the address of the page in the swap partition 160, and writes the page into the memory 120.
- the acceleration device 150 also has data decompression and data compression functions. For example, the acceleration device 150 may first compress the pages that need to be swapped out to the swap partition 160 (that is, the data in the pages), and then swap the compressed pages into the swap partition 160 . For another example, the acceleration device 150 can decompress the compressed pages obtained from the swap partition 160 and swap the pages into the memory 120 of the host 10 .
- the swap partition 160 is located in the storage device 20 outside the memory 120 , and the storage device 20 may be a remote storage device 30 located outside the host 10 .
- the storage device 20 may also be the local storage device 170 of the host 10 .
- the storage device 20 may also be located in a cloud, such as a public cloud or a private cloud.
- the swap partition 160 is a storage space pre-allocated by the cloud for the host 10 .
- the so-called “remote storage device 30” refers to a storage device connected to the host 10 through a network and located outside the host 10.
- the remote storage device 30 can store data.
- the embodiment of the present application is not limited to the type of the remote storage device 30.
- the storage medium of the remote storage device 30 can be volatile memory (volatile memory), such as RAM, DRAM, SCM. , SRAM.
- the storage medium of the remote storage device 30 may also be non-volatile memory (non-volatile memory), such as ROM, flash memory, HDD, SSD, SCM, etc.
- the so-called “local storage device 170” refers to the storage device used for persistent storage in the host 10.
- the local storage device 170 is connected to the host 10 through the system bus.
- the local storage device 170 may be a non-volatile memory such as ROM, flash memory, HDD, SSD, etc.
- the so-called “storage device located in the cloud” means that the storage device 20 is deployed in the cloud data center.
- the storage device 20 can be understood as the storage space allocated by the cloud to the host.
- the storage device 20 can be a certain device in the cloud data center, that is, the device can provide storage space as the swap partition 160.
- the storage device 20 can also be multiple devices in the cloud data center, that is, the multiple devices jointly provide storage space as the swap partition 160.
- the access method of the acceleration device 150 to the swap partition 160 is not limited.
- the acceleration device 150 can access through the remote direct memory access (RDMA) 120 ) to access the remote storage device 30.
- RDMA remote direct memory access
- the swap partition 160 is located on the remote storage device 30 and the remote storage
- the storage medium of the device 30 is a non-volatile memory such as HDD or SSD, or the swap partition 160 is located in the local storage device 170.
- the acceleration device 150 can be based on Internet small computer system interface (iSCSI) or fiber channel (fibre). Network protocols such as Fiber Channel (FC) or Fiber Channel over Ethernet (FCoE) access the switching partition 160.
- iSCSI Internet small computer system interface
- FC Fiber Channel
- FCoE Fiber Channel over Ethernet
- the acceleration device 150 may provide a key-value (KV) interface to the processor 110 or the MMU in the host 10, and the KV interface allows the acceleration device 150 to interact with the processor 110, or the acceleration device 150 to interact with the MMU in a KV structure.
- KV key-value
- the key (key, K) in the key-value pair may be a virtual address of a page, or a combination of a virtual address of a page and an identifier of a process.
- the value (value, K) in the key-value pair may be the page itself.
- the swap command sent by the MMU to the acceleration device 150 can be in the form of a KV.
- the acceleration device 150 receives the virtual address including the page's virtual address (or a combination of the page's virtual address and the process identifier) through the KV interface.
- the acceleration device 150 may consider that the page needs to be swapped out to the swap partition 160 .
- the swap out instruction sent by the processor 110 of the host 10 (which can also be understood as the host operating system 200) to the acceleration device 150 can also be expressed in the form of a KV.
- the acceleration device 150 receives the virtual address (or page) including the page at the KV interface. When the combination of the virtual address plus the identifier of the process) is the key and the value is blank or invalid data, the acceleration device 150 can therefore consider that the page needs to be swapped from the swap partition 160 to the memory 120 of the host 10 .
- the acceleration device 150 includes a processor, which may be a data processing unit (DPU) 151, an image processor (graphics processing unit, GPU), a tensor processing unit (TPU), or a neural network processor. (neural network processing unit, NPU) and other processors with data processing functions.
- the processor included in the acceleration device 150 is the DPU 151 as an example.
- the acceleration device 150 also includes a memory 152, a power supply circuit, etc.
- the DPU 151 and the memory 152 are connected through a system bus.
- the system bus can be a PCIe-based line, or a CXL, USB protocol, or other protocol bus.
- DPU 151 is the main computing unit of the acceleration device 150 and the core unit of the acceleration device 150. DPU 151 undertakes the main functions of the acceleration device 150. In the embodiment of the present application, DPU 151 can access data of the swap partition 160 and can also perform data compression and decompression.
- a page swapping method and a page swapping method provided by the embodiment of the present application will be described below in conjunction with Figures 3 and 4. As shown in Figure 3, a page swapping method provided by the embodiment of the present application is shown in Figure 4. The illustrated embodiment of the present application provides a page switching method.
- the page swapping method shown in Figure 3 and the page swapping method shown in Figure 4 exist independently.
- the page swapping out method shown in Figure 3 and the page swapping in method shown in Figure 4 can be used in combination. That is to say, when it is necessary to swap out the pages in the memory 120 of the host 10 to the swap partition 160 (that is, to swap out the pages in the memory 120 of the host 10 to the storage device 20), the method shown in Figure 3 can be used.
- the page swapping method shown below If the pages in the swap partition 160 need to be swapped into the memory 120 of the host 10 later (that is, the pages in the storage device 20 need to be swapped into the memory 120 of the host 10), the page shown in Figure 4 can be used. Swap in method.
- the page swapping out method shown in Figure 3 and the page swapping in method shown in Figure 4 can also be used independently. That is to say, when the page swapping method shown in Figure 3 is used to swap out the page, other methods can also be used to swap in the page. For other methods of swapping in the page, please refer to the aforementioned description of the swap mechanism. Before using the page swapping method shown in Figure 4 to swap in the page, other methods can also be used to swap out the page. For other methods of swapping out the page, please refer to the aforementioned description of the swapping mechanism.
- a page swapping method provided in an embodiment of the present application includes:
- Step 301 The computing instance 400 classifies the pages occupied by the computing instance 400 in the memory 120 of the host 10, and generates page tags for the computing instance 400.
- the page label of the computing instance 400 indicates the memory 120 of the host 10 Calculate the importance of each page occupied by instance 400.
- the computing instance 400 can classify the pages occupied by the computing instance 400 according to the importance of the pages.
- the computing instance 400 can classify the pages occupied by the computing instance 400 from the perspective of the objects occupying the pages. For example, the computing instance 400 can classify the pages occupied by the operating system (such as guestOS) of the computing instance 400 into one category, and consider that the pages of this category have a higher importance; the computing instance 400 can classify the pages occupied by the applications on the computing instance 400 into one category, and consider that the pages of this category have a lower importance.
- the computing instance 400 can classify the pages occupied by the computing instance 400 from the calling frequency (also called the access frequency) of the pages.
- the computing instance 400 can classify the pages frequently called by the computing instance 400 (such as pages with a calling frequency greater than a first frequency threshold) into one category, and consider that the pages of this category have a higher importance; the computing instance 400 can classify the pages that are not frequently called by the computing instance 400 (such as pages with a calling frequency less than the first frequency threshold) into one category, and consider that the pages of this category have a lower importance.
- the embodiment of the present application does not limit the manner in which the computing instance 400 classifies the pages occupied by the computing instance 400 and the evaluation criteria for the importance of the pages.
- the computing instance 400 After the computing instance 400 classifies the pages occupied by the computing instance 400 in the memory 120 of the host 10, it can set an importance value for each type of page according to the importance of each type of page, and calculate the importance of the page label page of the instance 400. degree value.
- the page tag of the computing instance 400 also includes the virtual address of the page (or a combination of the virtual address of the page and the identification of the computing instance 400).
- the page label of the computing instance 400 includes the category to which the page belongs.
- the page tag of the computing instance 400 also includes the virtual address of the page (or a combination of the virtual address of the page and the identification of the computing instance 400).
- the categories of pages occupied by the virtual machine may include pages occupied by the operating system (such as guestOS) of the virtual machine, pages on the virtual machine, The page occupied by the application (application, APP) and the virtual machine management page.
- the category of pages occupied by the operating system (such as guestOS) of the computing instance 400 can be identified as kernel (kernel), and the pages occupied by applications on the virtual machine can be identified as APP.
- the page occupied by the virtual machine operating system is a page that stores data or computer program instructions related to the virtual machine operating system.
- the virtual machine management page refers to a page that stores virtual machine management data (such as virtual machine attribute information, virtual machine identification, etc.).
- the page occupied by an application on a virtual machine stores application-related data or computer program instructions. page.
- the categories of pages occupied by the container may include pages occupied by applications on the container and container management pages.
- the pages occupied by the container's operating system are pages that store data related to the container's operating system or computer program instructions.
- the container management page refers to a page that stores container management data (such as container attribute information, container identification, etc.), and the pages occupied by applications on the container are pages that store data related to the application or computer program instructions.
- the categories of pages occupied by the computing instance may include cold pages and hot pages.
- Cold pages are pages with a low degree of access (eg, the access frequency of the page is lower than a certain value)
- hot pages are pages with a high degree of access (eg, the access frequency of the page is greater than a certain value).
- Step 302 The computing instance 400 sends the page tag of the computing instance 400 to the host operating system 200.
- the page tag may be received by the instance page identification module 210 in the host operating system 200 .
- the computing instance 400 can directly pass the page label to the host operating system 200, or it can manage the page through the computing instance 400.
- the processing unit 300 passes the page tag to the host operating system 200.
- the virtual address of the page in the page tag received by the host operating system 200 should be a virtual address that the host operating system 200 can recognize.
- the page virtual address used may be the guest virtual address (GVA) configured by guestOS for the page.
- the PT corresponding to the computing instance 400 obtained by the MMU includes two page tables.
- One page table is the guest page table (GPT), which records the guest virtual address and the guest physical address (GPA).
- the other page table is the extended page table (EPT), which records the correspondence between the client physical address and the host physical address (HPA).
- the MMU can query the GPT and EPT based on this GPV. , determine the HPA.
- the virtual address of the page that the host operating system 200 can recognize is the host virtual address (host virtual address, HVA).
- the computing instance management unit 300 can convert GPA into HVA, and the virtual address of the page carried in the page tag initially generated by the computing instance 400 can be GPA (GPT is stored internally in the computing instance 400, and when generating the page tag internally, the computing instance 400 can Convert the GVA of the page to GPA by itself).
- the computing instance management unit 300 can convert the GPA in the page label to HVA, update the page label, and update the page label.
- the page tag is sent to the host operating system 200. In this way, the virtual address of the page in the page tag received by the host operating system 200 is the HVA that the host operating system 200 can recognize.
- the computing instance 400 can periodically or in real time evaluate and classify the pages occupied by the computing instance 400 to determine the importance of the pages occupied by the computing instance 400, and then generate the page tags.
- the computing instance 400 may periodically send the page tag to the host operating system 200 .
- the computing instance 400 may also send the changed page label or the page label generated after the importance change to the host operating system 200 when the page label changes (or the importance of the page occupied by the computing instance 400 changes).
- Step 303 The host operating system 200 obtains the page access frequency of each page occupied by the computing instance 400. This step may be performed by the instance page identification module 210.
- the MMU every time the MMU queries a PTE in the PT, it will set the flag bit in the PTE to 1. If the PTE is not accessed within a period of time, the flag bit will return to 0.
- the host operating system 200 may periodically scan the flag bits of each PTE in the PT corresponding to the computing instance 400 to determine the page access frequency of each page. For any PTE in the PT corresponding to the computing instance 400, the host operating system 200 checks the flag bit of the PTE when it reaches a monitoring time point. If the host operating system 200 finds that the flag bit of the PTE is 1, it records the page corresponding to the PTE. The number of accesses is incremented by one, and the host operating system 200 sets the flag bit to 0. If the host operating system 200 finds that the flag bit of the PTE is 0, it is considered that the page corresponding to the PTE has not been accessed, and the number of accesses to the page corresponding to the PTE remains unchanged. By resending the above operation within a period of time, the host operating system 200 can obtain the number of visits to the page corresponding to the PTE within the period of time, and thereby determine the page access frequency of the page.
- Step 304 When the host operating system 200 needs to swap out a page to the swap partition 160, it filters the target page from the pages occupied by the computing instance 400.
- the target page is a page that is allowed to be swapped out among the pages occupied by the computing instance 400. This step may be performed by the instance page identification module 210.
- the host operating system 200 needs to swap pages to the swap partition 160.
- the embodiment of the present application does not limit the specific scenario in which the host operating system 200 needs to swap pages to the swap partition 160. For example, when the host operating system 200 receives an exception signal sent by the MMU to indicate a page fault interrupt and determines that there is no free memory space in the memory 120 of the host 10 or that the free memory space is less than a preset free threshold, It may be determined that pages in the memory 120 of the host 10 need to be swapped out to the swap partition 160 . Another example.
- Host operating system 200 may also predict the possible presence of host 10 in the future In the case of insufficient memory space, for example, the host operating system 200 detects that a new computing instance 400 needs to be created, or for example, the guest OS in the computing instance 400 needs to be updated. Host operating system 200 may determine that pages in memory 120 of host 10 need to be swapped out to swap partition 160 .
- the host operating system 200 can also provide a parameter configuration interface for users, allowing users to configure page exchange parameters.
- the page exchange parameters indicate the filter conditions of the target page.
- the page swap parameters include but are not limited to: the identification of the computing instance 400 that is allowed to swap out the page, the page scanning frequency, the cold page determination threshold, and the maximum memory space that the computing instance 400 is allowed to occupy.
- the host operating system 200 may consider all computing instances 400 of the host 10 Both allow swapping out pages.
- the host operating system 200 can periodically scan the flag bits of each PTE in the PT corresponding to the computing instance 400.
- the frequency of scanning each PTE in the PT corresponding to the computing instance 400 is the page scanning frequency. Excessive page scanning frequency will cause the host operating system 200 to frequently scan the corresponding PT of the computing instance 400, which will increase the burden of the host operating system 200. If the scanning frequency is too small, the host operating system 200 will not be able to accurately monitor the number of times the PTE flag position is 1, making the access frequency of the ultimately obtained page less accurate.
- the host operating system 200 allows users to configure the page scanning frequency according to their own experience or needs.
- the host operating system 200 can scan the flag bits of each PTE in the PT corresponding to the computing instance 400 at the preset page scanning frequency. .
- Pages whose access frequency is less than a certain threshold are usually called cold pages, and this threshold is the cold page determination threshold.
- Cold pages are accessed less frequently and can usually be swapped out to the swap partition 160 as pages that need to be swapped out.
- the host operating system 200 can determine whether the page is a cold page based on a default threshold, or can provide the user with an interface to configure the threshold, and the user can configure the threshold.
- the host operating system 200 may be preset with a maximum memory space of 120 that the computing instance 400 is allowed to occupy, and the memory space of 120 allocated by the host operating system 200 to the computing instance 400 is not allowed to exceed the maximum memory space of 120 .
- the user can also configure the maximum memory space allowed to be occupied by the computing instance 400, and provide the user with an interface for configuring the maximum memory space allowed to be occupied by the computing instance 400. After the user configures the maximum memory space 120 that the computing instance 400 is allowed to occupy, Finally, the memory space 120 allocated by the host operating system 200 to the computing instance 400 is not allowed to exceed the maximum memory space 120 configured by the user.
- the host operating system 200 can display the configuration interface of the page exchange parameters to the user when the computing instance 400 is created or during the operation of the computing instance 400, so that the user can complete the configuration of the page exchange parameters in the configuration interface of the page exchange parameters.
- the host operating system 200 can obtain three types of information: page tag, page access frequency, and page exchange parameters of the computing instance 400 .
- the host operating system 200 can perform various operations on the computing instance 400 based on one or more of these three types of information. Sort the occupied pages and select the target page from them.
- the host operating system 200 can sort the pages occupied by the computing instance 400 based on one or more of the three types of information. There are many ways to select the target page, which are not limited by this application.
- the host operating system 200 can sort the pages occupied by the computing instance 400 according to the importance of the pages occupied by the computing instance 400 indicated by the page tags, with pages with higher importance being ranked higher.
- the host operating system 200 uses the N pages at the last sorted position as target pages, where N is a preset positive integer.
- the target pages include pages occupied by applications on the computing instance 400 and may also include cold pages of the computing instance 400 .
- the host operating system 200 can sort the pages occupied by the computing instance 400 in ascending order of access frequency according to the access frequency of each page occupied by the computing instance 400 indicated by the page access frequency.
- the host operating system 200 uses the M pages at the last sorted position as target pages, where M is a preset positive integer.
- the host operating system 200 can sort the pages occupied by the computing instance 400 according to the importance of the pages occupied by the computing instance 400 indicated by the page tags, with pages with higher importance ranked higher. For pages with the same importance level, the host operating system 200 can sort them in descending order according to the access frequency of each page with the importance level in the page access frequency. The host operating system 200 will sort the P at the end. Pages are used as target pages, and P is a preset positive integer.
- the host operating system 200 can sort the pages occupied by the computing instance 400 according to page tags and page access frequencies, and then sort the last Q cold pages according to the cold page judgment threshold in the page exchange parameters.
- Q is a preset positive integer.
- the host operating system 200 can sort the pages occupied by the computing instance 400 according to the page label and page access frequency, and then sort the pages occupied by the computing instance 400 at the bottom according to the maximum memory space allowed to be occupied by the computing instance 400 in the page exchange parameters.
- H pages are used as target pages, and H is a positive integer.
- the size of the memory space of the remaining pages except the H pages is equal to the maximum memory space allowed to be occupied by the computing instance 400, or the computing instance
- the size of the memory space of the remaining pages except the H pages among the pages occupied by 400 is less than the maximum memory space of 120 allowed to be occupied by the computing instance 400, and the difference between the two is within the preset range.
- not all pages in the memory 120 of the host 10 are occupied by the computing instance 400.
- the host operating system 200 can also select pages from the memory 120 of the host 10 other than the pages occupied by the computing instance 400 as pages that need to be swapped out.
- step 305 only the pages occupied by the computing instance 400 are used.
- the page is used as the target page for explanation.
- the host operating system 200 can also select the pages that need to be swapped out.
- the page is swapped out to the swap partition 160 in a similar manner to step 305.
- Step 305 The host operating system 200 (such as the swap module 220 in the host operating system 200) swaps out the target page from the memory 120 of the host 10 to the swap partition 160.
- the host operating system 200 updates the PT corresponding to the computing instance 400, and deletes the PTE that records the virtual address of the target page in the PT corresponding to the computing instance 400.
- the host operating system 200 may directly send the target page in the memory 120 of the host 10 to the swap partition 160.
- the host operating system 200 may send a first data request to the storage device 20 where the swap partition 160 is located.
- the first data request is used to request that the target page be stored in the storage device 20 .
- the first data request carries the target. page, and the address of the target page in the swap partition 160 set by the host operating system 200 (for convenience of explanation, the address of the target page in the swap partition 160 or the address of the target page in the storage device 20 is called the target page. exchange address,), the host operating system 200 can record the virtual address of the target page The corresponding relationship with the exchange address of the target page.
- the corresponding relationship recorded by the host operating system 200 may be the corresponding relationship between the combination of the virtual address of the target page plus the identification of the computing instance 400 and the exchange address of the target page.
- the corresponding relationship between the virtual address of the target page and the swap address of the target page that appears below all has this designated meaning, but for convenience of explanation, the relationship between the virtual address of the target page and the swap address of the target page is still used. Expression of corresponding relationships.
- the corresponding relationship can be the corresponding relationship between the virtual address of the target page and the exchange address of the target page (for example, in a scenario where the virtual addresses used by different processes or computing instances 400 on the host 10 are completely different) , the corresponding relationship can be a combination of the virtual address of the target page plus the identification of the computing instance 400, and the corresponding relationship between the exchange address of the target page (such as the virtual address used by different processes or computing instances 400 on the host 10 Possibly under the same scenario).
- the host operating system 200 may maintain a page exchange table for the swapped out pages.
- the page exchange table includes multiple entries. Each entry corresponds to a page that is swapped out to the swap partition 160. The entry records the virtual address of the page. The corresponding relationship with the swap address of the page (the swap address of the page is the address of the page in the swap partition 160).
- the host operating system 200 swaps out the target page to the swap partition 160, the host operating system 200 adds an entry corresponding to the target page in the page swap table for recording the virtual address of the target page and the swap address of the target page. correspondence between them.
- the storage device 20 After receiving the first data request, the storage device 20 allocates a storage location for the target page, saves the target page in the storage location, and records the correspondence between the exchange address of the target page and the storage location. .
- the target page may also be swapped out from the memory 120 of the host 10 to the swap partition 160 through the acceleration device 150 of the host 10 .
- the host operating system 200 sends a swap out instruction to the acceleration device 150 of the host 10.
- the swap out instruction instructs the acceleration device 150 to swap out the target page to the swap partition 160.
- the swap out instruction carries the virtual address of the target page and
- the target page optionally, also carries the identifier of the computing instance 400 in the swap out instruction.
- the acceleration device 150 After receiving the swap out instruction, the acceleration device 150 sends a second data request to the storage device 20 where the swap partition 160 is located.
- the second data request is used to request that the target page be stored in the storage device 20.
- the second data request is used to request that the target page be stored in the storage device 20.
- the data request carries the target page and the swap address of the target page configured by the acceleration device 150.
- the acceleration device 150 records the correspondence between the virtual address of the target page and the swap address of the target page.
- the acceleration device 150 can also maintain a page exchange table for the swapped out pages.
- the page exchange table includes multiple entries, each entry corresponds to a page that is swapped out to the swap partition 160, and the entry records the page. The corresponding relationship between the virtual address and the swap address of the page.
- the acceleration device 150 swaps out the target page to the swap partition 160, the acceleration device 150 adds an entry corresponding to the target page in the page swap table for recording the virtual address of the target page and the swap address of the target page. correspondence between.
- the storage device 20 After receiving the second data request, the storage device 20 allocates a storage location for the target page, saves the target page in the storage location, and records the correspondence between the exchange address of the target page and the storage location. .
- the acceleration device 150 may directly swap out the target page to the swap partition 160.
- the acceleration device 150 may also first compress the target page and swap out the compressed target page to the swap partition 160.
- a page switching method is provided in an embodiment of the present application.
- a scenario in which the computing instance 400 calls a target page is used as an example for explanation. It should be noted that in the scenario where other process calls of the host 10 are swapped out to the swap partition 160, the embodiment shown in FIG. 4 is also applicable.
- the computing instance 400 is understood to be other pages of the host 10.
- the target page is understood to be the page that is swapped out to the swap partition 160 by other processes.
- the method includes:
- Step 401 The computing instance 400 initiates an access request, and the access request carries the virtual address of the target page. This access request is used to request the data in the target page.
- Step 402 The MMU obtains the access request and queries the relevant PTE in the PT corresponding to the computing instance 400.
- the MMU can query the PT corresponding to the computing instance 400. Since the target page has been swapped out to the swap partition 160 before, the PT does not have the PTE corresponding to the target page (that is, the target page is recorded). PTE of the virtual address), the MMU will find that the page table entry is missing in the PT.
- the MMU will trigger the following two processes.
- One process is the page remapping process of the host operating system 200 (see steps 403 to 405). In this process, the host operating system 200 needs to reconfigure the memory space for the data in the target page, that is, the data in the target page. The data searches for a blank page (ie, a free page) in the memory 120 of the host 10 .
- Another process is the page swapping process of the acceleration device 150 (see steps 406 to 409). In this process, the acceleration device 150 obtains the target page from the swap partition 160 and writes the target page into the memory 120 of the host 10 middle. The two processes can proceed simultaneously.
- Process 1 Page remapping process of the host operating system 200 (see steps 403 to 405).
- Step 403 The MMU sends an exception signal indicating a page fault interrupt to the host operating system 200.
- Step 404 The host operating system 200 allocates memory space for the target page and updates the PT corresponding to the computing instance 400.
- the host operating system 200 allocates memory space for the target page in the memory 120 of the host 10, and the physical address of the memory space is the new physical address of the target page.
- the host operating system 200 adds a PTE to the PT corresponding to the computing instance 400, and the PTE records the correspondence between the virtual address of the target page and the new physical address of the target page.
- Step 405 The host operating system 200 notifies the acceleration device 150 that the page allocation is complete, that is, the host operating system 200 notifies the acceleration device 150 that the storage space has been reallocated for the target page in the memory 120 of the host 10, and notifies the acceleration device 150 of the new physical address of the target page.
- the host operating system 200 sends a notification message through the system bus connected to the DPU 151.
- the notification message indicates that the storage space for the target page has been reallocated in the memory 120 of the host 10.
- the notification message also carries the new information of the target page. physical address.
- a shared memory can be set up between the host operating system 200 and the acceleration device 150 .
- the shared memory can be located in the memory 120 of the host 10 or in the memory 152 of the acceleration device 150 .
- the shared memory 120 refers to a storage space that can be used by both the host operating system 200 and the acceleration device 150 .
- An allocation completion queue (completion queue) jointly maintained by the host operating system 200 and the acceleration device 150 is stored in the shared memory.
- the host operating system 200 reallocates the memory space for the target page in the memory 120 of the host 10.
- a completion instruction can be added to the completion queue.
- the completion instruction is used to indicate The page allocation is completed, and the completion indication also carries the new physical address of the target page.
- Process 2 Page switching process of the acceleration device 150 (see steps 406 to 409).
- Step 406 The MMU sends a swap instruction to the acceleration device 150.
- the swap instruction carries the virtual address of the target page.
- the swap command also carries the identifier of the computing instance 400 .
- Step 407 The acceleration device 150 determines the swap address of the target page according to the virtual address of the target page.
- the acceleration device 150 may obtain the corresponding relationship between the virtual address of the target page and the swap address of the target page, and determine the swap address corresponding to the virtual address of the target page.
- the corresponding relationship between the virtual address of the target page and the swap address of the target page may be the host operating system 200 recorded, as recorded by the host operating system 200 in step 305 of the embodiment shown in FIG. 3 .
- the acceleration device 150 may obtain the corresponding relationship between the virtual address of the page and the swap address of the page from the host operating system 200 .
- the acceleration device 150 may obtain the page exchange table maintained by the host operating system 200 from the host operating system 200 .
- the corresponding relationship between the virtual address of the target page and the exchange address of the target page may also be recorded by the acceleration device 150, as recorded by the acceleration device 150 in step 305 of the embodiment shown in FIG. 3 .
- the acceleration device 150 queries the page exchange table for the corresponding relationship between the virtual address of the target page and the exchange address of the target page.
- Step 408 The acceleration device 150 obtains the target page from the swap partition 160 according to the swap address of the target page.
- the acceleration device 150 sends a third data request to the storage device 20 where the swap partition 160 is located.
- the third data request is used to request to obtain the target page from the storage device 20 .
- the third data request carries the swap address of the target page.
- the storage device 20 After receiving the third data request, the storage device 20 determines the storage location where the target page is stored based on the exchange address of the target page, reads the target page from the storage location, and feeds the target page back to the acceleration device 150 .
- Step 409 After receiving the notification from the host operating system 200, the acceleration device 150 writes the target page into the memory 120 of the host 10 and notifies the MMU that the page swap is completed.
- the acceleration device 150 can receive the notification message from the host operating system 200 and determine that the host operating system 200 has reallocated the memory space for the target page. The acceleration device 150 can pass the new physical address of the target page carried in the notification message. Direct memory access (DMA) writes the target page to the new physical address. After writing the target page to the new physical address, the acceleration device 150 notifies the MMU that the page swap is completed.
- DMA Direct memory access
- the acceleration device 150 can also check whether there is a completion instruction from the allocation completion queue of the shared memory. If there is a completion instruction in the allocation completion queue, the acceleration device 150 takes out the completion instruction and obtains the new physical address of the target page. The acceleration device 150 can write the target page to the new physical address through DMA according to the new physical address of the target page. After writing the target page to the new physical address, the acceleration device 150 notifies the MMU Page switching is completed. If there is no completion indication in the allocation completion queue, the acceleration device 150 may suspend writing the target page into the memory 120 of the host 10 until a completion indication is detected in the allocation completion queue.
- the target page obtained by the acceleration device 150 from the swap partition 160 may be the target page itself, that is, the target page is not compressed. In this case, the acceleration device 150 can directly swap the target page into the memory 120 of the host 10 .
- the target page obtained by the acceleration device 150 from the swap partition 160 is a compressed target page
- the compression of the target page may be performed by the acceleration device 150 before the target page is swapped to the swap partition 160, or the target page may be compressed before being swapped to the swap partition 160.
- the acceleration device 150 can first decompress the compressed target page, obtain the target page, and swap the target page into the memory 120 of the host 10 .
- the target page is swapped from the swap partition 160 into the memory 120 of the host 10 .
- the MMU After receiving the notification from the acceleration device 150, the MMU obtains the updated PT corresponding to the computing instance 400, searches for the PTE that records the virtual address of the target page, obtains the target page from the memory 120 of the host 10, and converts the target page Feedback to calculation instance 400.
- the MMU searches for the PTE that records the virtual address of the target page from the updated PT, determines the new physical address of the target page, reads the target page from the new physical address, and feeds the target page back to the computing instance 400 .
- the swap-out of the target page and the swap-out of the target page are aimed at the data in the target page.
- the target page For convenience of expression, in the embodiment of the present application, they are all referred to as the target page.
- the embodiment of the present application also provides a page switching device.
- the input device is used to execute the method executed by the DPU 151 or the acceleration device 150 in the above method embodiment shown in FIG. 3 or FIG. 4. Relevant features can be found in the above method embodiment and will not be described again here.
- the page switching device 500 includes a receiving module 501 and a switching module 502 .
- a swap out module 503 may also be included.
- the receiving module 501 is configured to receive a swap-in instruction, which is used to instruct the target page to be swapped into the memory of the host.
- the swap-in module 502 is used to obtain a target page from a storage device, swap the target page into the memory, and notify the host that the target page has been swapped into the memory.
- the receiving module 501 can receive a swap instruction sent by the MMU or processor in the host.
- the swap module 502 knows that the host's MMU or processor target page has been swapped into the memory.
- the swap module 502 when the swap module 502 obtains the target page from the storage device, it obtains the corresponding relationship between the virtual address of the target page and the exchange address of the target page.
- the exchange address of the target page is the address of the target page in the storage device. address.
- the swap-in module 502 determines the swap address of the target page according to the corresponding relationship, and obtains the target page from the storage device according to the swap address of the target page.
- the corresponding relationship may be recorded when the page swapping device swaps out the target page from the memory to the storage device.
- the corresponding relationship may also be obtained by the swap-in module 502 from the processor of the host.
- the swap module 502 when swapping the target page into the memory, can receive a notification sent by the processor of the host, and the notification is used to instruct the processor to configure the physical address of the target page in the memory. After obtaining the physical address, the swap-in module 502 writes the target page to the physical address through DMA.
- the receiving module 501 receives a swap instruction sent by a processor of the host, the swap instruction is used to instruct to swap out a target page in the host memory to a storage device, and the swap instruction includes a virtual address of the target page and the target page.
- the swap module 503 swaps out the target page to the storage device and records the corresponding relationship.
- the swap-in module 502 when the swap-in module 502 obtains the target page from the storage device, if it obtains the compressed target page from the storage device; the swap-in module 502 can decompress the compressed target page to obtain the target page. , and then swap the target page into memory.
- the swap out module 503 may compress the target page and then swap out the target page to the storage device.
- each functional module in the embodiment of the present application can be integrated into one processing module, or each module can exist physically alone, or two or more modules can be integrated into one module.
- the above integrated modules can be implemented in the form of hardware or software function modules.
- the above embodiments may be implemented in whole or in part by software, hardware, firmware, or any other combination.
- the above-described embodiments may be implemented in whole or in part in the form of a computer program product.
- the computer program product includes one or more computer instructions.
- the processes or functions described in accordance with the embodiments of the present invention are generated in whole or in part.
- the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
- the computer instructions may be stored in or transmitted from one computer-readable storage medium to another, e.g., the computer instructions may be transferred from a website, computer, server, or data center Transmission to another website, computer, server or data center by wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) means.
- the computer-readable storage medium may be any available medium that a computer can access, or a data storage device such as a server or a data center that contains one or more sets of available media.
- the available media may be magnetic media (eg, floppy disk, hard disk, tape), optical media (eg, DVD), or semiconductor media.
- Semiconductor medium It can be a solid state drive (SSD).
- embodiments of the present application may be provided as methods, systems, or computer program products. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment that combines software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
- computer-usable storage media including, but not limited to, disk storage, CD-ROM, optical storage, etc.
- These computer program instructions may also be stored in a computer-readable memory that causes a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction means, the instructions
- the device implements the functions specified in a process or processes of the flowchart and/or a block or blocks of the block diagram.
- These computer program instructions may also be loaded onto a computer or other programmable data processing device, causing a series of operating steps to be performed on the computer or other programmable device to produce computer-implemented processing, thereby executing on the computer or other programmable device.
- Instructions provide steps for implementing the functions specified in a process or processes of a flowchart diagram and/or a block or blocks of a block diagram.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Memory System Of A Hierarchy Structure (AREA)
Abstract
Description
Claims (22)
- 一种页面换入出方法,其特征在于,所述方法包括:加速装置接收主机发送的换入指令,所述换入指令用于指示将目标页面换入至所述主机的内存,所述加速装置通过系统总线与所述主机连接;所述加速装置从存储设备获取所述目标页面;所述加速装置将所述目标页面换入至所述内存,通知所述主机所述目标页面已换入到所述内存中。
- 如权利要求1所述的方法,其特征在于,所述主机中的加速装置接收换入指令,包括:所述加速装置接收所述主机中的内存管理单元MMU发送的换入指令。
- 如权利要求1或2所述的方法,其特征在于,所述加速装置从存储设备获取所述目标页面,包括:所述加速装置获取所述目标页面的虚拟地址与所述目标页面的交换地址的对应关系,所述目标页面的交换地址为所述目标页面在所述存储设备的地址;所述加速装置根据所述对应关系确定所述目标页面的交换地址;所述加速装置根据所述目标页面的交换地址从所述存储设备获取所述目标页面。
- 如权利要求3所述的方法,其特征在于,所述对应关系是所述加速装置将所述目标页面从所述内存换出至所述存储设备时、记录的。
- 如权利要求1-4任一项所述的方法,其特征在于,所述主机还包括处理器,所述加速装置通过系统总线与所述处理器连接,所述加速装置将所述目标页面换入至所述内存,包括:所述加速装置接收所述处理器发送的通知,所述通知用于指示所述处理器在所述内存中为所述目标页面配置的物理地址;所述加速装置通过直接内存访问DMA将所述目标页面写入到所述物理地址。
- 如权利要求5所述的方法,其特征在于,所述加速装置接收换入指令之前,还包括:所述加速装置接收所述主机的处理器发送的换出指令,所述换出指令用于指示将所述主机内存中的所述目标页面换出至所述存储设备,所述换出指令包括所述目标页面的虚拟地址以及所述目标页面;所述加速装置将所述目标页面换出至所述存储设备,记录所述对应关系。
- 如权利要求1-6任一项所述的方法,其特征在于,所述加速装置从存储设备获取所述目标页面,包括:所述加速装置从所述存储设备获取压缩后的所述目标页面;所述加速装置对压缩后的所述目标页面解压,获得所述目标页面。
- 如权利要求6所述的方法,其特征在于,所述加速装置将所述目标页面换出至所述存储设备,包括:所述加速装置将所述目标页面压缩后,换出至所述存储设备。
- 如权利要求3所述的方法,其特征在于,所述对应关系是所述加速装置从所述主机的处理器获取的,所述加速装置通过系统总线与所述处理器连接。
- 如权利要求1-9任一项所述的方法,其特征在于,所述存储设备为部署在所述主机之外,与所述主机通过网络连接的存储设备,或为所述主机的本地存储设备,或为公有云或私有云中为所述主机分配的存储空间。
- 一种页面换入装置,其特征在于,所述装置位于主机中,所述装置包括:接收模块,用于接收换入指令,所述换入指令用于指示将目标页面换入至所述主机的内存;换入模块,用于从存储设备获取所述目标页面;将所述目标页面换入至所述内存,通知所述主机所述目标页面已换入到所述内存中。
- 如权利要求11所述的装置,其特征在于,所述接收模块,用于:接收所述主机中的内存管理模块MMU发送的换入指令。
- 如权利要求11或12所述的装置,其特征在于,所述换入模块在从所述存储设备获取所述目标页面,用于:获取所述目标页面的虚拟地址与所述目标页面的交换地址的对应关系,所述目标页面的交换地址为所述目标页面在所述存储设备的地址;根据所述对应关系确定所述目标页面的交换地址;根据所述目标页面的交换地址从所述存储设备获取所述目标页面。
- 如权利要求13所述的装置,其特征在于,所述对应关系是所述换入模块将所述目标页面从所述内存换出至所述存储设备时、记录的。
- 如权利要求11-14任一项所述的装置,其特征在于,所述换入模块在将所述目标页面换入至所述内存,用于:接收所述主机的处理器发送的通知,所述通知用于指示所述处理器在所述内存中为所述目标页面配置的物理地址;通过直接内存访问DMA将所述目标页面写入到所述物理地址。
- 如权利要求15所述的装置,其特征在于,所述装置还包括换出模块,所述接收模块,还用于:接收所述主机的处理器发送的换出指令,所述换出指令用于指示将所述主机内存中的所述目标页面换出至所述存储设备,所述换出指令包括所述目标页面的虚拟地址以及所述目标页面;所述换出模块,用于将所述目标页面换出至所述存储设备,记录所述对应关系。
- 如权利要求11-16任一项所述的装置,其特征在于,所述换入模块在从所述存储设备获取所述目标页面,用于:从所述存储设备获取压缩后的所述目标页面;对压缩后的所述目标页面解压,获得所述目标页面。
- 如权利要求16所述的装置,其特征在于,所述换出模块在将所述目标页面换出至所述存储设备,用于:将所述目标页面压缩后,换出至所述存储设备。
- 如权利要求13所述的装置,其特征在于,所述对应关系是所述换入模块从所述主机的处理器获取的。
- 如权利要求11-19任一项所述的装置,其特征在于,所述存储设备为部署在所述主机之外,与所述主机通过网络连接的存储设备,或为所述主机的本地存储设备,或为公有云或私有云中为所述主机分配的存储空间。
- 一种加速装置,其特征在于,所述加速装置包括数据处理单元DPU和供电电路,所述供电电路用于对所述DPU供电,所述DPU用于执行如权利要求1-10任一项所述的方法。
- 一种计算机存储介质,其特征在于,所述计算机可读存储介质存储有计算机可执行指令,所述计算机可执行指令用于使计算机执行权利要求1-10任一项所述的方法。
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| EP23867006.1A EP4582943A4 (en) | 2022-09-20 | 2023-06-15 | METHOD AND APPARATUS FOR PAGE SWITCHING |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211142315.0A CN117785371A (zh) | 2022-09-20 | 2022-09-20 | 一种页面换入方法以及装置 |
| CN202211142315.0 | 2022-09-20 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2024060710A1 true WO2024060710A1 (zh) | 2024-03-28 |
Family
ID=90378568
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2023/100492 Ceased WO2024060710A1 (zh) | 2022-09-20 | 2023-06-15 | 一种页面换入方法以及装置 |
Country Status (3)
| Country | Link |
|---|---|
| EP (1) | EP4582943A4 (zh) |
| CN (1) | CN117785371A (zh) |
| WO (1) | WO2024060710A1 (zh) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20240152358A1 (en) * | 2022-11-09 | 2024-05-09 | Lemon Inc. | Offloading data processing and knowledge synthesis |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN120670338B (zh) * | 2024-08-30 | 2026-04-14 | 华为技术有限公司 | 一种内存管理方法与电子设备 |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109670345A (zh) * | 2018-12-21 | 2019-04-23 | 成都海光集成电路设计有限公司 | 内存页面换入换出的保护方法、加速器模块和soc芯片 |
| CN111967065A (zh) * | 2020-08-17 | 2020-11-20 | 海光信息技术有限公司 | 一种数据保护方法、处理器及电子设备 |
| CN113590509A (zh) * | 2020-04-30 | 2021-11-02 | 华为技术有限公司 | 一种页交换的方法、存储系统和电子设备 |
| WO2022121866A1 (zh) * | 2020-12-09 | 2022-06-16 | 第四范式(北京)技术有限公司 | 一种基于加速卡的服务运行方法、装置、电子设备及计算机可读存储介质 |
-
2022
- 2022-09-20 CN CN202211142315.0A patent/CN117785371A/zh active Pending
-
2023
- 2023-06-15 EP EP23867006.1A patent/EP4582943A4/en active Pending
- 2023-06-15 WO PCT/CN2023/100492 patent/WO2024060710A1/zh not_active Ceased
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109670345A (zh) * | 2018-12-21 | 2019-04-23 | 成都海光集成电路设计有限公司 | 内存页面换入换出的保护方法、加速器模块和soc芯片 |
| CN113590509A (zh) * | 2020-04-30 | 2021-11-02 | 华为技术有限公司 | 一种页交换的方法、存储系统和电子设备 |
| CN111967065A (zh) * | 2020-08-17 | 2020-11-20 | 海光信息技术有限公司 | 一种数据保护方法、处理器及电子设备 |
| WO2022121866A1 (zh) * | 2020-12-09 | 2022-06-16 | 第四范式(北京)技术有限公司 | 一种基于加速卡的服务运行方法、装置、电子设备及计算机可读存储介质 |
Non-Patent Citations (1)
| Title |
|---|
| See also references of EP4582943A4 * |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20240152358A1 (en) * | 2022-11-09 | 2024-05-09 | Lemon Inc. | Offloading data processing and knowledge synthesis |
| US12164920B2 (en) * | 2022-11-09 | 2024-12-10 | Lemon Inc. | Offloading data processing and knowledge synthesis |
Also Published As
| Publication number | Publication date |
|---|---|
| EP4582943A1 (en) | 2025-07-09 |
| CN117785371A (zh) | 2024-03-29 |
| EP4582943A4 (en) | 2025-11-05 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11397690B2 (en) | Virtualized cache implementation method and physical machine | |
| CN107209681B (zh) | 一种存储设备访问方法、装置和系统 | |
| US9612966B2 (en) | Systems, methods and apparatus for a virtual machine cache | |
| US9959074B1 (en) | Asynchronous in-memory data backup system | |
| WO2024060711A1 (zh) | 一种页面换出方法、装置、设备及数据处理系统 | |
| CN114207596B (zh) | 将中断从输入-输出存储器管理单元提供到访客操作系统 | |
| EP4439312A1 (en) | Data storage method and system, storage access configuration method and related device | |
| US20250094203A1 (en) | Method and apparatus for creating container, and storage medium | |
| US20210216232A1 (en) | Memory data migration method and apparatus | |
| US11243877B2 (en) | Method, apparatus for data management, and non-transitory computer-readable storage medium for storing program | |
| WO2015180598A1 (zh) | 对存储设备的访问信息处理方法和装置、系统 | |
| US12260120B2 (en) | Guest operating system buffer and log accesses by an input-output memory management unit | |
| US20250217037A1 (en) | Data Migration Method and Apparatus, Chip, and Computer-Readable Storage Medium | |
| EP4582943A1 (en) | Page swap-in method and apparatus | |
| US10402333B2 (en) | Computer system including plurality of types of memory devices and method | |
| CN120104043A (zh) | 一种数据处理方法、装置和计算设备 | |
| CN110018879A (zh) | 应用于分布式系统的延迟加载方法及装置 | |
| US20250377931A1 (en) | Container live migration method, processor, host, chip, and interface card | |
| WO2024193272A1 (zh) | 一种数据共享方法、装置及设备 | |
| CN110209354B (zh) | 用于处理数据的方法、装置、设备和介质 | |
| CN115794296A (zh) | 基于硬件卸载的链接克隆方法、系统、设备及存储介质 | |
| CN107832097A (zh) | 数据加载方法及装置 | |
| CN118860622A (zh) | 数据处理系统和内存动态分配方法 | |
| WO2024082702A1 (zh) | 数据处理方法、装置、芯片以及计算机可读存储介质 | |
| WO2017113329A1 (zh) | 一种主机集群中缓存管理方法及主机 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 23867006 Country of ref document: EP Kind code of ref document: A1 |
|
| WWE | Wipo information: entry into national phase |
Ref document number: 2023867006 Country of ref document: EP |
|
| ENP | Entry into the national phase |
Ref document number: 2023867006 Country of ref document: EP Effective date: 20250402 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| WWP | Wipo information: published in national office |
Ref document number: 2023867006 Country of ref document: EP |