Page marking method, device and equipment
By updating the page identifier as dirty identifier in the first storage space of the virtual machine, the problem of low migration efficiency in virtual machine hot migration is solved, and efficient data migration and reduced downtime is achieved.
Patent Information
- Application Number
- CN202410071868.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-17
- Publication Date
- 2025-07-18
AI Technical Summary
During the hot migration of virtual machines, due to the large number of record tables of virtual machines, the migration efficiency of data in the target memory page is inefficient. All entries of each record table need to be traversed to determine the page identity.
In the first storage space of the virtual machine, the page identity of the target memory page is updated to a dirty identity, and the storage space is avoided by traversing the record table entries of the virtual machine by receiving a memory operation request and determining the storage space based on the device identifier and the virtual address.
It improves the data migration efficiency in the target memory page, reduces the downtime during the virtual machine hot migration process, and improves the migration efficiency.
Smart Images

Figure CN120336204A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computers, and in particular, to a page marking method, apparatus, and device. Background Art
[0002] Virtual machines can run on a source host. The memory of the source host may include multiple memory pages corresponding to the virtual machines. Data corresponding to the virtual machines may be stored in the multiple memory pages. When a virtual machine is hot migrated from the source host to a target host, it is necessary to determine multiple memory pages corresponding to the virtual machine in the source host and migrate the data in the multiple memory pages to the target host.
[0003] In the related art, during the hot migration of a virtual machine, the virtual machine is still running and may update the data in the memory pages to generate target memory pages with updated data. The virtual machine has a corresponding record table, which includes the base addresses of multiple memory pages corresponding to the virtual machine and page identifiers. The page identifier corresponding to the target memory page can be updated to a dirty identifier in the record table corresponding to the virtual machine to indicate that the target memory page has been updated and the data in the target memory page needs to be migrated. However, based on the above method, when iteratively migrating the data in multiple memory pages, since the number of record tables corresponding to the virtual machine is large and all entries in each record table need to be traversed to determine the page identifier of each memory page to determine multiple target memory pages, the migration efficiency of the data in the target memory pages is low. Summary of the Invention
[0004] Multiple aspects of this application provide a page marking method, apparatus, and device to improve the migration efficiency of the data in the target memory pages.
[0005] In a first aspect, an embodiment of this application provides a page marking method, including:
[0006] During the hot migration of a virtual machine, receiving a memory operation request corresponding to the virtual machine, where the memory operation request is used to request an operation on a target memory page;
[0007] Operating on the data in the target memory page according to the memory operation request;
[0008] Updating the page identifier of the target memory page to a dirty identifier in a first storage space corresponding to the virtual machine, where the dirty identifier is used to indicate that the data in the target memory page has been updated.
[0009] In a possible implementation manner, updating the page identifier corresponding to the target memory page to a dirty identifier in the first storage space corresponding to the virtual machine includes:
[0010] Determining a first storage address according to the memory operation request;
[0011] Determine the first storage space according to the first storage address;
[0012] In the first storage space, update the page identifier of the target memory page to the dirty identifier.
[0013] In a possible implementation manner, the memory operation request includes a device identifier; determining a first storage address according to the memory operation request includes:
[0014] Determine the context entry corresponding to the virtual machine according to the device identifier;
[0015] Obtain the first storage address in the context entry, and the first storage address is pre-stored in the context entry.
[0016] In a possible implementation manner, a page identifier bitmap corresponding to the virtual machine is stored in the first storage space; updating the page identifier of the target memory page to the dirty identifier in the first storage space includes:
[0017] In the page identifier bitmap of the first storage space, determine the current page identifier corresponding to the target memory page;
[0018] If the current page identifier is different from the dirty identifier, update the current page identifier to the dirty identifier.
[0019] In a possible implementation manner, the virtual address of the target memory page is included in the memory operation request, and the virtual address includes a first part of the virtual address and a second part of the virtual address; operating on the data in the target memory page according to the memory operation request includes:
[0020] Query the record information corresponding to the target memory page in the record table according to the first part of the virtual address, and the record information includes the base address of the target memory page;
[0021] Determine the physical address corresponding to the target memory page according to the base address and the second part of the virtual address;
[0022] Operate on the data in the target memory page according to the physical address.
[0023] In a possible implementation manner, the page identifier of the target memory page is further included in the record information; the method further includes:
[0024] In the record information, determine whether the page identifier of the target memory page is the dirty identifier;
[0025] Otherwise, update the page identifier of the target memory page to the dirty identifier.
[0026] In a possible implementation, the method further includes:
[0027] Determine at least one dirty memory page from among the multiple memory pages corresponding to the virtual machine according to the page identifiers of the memory pages corresponding to the virtual machine in the first storage space;
[0028] Synchronize the data in the at least one dirty memory page from the source host where the virtual machine currently resides to the target host, where the target host is the host to which the virtual machine is to be migrated.
[0029] In a possible implementation, a page identifier bitmap corresponding to the virtual machine is stored in the first storage space; determining at least one dirty memory page from among the multiple memory pages corresponding to the virtual machine according to the page identifiers of the memory pages corresponding to the virtual machine in the first storage space includes:
[0030] Determine at least one target page identifier in the page identifier bitmap, where the value of the target page identifier is the value corresponding to the dirty identifier;
[0031] Determine the memory pages corresponding to the at least one target page identifier as the at least one dirty memory page.
[0032] In a possible implementation, the method further includes:
[0033] Apply for a second storage space in the source host;
[0034] Determine a second storage address of the second storage space;
[0035] In the context entry corresponding to the virtual machine, update the first storage address to the second storage address.
[0036] In a second aspect, an embodiment of the present application provides a page marking device, including: a receiving module, an operating module, and a first updating module, where
[0037] The receiving module is configured to receive a memory operation request corresponding to the virtual machine during the hot migration of the virtual machine, where the memory operation request is used to request an operation on a target memory page;
[0038] The operating module is configured to operate on the data in the target memory page according to the memory operation request;
[0039] The first update module is configured to update the page identifier of the target memory page to a dirty identifier in the first storage space corresponding to the virtual machine, where the dirty identifier is used to indicate that the data in the target memory page has been updated during the hot migration of the virtual machine.
[0040] In a possible implementation manner, the first update module is specifically configured to:
[0041] Determine the first storage address according to the memory operation request;
[0042] Determine the first storage space according to the first storage address;
[0043] Update the page identifier of the target memory page to the dirty identifier in the first storage space.
[0044] In a possible implementation manner, the memory operation request includes a device identifier; the first update module is specifically configured to:
[0045] Determine the context entry corresponding to the virtual machine according to the device identifier;
[0046] Obtain the first storage address in the context entry, where the first storage address is pre-stored in the context entry.
[0047] In a possible implementation manner, a page identifier bitmap corresponding to the virtual machine is stored in the first storage space; the first update module is specifically configured to:
[0048] Determine the current page identifier corresponding to the target memory page in the page identifier bitmap of the first storage space;
[0049] If the current page identifier is different from the dirty identifier, update the current page identifier to the dirty identifier.
[0050] In a possible implementation manner, the memory operation request includes the virtual address of the target memory page, and the virtual address includes a first part of the virtual address and a second part of the virtual address; the operation module is specifically configured to:
[0051] Query the record information corresponding to the target memory page in the record table according to the first part of the virtual address, where the record information includes the base address of the target memory page;
[0052] Determine the physical address corresponding to the target memory page according to the base address and the second part of the virtual address;
[0053] Operate on the data in the target memory page according to the physical address.
[0054] In a possible implementation, the recorded information further includes a page identifier of the target memory page; the first update module is further configured to,
[0055] In the recorded information, determine whether the page identifier of the target memory page is the dirty identifier;
[0056] If not, update the page identifier of the target memory page to the dirty identifier.
[0057] In a possible implementation, the apparatus further includes: a first determination module and a synchronization module, where,
[0058] The first determination module is configured to determine at least one dirty memory page among multiple memory pages corresponding to the virtual machine according to the page identifiers of the memory pages corresponding to the virtual machine in the first storage space;
[0059] The synchronization module is configured to synchronize the data in the at least one dirty memory page from the source host where the virtual machine currently resides to the target host, and the target host is the host to which the virtual machine is to be migrated.
[0060] In a possible implementation, a page identifier bitmap corresponding to the virtual machine is stored in the first storage space; the first determination module is specifically configured to:
[0061] Determine at least one target page identifier in the page identifier bitmap, where the value of the target page identifier is the value corresponding to the dirty identifier;
[0062] Determine the memory pages corresponding to the at least one target page identifier as the at least one dirty memory page.
[0063] In a possible implementation, the apparatus further includes an application module, a second determination module, and a second update module:
[0064] The application module is configured to apply for a second storage space in the source host;
[0065] The second determination module is configured to determine a second storage address of the second storage space;
[0066] The second update module is configured to update the first storage address to the second storage address in the context entry corresponding to the virtual machine.
[0067] In a third aspect, an embodiment of the present application provides an electronic device, including: a memory and a processor;
[0068] The memory stores computer execution instructions;
[0069] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the method according to any one of the first aspect.
[0070] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, they are used to implement the method according to any one of the first aspect.
[0071] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, it implements the method according to any one of the first aspect.
[0072] An embodiment of the present application provides a page marking method, device and equipment. During the hot migration of a virtual machine, a source host can receive a memory operation request corresponding to the virtual machine, and operate on the data in the target memory page according to the memory operation request. Furthermore, in a first storage space corresponding to the virtual machine, the page identifier of the target memory page can be updated to a dirty identifier. Since the page identifier of the target memory page can be updated to a dirty identifier in the first storage space corresponding to the virtual machine; during the iterative migration when migrating the virtual machine from the source host to the target host, the page identifiers of each memory page can be obtained in the first storage space to determine multiple target memory pages to be migrated, without having to traverse all entries in the record table corresponding to the virtual machine, thereby improving the migration efficiency of the data in the target memory page. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] The drawings described herein are used to provide a further understanding of the present application, and constitute a part of the present application. The exemplary embodiments of the present application and their descriptions are used to explain the present application, and do not constitute an improper limitation to the present application. In the drawings:
[0074] Figure 1 It is a schematic diagram of a scenario provided for an exemplary embodiment of the present application;
[0075] Figure 2 It is a page marking method in the related art provided by the present application;
[0076] Figure 3 It is a flowchart of a page marking method provided for an exemplary embodiment of the present application;
[0077] Figure 4 It is a schematic diagram of the memory in a source host provided for an exemplary embodiment of the present application;
[0078] Figure 5 It is a flowchart of another page marking method provided for an exemplary embodiment of the present application;
[0079] Figure 6Structural schematic diagram of a page marking method provided for an exemplary embodiment of the present application;
[0080] Figure 7 Schematic diagram of a page identification bitmap provided for an exemplary embodiment of the present application;
[0081] Figure 8 Flow schematic diagram of iteratively migrating multiple memory pages corresponding to a virtual machine provided for an exemplary embodiment of the present application;
[0082] Figure 9 Structural schematic diagram of a page marking device provided for an exemplary embodiment of the present application;
[0083] Figure 10 Structural schematic diagram of another page marking device provided for an exemplary embodiment of the present application;
[0084] Figure 11 Structural schematic diagram of yet another page marking device provided for an exemplary embodiment of the present application;
[0085] Figure 12 Structural schematic diagram of an electronic device provided for an exemplary embodiment of the present application. Detailed implementation manners
[0086] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or fully authorized by all parties. And the collection, use, and processing of relevant data need to comply with relevant laws, regulations, and standards, and corresponding operation entrances are provided for users to choose to authorize or reject.
[0087] To make the purpose, technical solutions, and advantages of the present application clearer, the technical solutions of the present application will be clearly and completely described below in conjunction with specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0088] Figure 1 Scenario schematic diagram provided for an exemplary embodiment of the present application. Please refer to Figure 1 , including a source host and a target host.
[0089] In the memory 1 of the source host, there may be n memory pages. These n memory pages can be used to store data. For example, these n memory pages can be memory page 0, memory page 1,..., memory page n respectively, where n is an integer greater than or equal to 1.
[0090] A virtual machine 1 can be running in the source host, and there are multiple memory pages corresponding to virtual machine 1 among n memory pages. Suppose there are 1000 memory pages corresponding to virtual machine 1 among n memory pages, then the data corresponding to virtual machine 1 is stored in these 1000 memory pages. For example, these 1000 memory pages can be memory page 1-0, memory page 1-1, ……, memory page 1-999 respectively.
[0091] When migrating virtual machine 1 from the source host to the target host, it is necessary to determine 1000 memory pages corresponding to virtual machine 1 in the source host, and migrate the data in these 1000 memory pages to the memory pages in the target host. For example, the data in memory page 1-0, memory page 1-1, ……, memory page 1-999 can be migrated to memory page 2-0, memory page 2-1, ……, memory page 2-999 in the target host respectively.
[0092] After the migration is completed, virtual machine 1 can be running in the target host, and 1000 memory pages corresponding to virtual machine 1 can be included in the memory 2 of the target host, and the data corresponding to virtual machine 1 is stored in these 1000 memory pages.
[0093] In the related art, during the hot migration of a virtual machine, the virtual machine is still running, and the data in the memory page may be updated to generate a target memory page with updated data. The virtual machine has a corresponding record table, and the record table includes the base addresses of multiple memory pages corresponding to the virtual machine and page identifiers. The page identifier corresponding to the target memory page can be updated to a dirty identifier in the record table corresponding to the virtual machine to indicate that the target memory page has been updated and the data in the target memory page needs to be migrated. However, based on the above method, when iteratively migrating the data in multiple memory pages, due to the large number of record tables corresponding to the virtual machine and the need to traverse all entries in each record table to determine the page identifier of each memory page to determine multiple target memory pages, the migration efficiency of the data in the target memory page is low.
[0094] In the embodiment of the present application, a first storage space corresponding to the virtual machine can be set in the memory of the source host. When operating on the data in the target memory page, the page identifier of the target memory page can be updated to a dirty identifier in the first storage space to indicate that the target memory page is a memory page that has been updated and the data in the target memory page needs to be migrated. Based on the above method, during the process of migrating the virtual machine from the source host to the target host and performing iterative migration, the page identifiers of each memory page can be obtained from the first storage space to determine multiple target memory pages that need to be migrated, without traversing all entries of the record table corresponding to the virtual machine, thereby improving the migration efficiency of the data in the target memory page.
[0095] Next, in combination with Figure 2 , the page marking method in the related technology will be introduced. This page marking method is based on the Input / Output Memory Management Unit (IOMMU).
[0096] Figure 2 This is the page marking method in the related technology provided by this application. Please refer to Figure 2 , the source host includes a root data table (root table), multiple context data tables (context table), and multiple 4-level page tables (PageTable).
[0097] The root table may include multiple entries, and each entry corresponds to a bus number (Bus). For example, the root table may include 256 entries. Among them, entry 1 corresponds to Bus0, ……, entry 125 corresponds to Bus125, ……, entry 255 corresponds to Bus255.
[0098] For any Bus number, there may be a corresponding context table. For example, for Bus125, there may be a corresponding context table 125.
[0099] The context table may include multiple context entries. For any context entry, the context entry has a corresponding device number (Device, Dev) and function number (Function, Func). For example, context table 125 may include multiple context entries. Among them, the Dev number corresponding to context entry 1 is 0 and the Func number is 1.
[0100] For any context entry, the base address of the L0-level page table in the corresponding 4-level page table may be stored in the context entry. For example, the base address of L0-level page table 1 in 4-level page table 1 may be stored in context entry 1.
[0101] The Bus number, Dev number, and Func number can form a BDF number, which is the unique identifier corresponding to a Peripheral Component Interconnect express (PCIe) device.
[0102] For any virtual machine in the source host, the virtual machine may have multiple corresponding PCIe devices. Each PCIe device may have a corresponding BDF number.
[0103] For example, if virtual machine 1 corresponds to 2 PCIe devices, the BDF number 1 of PCIe device 1 is 125:0:1, and the BDF number 2 of PCIe device 2 is 0:30:7, then the base address of the 4-level page table 1 can be found in the root table and context table according to BDF number 1 and BDF number 2. That is, the base address of L0-level page table 1 in the 4-level page table 1 can be determined in the context entry 1 of context table 125 according to BDF number 1; or, the base address of L0-level page table 1 in the 4-level page table 1 can also be determined in the context entry 2 of context table 0 (i.e., the context entry corresponding to Dev being 30 and Func number being 7) according to BDF number 2, then the 4-level page table 1 can be determined as the 4-level page table corresponding to virtual machine 1.
[0104] For any 4-level page table, the 4-level page table may include 1 L0-level page table, multiple L1-level page tables, multiple L2-level page tables, and multiple L3-level page tables. For example, the 4-level page table 1 may include 1 L0-level page table, 2 9 L1-level page tables, 2 18 L2-level page tables, and 2 27 L3-level page tables.
[0105] The L0-level page table may include multiple entries, and the address of an L1-level page table may be stored in each entry. For example, the address of L1-level page table 1 may be stored in entry 1 of L0-level page table 1.
[0106] Each L1-level page table may include multiple entries, and the address of an L2-level page table may be stored in each entry. For example, the address of L2-level page table 1 may be stored in entry 1 of L1-level page table 1.
[0107] Each L2-level page table may include multiple entries, and the address of an L3-level page table may be stored in each entry. For example, the address of L3-level page table 1 may be stored in entry 1 of L2-level page table 1.
[0108] Each L3-level page table may include multiple entries, and the base address and page identifier of a memory page may be stored in each entry. For example, the base address 1 and page identifier of memory page 1 may be stored in entry 1 of L3-level page table 1.
[0109] When performing a migration operation on virtual machine 1, the source host can determine the root table and context table according to the BDF number in the memory operation request, and determine the base address of L0-level page table 1 in the 4-level page table 1 in the context table, so as to determine the 4-level page table 1 corresponding to virtual machine 1.
[0110] The source host can determine the base address corresponding to the target memory page in the 4-level page table 1 according to the virtual address of the target memory page in the memory operation request, and then determine the physical address of the target memory page according to the base address and the virtual address. The source host can operate on the target memory page according to the physical address. For example, if the target memory page is memory page 1, the base address 1 corresponding to memory page 1 can be determined in the 4-level page table 1 according to the virtual address 1 of memory page 1, and the physical address 1 of memory page 1 can be determined according to the base address 1 and the virtual address 1. The source host can operate on memory page 1 according to the physical address 1.
[0111] If the memory operation request is a write request, after operating on the target memory page, the data in the target memory page is updated, and then the page identifier corresponding to the target memory page can be updated to a dirty identifier in the L3-level page table of the 4-level page table to indicate that the data in the target memory page is updated. For example, after operating on memory page 1, the page identifier corresponding to memory page 1 can be updated to a dirty identifier in the L3-level page table 1 of the 4-level page table 1 to indicate that the data in memory page 1 is updated.
[0112] Based on the above page marking method, during the live migration of the virtual machine, when iteratively migrating the data in the memory page with the page identifier being a dirty identifier, it is necessary to traverse all the entries in the page tables in the 4-level page table corresponding to the virtual machine to determine the page identifier of each memory page, so as to determine multiple target memory pages with the page identifier being a dirty identifier, which in turn results in low migration efficiency of the data in the target memory page.
[0113] To solve the above problems, this application provides a page marking method based on IOMMU.
[0114] Next, the technical solution shown in this application will be described in detail through specific embodiments. It should be noted that the following several embodiments can exist independently or be combined with each other, and the same or similar content will not be repeated in different embodiments.
[0115] Figure 3 It is a schematic flowchart of a page marking method provided for an exemplary embodiment of this application. Please refer to Figure 3 , the method may include:
[0116] S301. During the live migration of the virtual machine, receive the memory operation request corresponding to the virtual machine.
[0117] The execution subject of the embodiments of this application can be the source host or a page marking device set in the source host. The page marking device can be implemented by software or by a combination of software and hardware. The page marking device can be a processor in the source host. For the sake of easy understanding, in the following, the execution subject is taken as the source host for illustration.
[0118] At least one virtual machine can be running on the source host. The virtual machine can be live migrated from the source host to the target host.
[0119] For any virtual machine, the memory of the source host can include multiple memory pages corresponding to the virtual machine.
[0120] A memory operation request can be used to request an operation on a target memory page.
[0121] For example, if virtual machine 1 is running on the source host, during the live migration of virtual machine 1, the source host can receive memory operation request 1 corresponding to virtual machine 1. If memory operation request 1 is "write data A to memory page 1", then the target memory page is memory page 1, and memory operation request 1 is used to request an operation on memory page 1.
[0122] S302. Operate on the data in the target memory page according to the memory operation request.
[0123] For example, if memory operation request 1 is "write data A to memory page 1", then data A can be written to memory page 1 according to memory operation request 1.
[0124] S303. In the first storage space corresponding to the virtual machine, update the page identifier of the target memory page to a dirty identifier.
[0125] The dirty identifier can be used to indicate that the data in the target memory page has been updated.
[0126] Optionally, in the memory of the source host, there can be preset multiple first storage spaces corresponding to different virtual machines.
[0127] Next, Figure 4 , the first storage space in the memory will be described.
[0128] Figure 4 The following is a schematic diagram of the memory in the source host provided by an exemplary embodiment of the present application. Please refer to Figure 4 , if virtual machine 0 and virtual machine 1 are running on the source host, then in the memory of the source host, there can be preset first storage space 0 corresponding to virtual machine 0 and first storage space 1 corresponding to virtual machine 1.
[0129] The first storage space can include page identifiers corresponding to multiple memory pages.
[0130] Optionally, a page identifier of "0" can be used to indicate that the data in the memory page has not been updated; the dirty identifier can be represented by "1", so a page identifier of the dirty identifier, that is, a page identifier of "1", can be used to indicate that the data in the memory page has been updated.
[0131] In an optional embodiment, the page identifier corresponding to the target memory page can be updated to a dirty identifier in the first storage space corresponding to the virtual machine in the following manner: determine the first storage address according to the memory operation request; determine the first storage space according to the first storage address; and update the page identifier of the target memory page to a dirty identifier in the first storage space.
[0132] The first storage address may refer to the starting address of the first storage space.
[0133] For example, if virtual machine 1 corresponds to the first storage space 1, after the source host receives the memory operation request 1, it can determine the first storage address 1 according to the memory operation request 1, and determine the first storage space 1 according to the first storage address 1, and then can update the page identifier of memory page 1 to a dirty identifier in the first storage space 1.
[0134] In the embodiment of the present application, during the hot migration of the virtual machine, the source host can receive the memory operation request corresponding to the virtual machine, and operate on the data in the target memory page according to the memory operation request, and then can update the page identifier of the target memory page to a dirty identifier in the first storage space corresponding to the virtual machine. Since the page identifier of the target memory page can be updated to a dirty identifier in the first storage space corresponding to the virtual machine. During the iterative migration when migrating the virtual machine from the source host to the target host, the page identifiers of each memory page can be obtained in the first storage space to determine multiple target memory pages to be migrated, without having to traverse all the entries in the record table corresponding to the virtual machine, thereby improving the migration efficiency of the data in the target memory page.
[0135] Next, on the basis of the above Figure 3 shown embodiment, in combination with Figure 5 the above page marking method will be described in detail.
[0136] Figure 5 FIG. is a schematic flow chart of another page marking method provided by an exemplary embodiment of the present application. Please refer to Figure 5 The method may include:
[0137] S501. During the hot migration of the virtual machine, receive the memory operation request corresponding to the virtual machine.
[0138] For example, during the hot migration of virtual machine 1, the source host can receive the memory operation request 1 corresponding to virtual machine 1. The memory operation request 1 may be "write data A in memory page 1".
[0139] S502. Query the record information corresponding to the target memory page in the record table according to the first part of the virtual address.
[0140] Optionally, the memory operation request may include the virtual address of the target memory page, and the virtual address may include a first part of the virtual address and a second part of the virtual address. The second part of the virtual address may be the address offset corresponding to the target memory page.
[0141] If the virtual address is a 48-bit address, then from right to left, the second part of the virtual address can be represented by bits 0 to 11, and the first part of the virtual address can be represented by bits 12 to 47. For example, if the virtual address 1 is 0x0080x0120x0240x2820x1DE, then "0x1DE" can be the second part of the virtual address, and "0x0080x0120x0240x282" can be the first part of the virtual address.
[0142] Optionally, the record table may be a multi-level page table. For example, the record table may be a 4-level page table, and the record table may include multiple page tables. As Figure 6 shown, the record table may include a level-0 page table, multiple level-1 page tables, multiple level-2 page tables, and multiple level-3 page tables.
[0143] The record table may include the record information corresponding to the target memory page. The record information includes the base address of the target memory page.
[0144] Optionally, the source host can determine the base address of the level-0 page table in the record table in the context entry corresponding to the virtual machine, so as to determine the record table corresponding to the virtual machine. The record table may include multiple page tables, and the record information corresponding to the target memory page can be queried in the multiple page tables.
[0145] Specifically, querying the record information corresponding to the target memory page in multiple page tables includes the following 5 steps:
[0146] Step 1: Since the base address of the level-0 page table in the record table can be determined in the context entry, the source host can determine the level-0 page table according to the base address of the level-0 page table in the record table.
[0147] Step 2: The level-0 page table may include multiple entries, and each entry may store the address of a level-1 page table. Then, the level-1 page table address can be indexed in the level-0 page table according to bits 39 to 47 in the first part of the virtual address, and the level-1 page table can be determined according to the address of the level-1 page table. For example, if the record table 1 corresponding to virtual machine 1 is as Figure 6As shown, if the first part of the virtual address is "0x0080x0120x0240x282", where bits 39 - 47 are "0x008", then the address of the corresponding L1 - level page table can be determined in the L0 - level page table 1 according to "0x008". Assume that the address of the L1 - level page table 1 can be determined in the L0 - level page table 1 according to "0x008", and then the L1 - level page table 1 can be determined according to the address of the L1 - level page table 1.
[0148] Step 3: The L1 - level page table can include multiple entries, and the address of an L2 - level page table can be stored in each entry. Then, bits 30 - 38 in the first part of the virtual address can be used to index in the corresponding L1 - level page table to determine the address of the corresponding L2 - level page table. Then, the L2 - level page table can be determined according to the address of the L2 - level page table. For example, if the record table 1 corresponding to virtual machine 1 is as Figure 6 As shown, if bits 30 - 38 in the first part of the virtual address are "0x012", then the address of the corresponding L2 - level page table 1 can be determined in the L1 - level page table 1 according to "0x012". Assume that the address of the L2 - level page table 1 can be determined in the L1 - level page table 1 according to "0x012", and then the L2 - level page table 1 can be determined according to the address of the L2 - level page table 1.
[0149] Step 4: The L2 - level page table can include multiple entries, and the address of an L3 - level page table can be stored in each entry. Then, bits 21 - 29 in the first part of the virtual address can be used to index in the corresponding L2 - level page table to determine the address of the corresponding L3 - level page table. Then, the L3 - level page table can be determined according to the address of the L3 - level page table. For example, if the record table 1 corresponding to virtual machine 1 is as Figure 6 As shown, if bits 21 - 29 in the first part of the virtual address are "0x024", then the address of the corresponding L3 - level page table 1 can be determined in the L2 - level page table 1 according to "0x024". Assume that the address of the L3 - level page table 1 can be determined in the L2 - level page table 1 according to "0x024", and then the L3 - level page table 1 can be determined according to the address of the L3 - level page table 1.
[0150] Step 5: The L3 - level page table can include multiple entries, and the record information corresponding to a memory page can be stored in each entry. Then, bits 12 - 20 in the first part of the virtual address can be used to index in the corresponding L3 - level page table to determine the record information corresponding to the target memory page. For example, if the target memory page is memory page 1, and bits 12 - 20 in the first part of the virtual address are "0x282", then the record information 1 corresponding to memory page 1 can be queried in the L3 - level page table 1. The record information 1 can include the base address 1 of memory page 1, as Figure 6 shown.
[0151] S503. Determine the physical address corresponding to the target memory page according to the base address and the second part of the virtual address.
[0152] Optionally, the base address can be a 36-bit address, and the second part of the virtual address is 12 bits. Therefore, the base address and the second part of the virtual address can be combined to obtain a 48-bit physical address, that is, the physical address corresponding to the target memory page.
[0153] For example, if the target memory page is memory page 1, if the base address 1 of memory page 1 is queried in the record table, and if the second part of the virtual address is "0x1DE", then the physical address 1 corresponding to memory page 1 can be determined according to the base address 1 and the second part of the virtual address 0x1DE.
[0154] S504. Operate on the data in the target memory page according to the physical address.
[0155] For example, if the memory operation request 1 can be "write data A in memory page 1", and if the physical address of memory page 1 is physical address 1, then memory page 1 can be determined according to physical address 1, and data A can be written in memory page 1 according to the memory operation request 1.
[0156] S505. Determine the context entry corresponding to the virtual machine according to the device identifier.
[0157] Optionally, the memory operation request may include a device identifier. The device identifier can be a BDF number, so the device identifier includes a Bus number, a Dev number, and a Func number. For example, if the device identifier is 125:0:1, it means that the Bus number is 125, the Dev number is 0, and the Func number is 1.
[0158] Next, in combination with Figure 6 , the context entry corresponding to the virtual machine will be described.
[0159] Figure 6 It is a schematic structural diagram of a page marking method provided by an exemplary embodiment of the present application. Please refer to Figure 6 , the host computer may include a root table, multiple context tables, and multiple record tables. The source host computer can index to the root table and the context table according to the device identifier, and determine the context entry corresponding to the virtual machine in the context table.
[0160] For example, if the device identifier in the memory operation request is 125:0:1, the context table 125 corresponding to Bus number 125 can be determined according to the device identifier, and the context entry 1 corresponding to Dev number 0 and Func number 1 can be determined in the context table 125, and the context entry 1 is the context entry corresponding to virtual machine 1.
[0161] S506. Obtain the first storage address in the context entry.
[0162] The context entry may store the base address of the L0-level page table in the 4-level page table corresponding to the virtual machine, and the first storage address of the first storage space. The first storage address is pre-stored in the context entry.
[0163] For example, if it is determined that the context entry 1 corresponds to virtual machine 1, if as Figure 6 shown, the base address of the L0-level page table 1 and the first storage address 1 are stored in the context entry 1, then the first storage address 1 can be obtained in the context entry.
[0164] S507. Determine the first storage space according to the first storage address.
[0165] For example, as Figure 6 shown, the source host can determine the first storage space 1 according to the first storage address 1.
[0166] S508. Update the page identifier of the target memory page to a dirty identifier in the first storage space.
[0167] The first storage space may store a page identifier bitmap corresponding to the virtual machine. The page identifier bitmap may include page identifiers corresponding to multiple memory pages of the virtual machine.
[0168] Next, in combination with Figure 7 , the page identifier bitmap will be described.
[0169] Figure 7 This is a schematic diagram of a page identifier bitmap provided by an exemplary embodiment of the present application. Please refer to Figure 7 , if virtual machine 1 corresponds to 1000 memory pages, which are memory page 1, memory page 2,..., memory page 1000 respectively, then the page identifier bit Figure 1 can be "01100...1". Among them, the first bit can be used to represent the page identifier corresponding to memory page 1, the second bit can be used to represent the page identifier corresponding to memory page 2,..., and the 1000th bit can be used to represent the page identifier corresponding to memory page 1000.
[0170] In an optional embodiment, the page identifier of the target memory page can be updated to a dirty identifier in the following manner in the first storage space: In the page identifier bitmap of the first storage space, determine the current page identifier corresponding to the target memory page; if the current page identifier is different from the dirty identifier, update the current page identifier to the dirty identifier.
[0171] For example, as Figure 6 in, if the first storage space 1 stores as Figure 7 shown in the page identifier bit Figure 1 . If the target memory page is memory page 1, then in the page identifier bit Figure 1 , determine the current page identifier 1 corresponding to memory page 1. If the current page identifier 1 is "0" and the dirty identifier is represented by "1", then the current page identifier corresponding to memory page 1 can be updated to the dirty identifier, that is, update "0" to "1".
[0172] S509. In the recorded information, determine whether the page identifier of the target memory page is a dirty identifier.
[0173] Optionally, the recorded information may further include the page identifier of the target memory page.
[0174] For example, if the target memory page is memory page 1 and the page identifier included in the recorded information 1 corresponding to memory page 1 is 0, the source host can determine whether this page identifier is a dirty identifier. If not, step S510 can be executed.
[0175] S510. Update the page identifier of the target memory page to a dirty identifier.
[0176] For example, if the page identifier included in the recorded information 1 corresponding to memory page 1 is 0, then the page identifier of the target memory page can be updated to the dirty identifier, that is, update "0" to "1".
[0177] Optionally, updating the page identifier in the recorded information corresponding to the target memory page to a dirty identifier is for, during the subsequent migration process, after the source host obtains the page identifier corresponding to the target memory page in the first storage space, it can compare it with the page identifier in the recorded information. If they are the same and it is a dirty identifier, then the data in the target memory page can be migrated. The page identifier in the recorded information can play the role of a redundant identifier.
[0178] In the embodiment of the present application, during the live migration of a virtual machine, the source host can receive a memory operation request corresponding to the virtual machine, query the record information corresponding to the target memory page in the record table according to the first part of the virtual address, and determine the physical address corresponding to the target memory page according to the base address and the second part of the virtual address. Furthermore, the data in the target memory page can be operated on according to the physical address. The source host can determine the context entry corresponding to the virtual machine according to the device identifier, obtain the first storage address in the context entry, and determine the first storage space according to the first storage address. Furthermore, the page identifier of the target memory page can be updated to a dirty identifier in the first storage space. The source host can determine whether the page identifier of the target memory page is a dirty identifier in the record information and update the page identifier of the target memory page to a dirty identifier. Since the page identifier of the target memory page can be updated to a dirty identifier in the first storage space corresponding to the virtual machine. During the process of migrating the virtual machine from the source host to the target host, when performing iterative migration, the page identifiers of each memory page can be obtained in the first storage space to determine multiple target memory pages that need to be migrated, without traversing all the entries in the record table corresponding to the virtual machine, thereby improving the migration efficiency of the data in the target memory page.
[0179] It should be noted that, based on Figure 2 or Figure 5 the page marking method shown, during the live migration of a virtual machine, when performing iterative migration on multiple memory pages corresponding to the virtual machine, the efficiency of determining dirty memory pages can be improved, thereby improving the migration efficiency of the data in the dirty memory pages, reducing the downtime of the virtual machine caused by live migration, and improving the efficiency of live migration of the virtual machine.
[0180] Next, in combination with Figure 8 , the process of performing iterative migration on multiple memory pages corresponding to the virtual machine will be described.
[0181] Figure 8 FIG. is a schematic flowchart of a process for performing iterative migration on multiple memory pages corresponding to a virtual machine provided by an exemplary embodiment of the present application. Please refer to Figure 8 , the method may include:
[0182] S801. Determine at least one dirty memory page among multiple memory pages corresponding to the virtual machine according to the page identifiers of each memory page corresponding to the virtual machine in the first storage space.
[0183] In an optional embodiment, at least one dirty memory page is determined from multiple memory pages corresponding to a virtual machine according to the page identifiers of each memory page corresponding to the virtual machine in the first storage space: at least one target page identifier is determined in the page identifier bitmap, and the value of the target page identifier is the value corresponding to the dirty identifier; the memory pages corresponding to at least one target page identifier are determined as at least one dirty memory page.
[0184] As Figure 6 shown, the source host can determine the device identifier and determine the context entry corresponding to the virtual machine according to the device identifier. The context entry may include a first storage address. The source host can determine the first storage address in the context entry corresponding to the virtual machine and determine the first storage space according to the first storage address. The first storage space may store the page identifier bitmap corresponding to the virtual machine. The page identifier bitmap may include the page identifiers corresponding to multiple memory pages.
[0185] For example, for 1000 memory pages corresponding to virtual machine 1, if the page identifier bit Figure 1 includes the page identifiers corresponding to the 1000 memory pages, assuming that 400 target page identifiers, that is, the page identifiers with the value of "1", can be determined in the page identifier bitmap, then the memory pages corresponding to the 400 target page identifiers can be determined as dirty memory pages, and 400 dirty memory pages can be determined.
[0186] S802. Synchronize the data in at least one dirty memory page from the source host where the virtual machine currently resides to the target host.
[0187] The target host is the host to which the virtual machine is to be migrated.
[0188] For example, if it is determined that there are 400 dirty memory pages, the data in the 400 dirty memory pages can be synchronized from the source host to the target host respectively.
[0189] Optionally, after synchronizing the data in at least one dirty memory page from the source host where the virtual machine currently resides to the target host, the page identifiers corresponding to each memory page in the page identifier bitmap in the first storage space can be restored to "0".
[0190] S803. Apply for a second storage space in the source host.
[0191] Optionally, during the iterative migration of multiple memory pages corresponding to a virtual machine, the i-th migration (where i is an integer greater than or equal to 1) can be performed according to the page identification bitmap in the first storage space. Since the virtual machine is still running during the i-th migration, new dirty memory pages may be generated. Therefore, a second storage space can be applied for in the source host, and the second storage space can be used to store the page identification bitmap used for the (i + 1)-th migration, so as to perform the (i + 1)-th migration according to the page identification bitmap in the second storage space.
[0192] S804. Determine the second storage address of the second storage space.
[0193] S805. In the context entry corresponding to the virtual machine, update the first storage address to the second storage address.
[0194] Optionally, if the virtual machine corresponds to multiple context entries, the first storage addresses in the multiple context entries can be updated to the second storage address.
[0195] For example, if the context entry 1 corresponding to virtual machine 1 stores the first storage address 1 corresponding to the first storage space, the first storage address 1 can be updated to the second storage address; if virtual machine 1 also corresponds to the context entry corresponding to Dev being 30 and Func number being 7 in context table 0, the first storage address 1 in this context entry can be updated to the second storage address.
[0196] Since the page identification bitmap used for the i-th migration can be stored in the first storage space and the page identification bitmap used for the (i + 1)-th migration can be stored in the second storage space, the confusion of the page identification bitmap during the migration process is avoided, and the accuracy of migrating the data in multiple memory pages is improved.
[0197] In the embodiment of the present application, the source host can determine at least one dirty memory page among the multiple memory pages corresponding to the virtual machine according to the page identifications of the respective memory pages corresponding to the virtual machine in the first storage space, and synchronize the data in the at least one dirty memory page from the source host where the virtual machine is currently located to the target host. A second storage space can also be applied for in the source host, the second storage address of the second storage space can be determined, and in the context entry corresponding to the virtual machine, the first storage address is updated to the second storage address. Since during the process of migrating the virtual machine from the source host to the target host and performing iterative migration, the page identifications of each memory page can be obtained in the first storage space to determine multiple target memory pages to be migrated, without traversing all the entries of the record table corresponding to the virtual machine, the migration efficiency of the data in the target memory pages is improved, and thus the hot migration efficiency of the virtual machine is improved.
[0198] Figure 9The structural schematic diagram of a page marking device provided for an exemplary embodiment of the present application. Please refer to Figure 9 , the page marking device 10 includes: a receiving module 11, an operation module 12, and a first update module 13, where
[0199] The receiving module 11 is configured to receive, during the live migration of the virtual machine, a memory operation request corresponding to the virtual machine, where the memory operation request is used to request an operation on a target memory page;
[0200] The operation module 12 is configured to operate on the data in the target memory page according to the memory operation request.
[0201] The first update module 13 is configured to update the page identifier of the target memory page to a dirty identifier in a first storage space corresponding to the virtual machine, where the dirty identifier is used to indicate that the data in the target memory page has been updated during the live migration of the virtual machine.
[0202] The page marking device provided by the embodiments of the present application can execute the technical solutions shown in the above method embodiments, and its implementation principle and beneficial effects are similar, which will not be elaborated here.
[0203] In a possible implementation manner, the first update module 13 is specifically configured to:
[0204] Determine a first storage address according to the memory operation request;
[0205] Determine the first storage space according to the first storage address;
[0206] Update the page identifier of the target memory page to the dirty identifier in the first storage space.
[0207] In a possible implementation manner, the memory operation request includes a device identifier; the first update module 13 is specifically configured to:
[0208] Determine a context entry corresponding to the virtual machine according to the device identifier;
[0209] Obtain the first storage address in the context entry, where the first storage address is pre-stored in the context entry.
[0210] In a possible implementation manner, a page identifier bitmap corresponding to the virtual machine is stored in the first storage space; the first update module 13 is specifically configured to:
[0211] Determine a current page identifier corresponding to the target memory page in the page identifier bitmap in the first storage space;
[0212] If the current page identifier is different from the dirty identifier, update the current page identifier to the dirty identifier.
[0213] In a possible implementation manner, the memory operation request includes the virtual address of the target memory page, and the virtual address includes a first part of the virtual address and a second part of the virtual address; the operation module 12 is specifically configured to:
[0214] Query the record information corresponding to the target memory page in the record table according to the first part of the virtual address, where the record information includes the base address of the target memory page;
[0215] Determine the physical address corresponding to the target memory page according to the base address and the second part of the virtual address;
[0216] Operate on the data in the target memory page according to the physical address.
[0217] In a possible implementation manner, the record information further includes the page identifier of the target memory page; the first update module 13 is further configured to,
[0218] In the record information, determine whether the page identifier of the target memory page is the dirty identifier;
[0219] If not, update the page identifier of the target memory page to the dirty identifier.
[0220] The page marking device provided by the embodiments of the present application can execute the technical solutions shown in the above method embodiments, and its implementation principle and beneficial effects are similar, and will not be elaborated here.
[0221] Figure 10 FIG. is a schematic structural diagram of another page marking device provided by an exemplary embodiment of the present application. Please refer to Figure 10 , in Figure 9 Based on the embodiment shown, the page marking device 10 further includes: a first determination module 14 and a synchronization module 15, where,
[0222] The first determination module 14 is configured to determine at least one dirty memory page among the multiple memory pages corresponding to the virtual machine according to the page identifiers of the memory pages corresponding to the virtual machine in the first storage space;
[0223] The synchronization module 15 is configured to synchronize the data in the at least one dirty memory page from the source host where the virtual machine is currently located to the target host, and the target host is the host to which the virtual machine is to be migrated.
[0224] The page marking device provided by the embodiments of the present application can execute the technical solutions shown in the above method embodiments. The implementation principles and beneficial effects are similar and will not be elaborated here.
[0225] In a possible implementation manner, the page identification bitmap corresponding to the virtual machine is stored in the first storage space; the first determination module 14 is specifically configured to:
[0226] Determine at least one target page identifier in the page identification bitmap, where the value of the target page identifier is the value corresponding to the dirty identifier;
[0227] Determine the memory pages corresponding to the at least one target page identifier as the at least one dirty memory page.
[0228] The page marking device provided by the embodiments of the present application can execute the technical solutions shown in the above method embodiments. The implementation principles and beneficial effects are similar and will not be elaborated here.
[0229] Figure 11 This is a schematic structural diagram of another page marking device provided by an exemplary embodiment of the present application. Please refer to Figure 11 , in Figure 10 On the basis of the embodiment shown, the page marking device 10 further includes: an application module 16, a second determination module 17, and a second update module 18.
[0230] The application module 16 is configured to apply for a second storage space in the source host;
[0231] The second determination module 17 is configured to determine a second storage address of the second storage space;
[0232] The second update module 18 is configured to update the first storage address to the second storage address in the context entry corresponding to the virtual machine.
[0233] The page marking device provided by the embodiments of the present application can execute the technical solutions shown in the above method embodiments. The implementation principles and beneficial effects are similar and will not be elaborated here.
[0234] This is a schematic structural diagram of an electronic device provided by an exemplary embodiment of the present application. Please refer to Figure 12 , the electronic device 20 may include a processor 21 and a memory 22. Exemplarily, the processor 21 and the memory 22 are interconnected with each other through a bus 23.
[0235] The memory 22 stores computer execution instructions;
[0236] The processor 21 executes the computer-executable instructions stored in the memory 22, so that the processor 21 executes the method as shown in the above method embodiments.
[0237] Figure 12 The electronic device shown in [the relevant content] can be the source and destination host described in any of the above embodiments.
[0238] Correspondingly, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the method described in the above method embodiments.
[0239] Correspondingly, an embodiment of the present application can also provide a computer program product, including a computer program. When the computer program is executed by a processor, it can implement the method shown in the above method embodiments.
[0240] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program code.
[0241] The present invention is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, and the combination of processes and / or blocks in the flowchart and / or block diagram can also be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the specified functions in [the relevant content] Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0242] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured product including an instruction device, and the instruction device implements the specified functions in [the relevant content] Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0243] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one process Figure 1 one process or multiple processes and / or blocks Figure 1 steps of the functions specified in one block or multiple blocks.
[0244] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and memory.
[0245] The memory may include non-permanent memory in the form of computer-readable media, random access memory (RAM) and / or non-volatile memory such as read-only memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
[0246] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can store information by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.
[0247] It should also be noted that the term "comprising", "including" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, commodity or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, commodity or device. Without further limitation, an element defined by the statement "comprising one..." does not exclude the presence of additional identical elements in the process, method, commodity or device comprising the element.
[0248] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.
Claims
1. A page marking method, characterized in that, Including: During the live migration of a virtual machine, receiving a memory operation request corresponding to the virtual machine, where the memory operation request is used to request an operation on a target memory page; Operating on the data in the target memory page according to the memory operation request; In a first storage space corresponding to the virtual machine, updating a page identifier of the target memory page to a dirty identifier, where the dirty identifier is used to indicate that the data in the target memory page has been updated.
2. The method according to claim 1, characterized in that, In the first storage space corresponding to the virtual machine, updating the page identifier corresponding to the target memory page to the dirty identifier includes: Determining a first storage address according to the memory operation request; Determining the first storage space according to the first storage address; In the first storage space, updating the page identifier of the target memory page to the dirty identifier.
3. The method according to claim 2, wherein The memory operation request includes a device identifier; determining the first storage address according to the memory operation request includes: Determining a context entry corresponding to the virtual machine according to the device identifier; Obtaining the first storage address in the context entry, where the first storage address is pre-stored in the context entry.
4. The method according to claim 2 or 3, characterized in that, A page identifier bitmap corresponding to the virtual machine is stored in the first storage space; In the first storage space, updating the page identifier of the target memory page to the dirty identifier includes: In the page identifier bitmap in the first storage space, determining a current page identifier corresponding to the target memory page; If the current page identifier is different from the dirty identifier, updating the current page identifier to the dirty identifier.
5. The method according to any one of claims 1-4, characterized in that The memory operation request includes a virtual address of the target memory page, where the virtual address includes a first part of the virtual address and a second part of the virtual address; Operating on the data in the target memory page according to the memory operation request includes: Querying, according to the first part of the virtual address, record information corresponding to the target memory page in a record table, where the record information includes a base address of the target memory page; Determining a physical address corresponding to the target memory page according to the base address and the second part of the virtual address; Operating on the data in the target memory page according to the physical address.
6. The method according to claim 5, wherein The record information further includes a page identifier of the target memory page; the method further includes: In the record information, determining whether the page identifier of the target memory page is the dirty identifier; If not, updating the page identifier of the target memory page to the dirty identifier.
7. The method according to any one of claims 1-6, characterized in that, The method further includes: Determining at least one dirty memory page from multiple memory pages corresponding to the virtual machine according to page identifiers of each memory page corresponding to the virtual machine in the first storage space; Synchronizing data in the at least one dirty memory page from a source host where the virtual machine currently resides to a target host, where the target host is a host to which the virtual machine is to be migrated.
8. The method according to claim 7, wherein A page identifier bitmap corresponding to the virtual machine is stored in the first storage space; determining at least one dirty memory page from multiple memory pages corresponding to the virtual machine according to page identifiers of each memory page corresponding to the virtual machine in the first storage space includes: Determine at least one target page identifier in the page identifier bitmap, where the value of the target page identifier is the value corresponding to the dirty identifier; Determine the memory pages corresponding to the at least one target page identifier as the at least one dirty memory page.
9. The method according to claim 7 or 8, characterized in that, The method further includes: Apply for a second storage space in the source host; Determine a second storage address of the second storage space; In the context entry corresponding to the virtual machine, update the first storage address to the second storage address.
10. A page marking device, characterized in that, Includes: A receiving module, an operating module, and a first updating module, where The receiving module is configured to receive, during the hot migration of the virtual machine, a memory operation request corresponding to the virtual machine, where the memory operation request is used to request an operation on a target memory page; The operating module is configured to operate on the data in the target memory page according to the memory operation request; The first updating module is configured to update the page identifier of the target memory page to a dirty identifier in a first storage space corresponding to the virtual machine, where the dirty identifier is used to indicate that the data in the target memory page has been updated.
11. An electronic device, characterized in that, Includes: At least one processor; And A memory communicatively connected to the at least one processor; Wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to cause the electronic device to execute the method according to any one of claims 1-9.
12. A computer-readable storage medium, characterized in that, Computer-executable instructions are stored in the computer-readable storage medium, and when the processor executes the computer-executable instructions, the method according to any one of claims 1-9 is implemented.
13. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, the method according to any one of claims 1-9 is implemented.
Citation Information
Cited By
Page marking method, apparatus and device
WO2025153900A1
