Virtual machine migration method and apparatus, electronic device, and storage medium
By sending only the occupied memory pages in the virtual machine, the problem of large memory data volume in virtual machine migration is solved, the migration time is shortened, and the migration efficiency and application performance are improved.
Patent Information
- Application Number
- PCT/CN2024/076221
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-02-24
- Filing Date
- 2024-02-06
- Publication Date
- 2024-08-29
AI Technical Summary
In existing virtual machine migration technology, the amount of memory data copied and migrated is large, which results in a long migration time, affects the CPU operation of the virtual machine, and especially has a negative impact on the performance of real-time sensitive applications.
By determining the memory page status information of the virtual machine to be migrated, only the occupied memory pages are sent to the target virtual machine, avoiding the migration of all memory pages and reducing the amount of network data sent and migration time.
Without reducing the IO performance of the virtual machine, it shortens the migration time, improves the migration efficiency, and reduces the interference to the virtual machine application.
Smart Images

Figure CN2024076221_29082024_PF_FP_ABST
Abstract
Description
Virtual machine migration method, device, electronic device and storage medium
[0001] Cross-references
[0002] This application claims priority to the Chinese patent application filed with the China Patent Office on February 24, 2023, with application number 202310215992.9 and application name “Virtual machine migration method, device, electronic device and storage medium”. The entire contents of the application are incorporated by reference into this application. Technical Field
[0003] The present application belongs to the field of virtual machine technology, and specifically relates to a virtual machine migration method, device, electronic device and storage medium. Background Art
[0004] With the continuous advancement of computer technology, virtual machine technology has also experienced rapid growth. In virtualization scenarios, virtual machine migration is a fundamental and common function. Currently, common virtual machine migration techniques include live migration, so-called because the migration process only causes a brief pause, and the applications within the virtual machine are unaware of the changes to the physical server on which they are running.
[0005] However, during the current online migration process, the amount of memory data copied and migrated is large, and the migration of the virtual machine lasts for a long time, which inevitably interferes with the operation of the central processing unit (CPU) of the virtual machine, thereby affecting application performance.
[0006] Summary of the Invention
[0007] Embodiments of the present application provide a virtual machine migration method, apparatus, electronic device, and storage medium to solve the problem of a large amount of memory data required for copy migration.
[0008] In the first aspect, an embodiment of the present application provides a method for migrating a virtual machine, comprising: determining status information of the memory pages of the virtual machine to be migrated, wherein the status information includes an occupied state or an idle state; based on the status information, determining at least one target memory page to be sent to the target virtual machine from all memory pages of the virtual machine to be migrated; and sending the at least one target memory page to the target virtual machine.
[0009] In the second aspect, an embodiment of the present application further provides a virtual machine migration device, including: a first determination module, used to determine the status information of the memory page of the virtual machine to be migrated, wherein the status information includes an occupied state or an idle state; a second determination module, used to determine at least one target memory page to be sent to the target virtual machine from all the memory pages of the virtual machine to be migrated based on the status information; and a sending module, used to send the at least one target memory page to the target virtual machine.
[0010] In a third aspect, an embodiment of the present application provides an electronic device comprising a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.
[0011] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] FIG1 is a flowchart of one of the steps of a virtual machine migration method according to an embodiment of the present application;
[0013] FIG2 is a second flowchart of the steps of the virtual machine migration method according to an embodiment of the present application;
[0014] FIG3 is a schematic diagram of a bitmap in an embodiment of the present application;
[0015] FIG4 is a schematic diagram of a module of a virtual machine migration device according to an embodiment of the present application;
[0016] FIG5 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0017] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0018] The terms "first," "second," and the like in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of this application can be implemented in an order other than that illustrated or described herein, and that the objects distinguished by "first," "second," and the like are generally of the same type, and do not limit the number of objects; for example, the first object can be one or more. In addition, the term "and / or" in the specification and claims refers to at least one of the connected objects, and the character " / " generally indicates that the objects connected are in an "or" relationship.
[0019] Specifically, to achieve efficient input / output (I / O) of the virtual machine, the hardware device will be directly transmitted to the virtual machine, that is, the device will interact directly with the virtual machine. To ensure that when the device accesses the virtual machine's memory through direct memory access (DMA), no page fault exception occurs, which will cause some hardware to be unable to handle or cause performance loss, usually at the initialization of the virtual machine, all the virtual machine's memory is directly mapped to physical memory, and it is not allowed to be swapped or shared with other applications. This process is called pinning.
[0020] During the entire VM migration process, the need to track every memory write and network transmission by the VM inevitably impacts the VM's services. This is reflected in a noticeable increase in the CPU usage of applications within the VM. Therefore, the entire migration process, from dirty page tracking to restoring the VM at the migration destination, should be as short as possible. This is especially true for real-time-sensitive applications, as prolonged migration times can directly impact service performance. When a VM configured with a passthrough device needs to be migrated, all memory is pinned. To ensure efficient I / O processing, the configured memory size is bound to physical memory regardless of the actual memory usage. This results in excessive memory pages being migrated, inevitably interfering with the VM's CPU operations and impacting application performance.
[0021] In response to the above problems, an embodiment of the present application determines the status information of the memory pages of the virtual machine to be migrated, wherein the status information includes an occupied state or an idle state, and determines at least one target memory page to be sent to the target virtual machine from all the memory pages of the virtual machine to be migrated according to the status information, and sends the at least one target memory page to the target virtual machine; the status information of the reference memory page is implemented, and only at least one target memory page determined according to the status information is sent to the target virtual machine, without sending all the memory pages of the virtual machine to be migrated to the target virtual machine, so that the amount of memory data sent by the direct-through device virtual machine during the migration process is effectively reduced without reducing the IO performance of the direct-through device virtual machine, shortening the memory migration time, and improving the migration efficiency, thereby reducing the interference to the internal applications of the virtual machine caused by dirty page records and network data transmission.
[0022] The following describes in detail the virtual machine migration method, device, electronic device, and storage medium provided in the embodiments of the present application through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0023] FIG1 shows a method for migrating a virtual machine provided by an embodiment of the present application, the method comprising the following steps:
[0024] Step 101: Determine the status information of the memory pages of the virtual machine to be migrated.
[0025] Specifically, the virtual memory system divides the virtual memory into virtual pages of fixed size. The size of each virtual page is fixed in bytes. These virtual pages are memory pages of the virtual machine.
[0026] The memory page status information includes occupied or free status. The occupied state means that the memory page is currently allocated to an application in the virtual machine, that is, it is currently occupied. The free state means that the memory page is not currently allocated to an application in the virtual machine, that is, it is currently unoccupied.
[0027] By determining the status information of the memory pages of the virtual machine to be migrated, all the memory pages of the virtual machine can be divided into memory pages that are currently in an occupied state (i.e., occupied) and memory pages that are currently in an idle state (i.e., not occupied) according to the occupied state or idle state indicating whether the memory pages are occupied.
[0028] In addition, it should be noted that the method can be executed by a virtual machine monitor (VMM), and currently can also be executed by other controllers. This application takes the execution by the VMM as an example for explanation.
[0029] Step 102: Determine, based on the state information, at least one target memory page to be sent to the target virtual machine from all memory pages of the virtual machine to be migrated.
[0030] Specifically, this step can determine at least one target memory page to be sent to the target virtual machine from all memory pages of the virtual machine to be migrated based on the status information of the memory page, thereby realizing the determination of whether a memory page is the target memory page to be sent based on the status information of whether the memory page is currently occupied, avoiding the related technology of determining all memory pages as the target memory pages to be sent, thereby reducing the amount of data sent by the virtual machine to be migrated over the network during the migration process and shortening the duration of the virtual machine migration.
[0031] Step 103: Send the at least one target memory page to the target virtual machine.
[0032] This embodiment determines at least one target memory page to be sent to the target virtual machine from all memory pages of the virtual machine to be migrated based on the status information of the memory page, and sends the at least one target memory page to the target virtual machine. This realizes the reference to the status information of the memory page, and only sends the at least one target memory page determined based on the status information to the target virtual machine, without sending all memory pages of the virtual machine to be migrated to the target virtual machine. This effectively reduces the amount of memory data sent by the virtual machine during the migration process without reducing the IO performance of the direct device virtual machine, shortens the memory migration time, and improves the migration efficiency, thereby reducing the interference of dirty page records and network data transmission on the internal applications of the virtual machine.
[0033] In addition, in one embodiment, when determining at least one target memory page to be sent to the target virtual machine from all memory pages of the virtual machine to be migrated based on the status information, for any of the memory pages, based on the status information, when it is determined that the current state of the memory page is the occupied state, the memory page is determined as the target memory page.
[0034] Specifically, for any memory page of the virtual machine to be migrated, if the current state of the memory page is occupied, that is, the memory page is currently used by an application in the virtual machine, the memory page is determined as the target memory page and sent to the target virtual machine.
[0035] This ensures that only the memory pages currently in the occupied state are sent to the target virtual machine, avoiding the problem of too many migration pages and long migration time caused by sending all memory pages to the target virtual machine, reducing the number of migrated memory pages and shortening the migration time.
[0036] Furthermore, in another embodiment, for any of the memory pages, according to the state information, when it is determined that the current state of the memory page is the idle state, sending the memory page to the target virtual machine is prohibited.
[0037] For any memory page of the virtual machine to be migrated, if the current state of the memory page is idle, that is, the memory page is not currently used by an application in the virtual machine, the memory page will not be sent to the target virtual machine.
[0038] In this way, when migrating the memory pages of the migrating virtual machine, this embodiment detects the status information of the memory page currently needed to be sent (that is, detects whether the memory page is in use). If the status information of the memory page is occupied, the memory page is sent to the target virtual machine. If the status information of the memory page is idle, it is directly skipped and the memory page is not sent to the target virtual machine. This embodiment realizes that only the currently occupied memory pages are sent to the target virtual machine, and the currently unoccupied memory pages are not sent to the target virtual machine, which reduces the amount of data sent by the virtual machine to be migrated during the migration process, shortens the migration duration of the virtual machine to be migrated, and improves the migration experience of the virtual machine application.
[0039] In addition, this embodiment can determine the state information of the memory page of the virtual machine to be migrated through a message or shared memory mechanism, etc. This will be described in detail below.
[0040] Specifically, if a message mechanism is adopted, in one embodiment, when determining the status information of the memory page of the virtual machine to be migrated, a notification message sent by the virtual machine to be migrated may be received, wherein the notification message includes the status information.
[0041] Specifically, a memory allocation module can be configured in the virtual machine to be migrated, and a memory migration module can be configured in the virtual machine monitor. The virtual machine to be migrated obtains memory allocation status from the virtual machine memory allocation system through the memory allocation module, that is, obtains the status information of the memory page, and notifies the memory migration module of the virtual machine monitor of the status information of the memory page through a notification message, so that the memory migration module can determine which memory pages are the target memory pages to be migrated according to the status information of the memory page during migration, thereby saving migration time.
[0042] In this way, the virtual machine monitor receives the notification message sent by the virtual machine to be migrated, so that the state information of the memory page can be directly determined through the notification message.
[0043] In addition, if a shared memory mechanism is used, determining the state information of the memory page of the virtual machine to be migrated may include the following steps:
[0044] In a case where the memory page is mapped to a shared memory and the status information is indicated in the shared memory in the form of a bitmap, reading the bitmap; wherein each bit in the bitmap corresponds to a memory page, and identification information of each bit is used to indicate status information of the corresponding memory page;
[0045] The status information of the memory page is determined according to the identification information of the bit in the bitmap.
[0046] The above process is described in detail below.
[0047] Specifically, the virtual machine monitor can calculate the size of the shared memory space based on the memory starting physical address start_addr configured for the corresponding virtual machine and the maximum supported physical memory address max_addr. The calculation formula for the shared memory space size is:
[0048] (max_addr-start_addr) / (page_size*8); where page_size indicates the size of the memory page.
[0049] The virtual machine monitor applies for shared memory according to the space size of the shared memory calculated according to the above formula, performs a zeroing operation, and allocates it to the virtual machine to be migrated through the simulation device.
[0050] The memory allocation module in the virtual machine to be migrated maps the memory page to the shared memory. When a memory page in the virtual machine to be migrated is allocated for use or released, the virtual machine to be migrated can calculate the offset of the occupied bitmap in the shared memory according to the page frame number identifier pfn of the memory page through the memory allocation module. The offset can be expressed by the following formula: offset = (pfn*page_size-start_addr) / (page_size×8).
[0051] In addition, each offset in the bitmap corresponds to a bit, that is, each bit in the bitmap corresponds to a memory page, and the identification information of each bit is used to indicate the status information of the corresponding memory page. For example, as shown in Figure 2, the identification information may include 0 and 1, 1 indicates that the status information of the corresponding memory page is idle, and 0 indicates that the status information of the corresponding memory page is occupied. The virtual machine monitor can read the bitmap in the shared memory through the memory migration module, and determine the status information of the memory page based on the identification information of the bit in the bitmap; for example, if a bit is 0, it means that the memory page corresponding to the PFN is being used by the virtual machine, the current state is occupied, and copy migration is required during migration; on the contrary, if it is 1, it means that the memory page corresponding to the PFN is not being used by the virtual machine, the current state is idle, and no copy transmission is required during migration.
[0052] In this way, under the shared memory mechanism, by mapping the memory page to the shared memory and indicating the status information of the memory page in the form of a bitmap in the shared memory, the bitmap is read and the status information of the memory page is determined based on the identification information of the bits in the bitmap, thereby realizing the determination of the status information of the memory page without the need for message transmission.
[0053] In addition, in another embodiment, after sending the at least one target memory page to the target virtual machine, it also includes: when it is determined that all the memory of the virtual machine to be migrated has been sent, sending a page frame number identification list to the virtual machine monitor corresponding to the target virtual machine, wherein the page frame number identification list includes the page frame number identification of the memory page whose current state is idle, and the page frame number identification list is used to enable the virtual machine monitor of the target virtual machine to perform a memory clearing operation on the memory page whose current state is idle.
[0054] Specifically, if it is determined that all the memory of the virtual machine to be migrated has been sent, a page frame number identification list can be sent to the virtual machine monitor corresponding to the target virtual machine, so that the virtual machine monitor corresponding to the target virtual machine can perform a memory clearing operation on the memory pages in the page frame number identification list that are currently in an idle state according to the page frame number identification list, thereby ensuring the security of the memory information.
[0055] Specifically, in one embodiment, before sending the page frame number identification list to the virtual machine monitor corresponding to the target virtual machine, the following steps are also included: for any memory page, when the current state of the memory page is an idle state, the page frame number identification of the memory page is recorded in the page frame number identification list; when it is determined that the current state of the memory page is converted from the idle state to the occupied state, the recorded page frame number identification is cleared from the page frame number identification list.
[0056] Specifically, before sending the page frame number identification list to the virtual machine monitor corresponding to the target virtual machine, for any memory page, if the current state of the memory page is an idle state, the page frame number identification of the memory page is recorded in the page frame number identification list, and in the subsequent process, if the current state of the memory page is converted from an idle state to an occupied state, the recorded page frame number identification of the memory page is cleared from the page frame number identification list, thereby realizing real-time updating of the page frame number identification list, ensuring that the page frame number identifications recorded in the page frame number identification list are all page frame number identifications of memory pages in an idle state, and avoiding the problem of the virtual machine monitor of the target virtual machine mistakenly clearing occupied memory pages.
[0057] An embodiment of the present application is described below with reference to FIG3. In this embodiment, the migration method of a virtual machine includes the following steps: when the migration of the virtual machine to be migrated begins, the memory migration module of the virtual machine monitor corresponding to the virtual machine to be migrated starts dirty page tracking; when the transparent device virtual machine starts, the memory allocation module is loaded and initialized, and the allocation of all virtual machine memory pages is scanned, that is, the state information of the memory page is determined, and the memory migration module of the virtual machine monitor corresponding to the virtual machine to be migrated is notified according to the page frame number as the index; of course, it should be noted that the memory allocation module can be loaded before starting dirty page tracking, and does not have to be loaded when the virtual machine is started; the memory allocation module of the virtual machine monitor corresponding to the virtual machine to be migrated is loaded before starting dirty page tracking. When the virtual machine monitor sends memory copies through the memory migration module, it determines whether the memory page corresponding to the page frame number identifier to be sent is in an idle state (that is, whether it is allocated for use) based on the status information of the memory page obtained from the memory allocation module. If it is in an idle state, it will no longer be sent; if it is determined that the memory page corresponding to a certain page frame number identifier has not been sent, the page frame number identifier of the memory page is recorded in the page frame number identifier list. Of course, if the current state of the memory page is subsequently converted from an idle state to an occupied state, that is, the memory page is subsequently sent, the recorded page frame number identifier is cleared from the page frame number identifier list.
[0058] After the virtual machine monitor corresponding to the to-be-migrated virtual machine has sent all its memory pages via the memory migration module, it sends a list of page frame number identifiers to the virtual machine monitor corresponding to the target virtual machine. The virtual machine monitor corresponding to the target virtual machine then performs a zeroing operation on the memory pages in the list of page frame number identifiers. Of course, if the target virtual machine has already enabled the zeroing operation for memory pages when it was started, the virtual machine monitor corresponding to the target virtual machine no longer needs to perform a zeroing operation on the memory pages in the list of page frame number identifiers.
[0059] In this way, this embodiment effectively reduces the amount of memory data sent by the virtual machine during the migration process without reducing the IO performance of the virtual machine through the above steps, shortens the memory migration time, and thus reduces the interference caused by dirty page records and network data transmission to the internal applications of the virtual machine.
[0060] FIG4 shows a migration device for a virtual machine provided by an embodiment of the present application, comprising: a first determination module 401 for determining the state information of the memory page of the virtual machine to be migrated, wherein the state information includes an occupied state or an idle state; a second determination module 402 for determining at least one target memory page to be sent to the target virtual machine from all the memory pages of the virtual machine to be migrated according to the state information; a sending module 403 for sending the at least one target memory page to the target virtual machine
[0061] The virtual machine migration device provided in the embodiment of the present application can implement each process implemented in the method embodiment of Figure 1. To avoid repetition, it will not be described here.
[0062] It should be noted that the embodiments of the migration device for virtual machines in this specification and the embodiments of the migration method for virtual machines in this specification are based on the same inventive concept. Therefore, the specific implementation of the embodiments of the migration device for virtual machines can refer to the implementation of the corresponding embodiments of the migration method for virtual machines mentioned above, and the repeated parts will not be repeated.
[0063] The migration device of the virtual machine in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, etc., and the embodiment of the present application does not specifically limit it.
[0064] The virtual machine migration device in the embodiment of the present application can be a device having an operating system. The operating system can be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0065] Based on the same technical concept, an embodiment of the present application also provides an electronic device, which is used to execute the above method. Figure 5 is a structural diagram of an electronic device for implementing various embodiments of the present application. The electronic device may have relatively large differences due to different configurations or performances, and may include a processor (processor) 510, a communication interface (Communications Interface) 520, a memory (memory) 530 and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 complete communication with each other through the communication bus 540. The processor 510 can call a computer program stored on the memory 530 and can be run on the processor 510 to perform the following steps: determine the status information of the memory page of the virtual machine to be migrated, wherein the status information includes an occupied state or an idle state; according to the status information, determine at least one target memory page to be sent to the target virtual machine from all the memory pages of the virtual machine to be migrated; and send the at least one target memory page to the target virtual machine.
[0066] In one embodiment, based on the status information, at least one target memory page to be sent to the target virtual machine is determined from all memory pages of the virtual machine to be migrated, including: for any of the memory pages, based on the status information, when it is determined that the current state of the memory page is the occupied state, the memory page is determined as the target memory page.
[0067] In one embodiment, the method further includes: for any of the memory pages, according to the state information, when it is determined that the current state of the memory page is the idle state, prohibiting the memory page from being sent to the target virtual machine.
[0068] In one embodiment, determining the state information of the memory page of the virtual machine to be migrated includes:
[0069] A notification message sent by the virtual machine to be migrated is received, wherein the notification message includes the status information.
[0070] In one embodiment, determining the status information of the memory page of the virtual machine to be migrated includes: reading the bitmap when the memory page is mapped to the shared memory and the status information is indicated in the shared memory in the form of a bitmap; wherein each bit in the bitmap corresponds to a memory page, and the identification information of each bit is used to indicate the status information of the corresponding memory page; and determining the status information of the memory page according to the identification information of the bit in the bitmap.
[0071] In one embodiment, after sending the at least one target memory page to the target virtual machine, it also includes: when it is determined that all the memory of the virtual machine to be migrated has been sent, sending a page frame number identification list to the virtual machine monitor corresponding to the target virtual machine, wherein the page frame number identification list includes the page frame number identification of the memory page whose current state is idle, and the page frame number identification list is used to enable the virtual machine monitor of the target virtual machine to perform a memory clearing operation on the memory page whose current state is idle.
[0072] In one embodiment, before sending the page frame number identification list to the virtual machine monitor corresponding to the target virtual machine, it also includes: for any memory page, when the current state of the memory page is an idle state, recording the page frame number identification of the memory page in the page frame number identification list; when it is determined that the current state of the memory page is converted from the idle state to the occupied state, clearing the recorded page frame number identification from the page frame number identification list.
[0073] The specific execution steps can refer to the various steps of the above method embodiment, and can achieve the same technical effect. To avoid repetition, they will not be repeated here.
[0074] It should be noted that the electronic devices in the embodiments of the present application include: servers, terminals, or other devices other than terminals.
[0075] The above electronic device structure does not constitute a limitation of the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. For example, the input unit may include a graphics processing unit (GPU) and a microphone, and the display unit may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. to configure the display panel. The user input unit includes a touch panel and at least one of other input devices. The touch panel is also called a touch screen. Other input devices may include but are not limited to a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.
[0076] The memory can be used to store software programs and various data. The memory may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, applications or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory may include a volatile memory or a non-volatile memory, or the memory may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM) and direct rambus random access memory (DRRAM).
[0077] The processor may include one or more processing units; optionally, the processor may integrate an application processor and a modem processor, wherein the application processor primarily handles operations related to the operating system, user interface, and application programs, and the modem processor primarily processes wireless communication signals, such as a baseband processor. It is understood that the modem processor may not be integrated into the processor.
[0078] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned virtual machine migration method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0079] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer-readable storage medium, such as a computer read-only memory (ROM), random access memory (RAM), a magnetic disk, or an optical disk.
[0080] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned method embodiment and achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0081] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0082] It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element. In addition, it should be noted that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in the opposite order according to the functions involved. For example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0083] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0084] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.
Claims
1. A method for migrating a virtual machine, comprising: Determine state information of a memory page of the virtual machine to be migrated, wherein the state information includes an occupied state or an idle state; Determining, according to the state information, at least one target memory page to be sent to the target virtual machine from all memory pages of the virtual machine to be migrated; The at least one target memory page is sent to the target virtual machine.
2. The method for migrating a virtual machine according to claim 1, wherein: The step of determining at least one target memory page to be sent to the target virtual machine from all memory pages of the to-be-migrated virtual machine according to the state information includes: For any of the memory pages, according to the state information, when it is determined that the current state of the memory page is the occupied state, the memory page is determined as the target memory page.
3. The method for migrating a virtual machine according to claim 1 or 2, wherein: The method further comprises: For any of the memory pages, according to the state information, when it is determined that the current state of the memory page is the idle state, sending the memory page to the target virtual machine is prohibited.
4. The method for migrating a virtual machine according to claim 1, wherein: The step of determining the state information of the memory page of the virtual machine to be migrated includes: A notification message sent by the virtual machine to be migrated is received, wherein the notification message includes the state information.
5. The method for migrating a virtual machine according to claim 1, wherein: The step of determining the state information of the memory page of the virtual machine to be migrated includes: In the case where the memory page is mapped to a shared memory and the status information is indicated in the shared memory in the form of a bitmap, reading the bitmap; wherein each bit in the bitmap corresponds to a memory page, and the identification information of each bit is used to indicate the status information of the corresponding memory page; The status information of the memory page is determined according to the identification information of the bits in the bitmap.
6. The method for migrating a virtual machine according to claim 1, wherein: After sending the at least one target memory page to the target virtual machine, the method further includes: When it is determined that all the memory of the virtual machine to be migrated has been sent, a page frame number identification list is sent to the virtual machine monitor corresponding to the target virtual machine, wherein the page frame number identification list includes page frame number identifications of memory pages whose current state is idle, and the page frame number identification list is used to enable the virtual machine monitor of the target virtual machine to perform a memory clear operation on the memory pages whose current state is idle.
7. The method for migrating a virtual machine according to claim 6, wherein: Before sending the page frame number identification list to the virtual machine monitor corresponding to the target virtual machine, the method further includes: For any memory page, when the current state of the memory page is an idle state, recording the page frame number identifier of the memory page in the page frame number identifier list; When it is determined that the current state of the memory page is converted from the idle state to the occupied state, the recorded page frame number identifier is cleared from the page frame number identifier list.
8. A virtual machine migration device, comprising: A first determination module is used to determine the state information of the memory page of the virtual machine to be migrated, wherein the state information includes an occupied state or an idle state; A second determination module is used to determine at least one target memory page to be sent to a target virtual machine from all memory pages of the virtual machine to be migrated according to the state information; A sending module is used to send the at least one target memory page to the target virtual machine.
9. An electronic device comprising a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the virtual machine migration method as described in any one of claims 1 to 7.
10. A readable storage medium storing a program or an instruction, wherein the program or the instruction, when executed by a processor, implements the steps of the virtual machine migration method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Memory state migration method applicable to dynamic migration of virtual machine
CN104268003A
Virtual machine memory thermal migration optimization method and device
CN112286630A
Virtual machine migration method and device
CN112416507A
Virtual Machine Migration Acceleration With Page State Indicators
US20180060100A1
Cited By
Virtual machine migration method and system, computer equipment and storage medium
CN119806731A
