CN104750620B - A kind of internal memory migration method and device - Google Patents

A kind of internal memory migration method and device Download PDF

Info

Publication number
CN104750620B
CN104750620B CN201510196682.2A CN201510196682A CN104750620B CN 104750620 B CN104750620 B CN 104750620B CN 201510196682 A CN201510196682 A CN 201510196682A CN 104750620 B CN104750620 B CN 104750620B
Authority
CN
China
Prior art keywords
virtual machine
page
changed
internal memory
address
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201510196682.2A
Other languages
Chinese (zh)
Other versions
CN104750620A (en
Inventor
谭良
胡波
程虹锡
姚治菊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Normal University
Original Assignee
Sichuan Normal University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan Normal University filed Critical Sichuan Normal University
Priority to CN201510196682.2A priority Critical patent/CN104750620B/en
Publication of CN104750620A publication Critical patent/CN104750620A/en
Application granted granted Critical
Publication of CN104750620B publication Critical patent/CN104750620B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a kind of internal memory migration method and device, belongs to digital data processing field, and the internal memory migration method includes:The source virtual machine obtains the offset address length in the page each changed;Multiple offset address length are added up, obtain offset address total length;By the offset address total length divided by the address size of the page, result of calculation is labeled as containing dirty pages quantity;Judge whether the containing dirty pages quantity is less than the first threshold, if so, stopping changing the data in the internal memory, the data not being transmitted in the internal memory are sent to the purpose virtual machine.The embodiment of the present invention makes the time of every wheel iteration reduce rapidly, i.e. the agility of iteration is more and more faster, so as to which the size for the working set for often taking turns acquisition reduces rapidly, can be less than threshold values condition faster.

Description

A kind of internal memory migration method and device
Technical field
The present invention relates to digital data processing field, in particular to a kind of internal memory migration method and device.
Background technology
Dynamic migration of virtual machine refers to the triggering migration flow after source virtual machine reaches transition condition, passes through a series of steps Suddenly, source virtual machine by oneself all resource such as disk, CPU, internal memory etc. by network migration to purpose virtual machine, in transition process Ensure Consumer's Experience, that is, require that break period for being serviced on source virtual machine is short enough.
Traditional virtual machine Dram migration mechanism flow can be divided into five stages:The preparatory stage is migrated, locks mesh Mark the resource stage, the pre-copy stage, shut down the copy stage and terminate migration phase.
Wherein, the pre-copy stage is:After migration signal is initiated, the memory information of source domain starts by granularity of page It is collected and transmits, is transmitted all pages by caused new containing dirty pages, the first round between the method transmission two-wheeled of iteration To purpose domain, since taking turns second the internal memory that continuous two-wheeled is all updated be set to this wheel working set to be transmitted and by its It is transferred to aiming field.When a certain wheel transmission number of pages is less than threshold values or reaches the critical conditions such as maximum iteration, source domain quilt Delay machine, externally service is temporarily interrupted, and the pre-copy stage terminates, into the shutdown copy stage.
Inventor has found under study for action, in existing dynamic migration of virtual machine mechanism, when containing dirty pages (are changed in internal memory Page) it is several more, when the actual dirty data in containing dirty pages is less, existing migration mechanism judges that containing dirty pages number is more than threshold value, then needs again Iteration, make the convergence rate in the pre-copy stage excessively slow, so as to reduce transport efficiency.
The content of the invention
It is an object of the invention to provide a kind of internal memory migration method and device, to effectively improve existing virutal machine memory The transport efficiency of migration mechanism.
In a first aspect, a kind of internal memory migration method provided in an embodiment of the present invention, is migrated applied to virtual machine Dram System, the virtual machine Dram migratory system include source virtual machine and purpose virtual machine, in the internal memory of the source virtual machine Data be divided into the pages of multiple identical address length, the source virtual machine internal memory contains first threshold, and methods described includes:
The source virtual machine obtains the offset address length in the page each changed;
The source virtual machine adds up multiple offset address length, obtains offset address total length;
Result of calculation is labeled as by the source virtual machine by the offset address total length divided by the address size of the page Containing dirty pages quantity;
The source virtual machine judges whether the containing dirty pages quantity is less than the first threshold, if it is not, will each skew The identity letter for the data changed corresponding to the data and each offset address length changed corresponding to address size Breath is sent to the purpose virtual machine, if so, stopping changing the data in the internal memory, the institute not being transmitted in the internal memory There are data to send to the purpose virtual machine.
With reference in a first aspect, the embodiment of the present invention additionally provides the first possible embodiment of first aspect, wherein, institute State source virtual machine internal memory to contain Second Threshold and be preset with iterations, methods described also includes:
When the source virtual machine judges that the containing dirty pages quantity is more than the first threshold, by the page changed and the quilt The identity information of the page of modification is sent to the purpose virtual machine, and afterwards, the iterations is added one by the source virtual machine, institute State source virtual machine and judge whether the iterations is equal to the Second Threshold, if so, stop changing the data in the internal memory, The data not being transmitted in the internal memory are sent to the purpose virtual machine.
With reference to the first of first aspect or first aspect possible embodiment, the embodiment of the present invention additionally provides first party Second of possible embodiment in face, wherein, the source virtual machine is provided with multiple data structures;
The source virtual machine obtains the offset address length in the page each changed, including:
The source virtual machine obtains skew initial address and the skew end address for the page each changed, and is repaiied each The difference that the skew end address of the page changed subtracts each other to obtain with skew initial address is labeled as the skew in the page changed Address size;
The source virtual machine stores the identity information of the page changed, skew initial address and skew end address To the data structure, the identity information for establishing the page changed is corresponding with the identity information of the data structure Table;
It is described by the data changed corresponding to each offset address length and each offset address length The identity information of the corresponding data changed is sent to the purpose virtual machine, including:
By between the skew initial address in the page in each data structure body and the skew end address Data and the data structure send to the purpose virtual machine.
With reference to second of possible embodiment of first aspect, the embodiment of the present invention additionally provides the third of first aspect Possible embodiment, wherein, methods described also includes:
When the source virtual machine obtains skew initial address and the skew end address of the page each changed again, institute Source virtual machine is stated to judge to whether there is data structure corresponding with the identity information of the page changed in the corresponding table Identity information, if so, the skew initial address of corresponding with the identity information of the page the changed data structure of renewal With skew end address;If it is not, distributing new data structure for the identity information of the page changed, storage is described to be repaiied The skew initial address of the page changed and skew end address, update the corresponding table.
With reference in a first aspect, the embodiment of the present invention additionally provides the 4th kind of possible embodiment of first aspect, wherein, institute Stating method also includes:
When the source virtual machine judges that the containing dirty pages quantity is more than the first threshold, each offset address is being incited somebody to action The identity information hair for the data changed corresponding to the data and each offset address length changed corresponding to length When delivering to the purpose virtual machine, the source virtual machine obtains the offset address length in the page each changed again.
Second aspect, the embodiment of the present invention additionally provide a kind of internal memory migration device, moved applied to virtual machine Dram Shifting system, the virtual machine Dram migratory system includes being provided with the source virtual machine of the internal memory migration device and purpose is empty Plan machine, the data in the internal memory of the source virtual machine are divided into the page of multiple identical address length, the source virtual machine internal memory Contain first threshold, the internal memory migration device, including:
Acquiring unit, for obtaining the offset address length in the page each changed;
Summing elements, for multiple offset address length to be added up, obtain offset address total length;
Computing unit, for by the address size of the offset address total length divided by the page, result of calculation to be marked For containing dirty pages quantity;
First judging unit, judge whether the containing dirty pages quantity is less than first threshold for the source virtual machine Value, if it is not, the data changed corresponding to each offset address length and each offset address length are corresponding The identity informations of the data changed send to the purpose virtual machine, will if so, stop changing the data in the internal memory All data not being transmitted in the internal memory are sent to the purpose virtual machine.
With reference to second aspect, the embodiment of the present invention additionally provides the first possible embodiment of second aspect, wherein, institute State source virtual machine internal memory to contain Second Threshold and be preset with iterations, the internal memory migration device also includes:
Second judging unit, will be by for judging that the containing dirty pages quantity is more than the first threshold when the source virtual machine The identity information of the page of modification and the page changed is sent to the purpose virtual machine, and afterwards, the source virtual machine will The iterations adds one, and the source virtual machine judges whether the iterations is equal to the Second Threshold, if so, stopping repairing Change the data in the internal memory, the data not being transmitted in the internal memory are sent to the purpose virtual machine.
With reference to the first of second aspect or second aspect possible embodiment, the embodiment of the present invention additionally provides second party Second of possible embodiment in face, wherein, the source virtual machine is provided with multiple data structures;
The acquiring unit includes:
Address acquisition subelement, will for obtaining skew initial address and the skew end address of the page each changed The difference that the skew end address for the page each changed subtracts each other to obtain with skew initial address is labeled as the page changed Interior offset address length;
Storing sub-units, for by the identity information of the page changed, skew initial address and skew end address The data structure is stored, establishes the identity information of the page changed and the identity information of the data structure Corresponding table;
First judging unit includes:
Transmission sub-unit, for by the skew initial address in the page in each data structure body and it is described partially The data and the data structure moved between end address are sent to the purpose virtual machine.
With reference to second of possible embodiment of second aspect, the embodiment of the present invention additionally provides the third of second aspect Possible embodiment, wherein, the internal memory migration device also includes:
Allocation unit, for being obtained when the iteration unit performs the source virtual machine again in the page each changed During the step of offset address length, skew initial address and the skew end address of the page each changed are obtained again, it is described Source virtual machine is judged in the corresponding table with the presence or absence of data structure corresponding with the identity information of the page changed Identity information, if so, the skew initial address of corresponding with the identity information of the page the changed data structure of renewal and Offset end address;If it is not, distributing new data structure for the identity information of the page changed, storage is described to be changed Page skew initial address and skew end address, update the corresponding table.
With reference to second aspect, the embodiment of the present invention additionally provides the 4th kind of possible embodiment of second aspect, wherein, institute Stating the first judging unit also includes:
Subelement is collected, for when the source virtual machine judges that the containing dirty pages quantity is more than the first threshold, inciting somebody to action Changed corresponding to the data and each offset address length changed corresponding to each offset address length When the identity information of data is sent to the purpose virtual machine, the source virtual machine obtains inclined in the page each changed again Move address size.
In the embodiment of the present invention, obtain the offset address in the page each changed first, then changed all Page in offset address add up, obtain an offset address summation, then divided by page address size, it becomes possible to obtain skew ground The summation of location can be divided into how many page, therefore, the quantity for the page changed in internal memory can be calculated according to the method.
Therefore, as long as just being existed just using the data as a containing dirty pages number by modification with the data in the page of prior art In containing dirty pages quantity in internal memory plus one compare, the embodiment of the present invention by it is traditional using page be that working set narrows down to granularity as based on page Bias internal section is working set, that is, counts the offset address length in each containing dirty pages, then the offset address in all containing dirty pages is grown Degree is cumulative, then again divided by page length, the quantity of the containing dirty pages of a process method statistic provided by the invention is obtained, with tradition The containing dirty pages statistics that each will be changed after obtain containing dirty pages number and compare, the containing dirty pages quantity in the working set of the embodiment of the present invention must Less than the containing dirty pages quantity of conventional method so that the working set of the embodiment of the present invention can enter faster closer to first threshold Enter to shut down the copy stage.Therefore, the agility of iteration is added, accelerates the speed of iteration, convergence rate is improved, effectively carries The high transport efficiency of existing virutal machine memory migration mechanism.
In addition, the embodiment of the present invention, by the number between the skew initial address in the containing dirty pages of modification and skew end address According to sending to purpose virtual machine, compared with whole containing dirty pages are sent to purpose virtual machine by conventional method, the data of transmission are smaller, The time of transmission is effectively saved, effectively increases iterative rate.
Other features and advantages of the present invention will illustrate in subsequent specification, also, partly become from specification It is clear that or by implementing understanding of the embodiment of the present invention.The purpose of the present invention and other advantages can be by saying what is write Specifically noted structure is realized and obtained in bright book, claims and accompanying drawing.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to institute in embodiment The accompanying drawing needed to use is briefly described, it should be apparent that, drawings in the following description are only some implementations of the present invention Example, for those of ordinary skill in the art, on the premise of not paying creative work, can also be obtained according to these accompanying drawings Obtain other accompanying drawings.By the way that shown in accompanying drawing, above and other purpose of the invention, feature and advantage will become apparent from.In whole Identical reference instruction identical part in accompanying drawing.Deliberately accompanying drawing, emphasis are not drawn by actual size equal proportion scaling It is the purport for showing the present invention.
Fig. 1 shows a kind of method flow diagram of the embodiment of internal memory migration method provided in an embodiment of the present invention;
Fig. 2 shows the method flow diagram of the embodiment of another internal memory migration method provided in an embodiment of the present invention;
Fig. 3 shows a kind of module frame chart of the embodiment of internal memory migration device provided in an embodiment of the present invention;
Fig. 4 shows a kind of module frame chart of the embodiment of internal memory migration device provided in an embodiment of the present invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete Whole description, it is clear that described embodiment is only part of the embodiment of the present invention, rather than whole embodiments.It is based on Embodiment in the present invention, those of ordinary skill in the art are obtained every other under the premise of creative work is not made Embodiment, belong to the scope of protection of the invention.
Dynamic migration of virtual machine refers to the triggering migration flow after source virtual machine reaches transition condition, passes through a series of steps Suddenly, source virtual machine by oneself all resource such as disk, CPU, internal memory etc. by network migration to purpose virtual machine, in transition process Ensure Consumer's Experience, that is, require that break period for being serviced on source virtual machine is short enough.
Traditional virtual machine Dram migration mechanism flow can be divided into five stages:The preparatory stage is migrated, locks mesh Mark the resource stage, the pre-copy stage, shut down the copy stage and terminate migration phase.
Wherein, the pre-copy stage is:After migration signal is initiated, the memory information of source domain starts by granularity of page It is collected and transmits, is transmitted all pages by caused new containing dirty pages, the first round between the method transmission two-wheeled of iteration To purpose domain, since taking turns second the internal memory that continuous two-wheeled is all updated be set to this wheel working set to be transmitted and by its It is transferred to aiming field.When a certain wheel transmission number of pages is less than threshold values or reaches the critical conditions such as maximum iteration, source domain quilt Delay machine, externally service is temporarily interrupted, and the pre-copy stage terminates, into the shutdown copy stage.
Inventor has found under study for action, in existing dynamic migration of virtual machine mechanism, when containing dirty pages (are changed in internal memory Page) it is several more, when the actual dirty data in containing dirty pages is less, existing migration mechanism judges that containing dirty pages number is more than threshold value, then needs again Iteration, make the convergence rate in the pre-copy stage excessively slow, so as to reduce transport efficiency.
To solve disadvantages mentioned above, this is the embodiments of the invention provide a kind of internal memory migration method, as shown in figure 1, the side Method is applied to virtual machine Dram migratory system, and the virtual machine Dram migratory system includes source virtual machine and purpose is empty Plan machine, the data in the internal memory of the source virtual machine are divided into the page of multiple identical address length, the source virtual machine internal memory First threshold is contained, methods described includes:
S11:Obtain the offset address length in the page each changed;
Corresponding to the data and the data changed changed in the page that the source virtual machine record is changed partially Shifting address, the offset address of all data changed in the obtained page changed, with taking the skew of maximum The difference of the offset address of location and minimum, obtains offset address length.
S12:Obtain offset address total length;
The source virtual machine will be added by the offset address in internal memory in all pages changed, and the offset address asked is total Length.
S13:Obtain containing dirty pages quantity;
Result of calculation is labeled as by the source virtual machine by the offset address total length divided by the address size of the page Containing dirty pages quantity.Because the address size of the page is fixed, although the first address of each page differs, due to each Page size is identical, for example is 4KB or 8KB, then the address size of each page is identical, by offset address total length divided by page Address size, the number for the page that can be divided as standard using the address size of the page with regard to the offset address total length can be obtained Amount.
S14:Judge whether containing dirty pages quantity is less than first threshold;
The source virtual machine compares the containing dirty pages quantity with the first threshold, if comparison result is the containing dirty pages quantity More than the first threshold, then S15 is performed.
S15:By the data changed corresponding to each offset address length and each offset address length The identity information of the corresponding data changed is sent to the purpose virtual machine;
The source virtual machine sends the page changed to the purpose virtual machine, and trigger the purpose virtual machine according to The identity information of the page finds the page in the purpose virtual machine, and with the page changed of purpose virtual machine transmission Content is according to the information in the page changed in the purpose virtual machine.
Or can also be by between the skew initial address in each page changed and the skew end address Data and the identity information of the page changed send to purpose virtual machine.
When performing S14 steps, the source virtual machine compares the containing dirty pages quantity with the first threshold, if comparing knot Fruit is that the containing dirty pages quantity is less than the first threshold, then performs S16.
S16:Shut down copy;
The source virtual machine stops changing the data in the internal memory, and all data not being transmitted in the internal memory are sent out Deliver to the purpose virtual machine.
In the embodiment of the present invention, described all data are specifically the remaining containing dirty pages in internal memory, i.e., are received including current iteration The containing dirty pages of collection, and in iterative process is performed, caused containing dirty pages in internal memory.
Now, the source virtual machine, which enters, shuts down the copy stage, the page that internal memory is not always transmitted and CPU state information hair Deliver to the purpose virtual machine.
In addition, the source virtual machine internal memory contains Second Threshold and is preset with iterations, methods described also includes:
When the source virtual machine judges that the containing dirty pages quantity is less than the first threshold, by the page changed and the quilt The identity information of the page of modification is sent to the purpose virtual machine, and afterwards, the iterations is added one by the source virtual machine, institute State source virtual machine and judge whether the iterations is equal to the Second Threshold, if so, stop changing the data in the internal memory, The data not being transmitted in the internal memory are sent to the purpose virtual machine.
In the embodiment of the present invention, obtain the offset address in the page each changed first, then changed all Page in offset address add up, obtain an offset address summation, then divided by page address size, it becomes possible to obtain skew ground The summation of location can be divided into how many page, therefore, the quantity for the page changed in internal memory can be calculated according to the method.
Therefore, as long as just being existed just using the data as a containing dirty pages number by modification with the data in the page of prior art In containing dirty pages quantity in internal memory plus one compare, the embodiment of the present invention by it is traditional using page be that working set narrows down to granularity as based on page Bias internal section is working set, adds the agility of iteration, accelerates the speed of iteration, improve convergence rate, effectively improve The transport efficiency of existing virutal machine memory migration mechanism.
As shown in Fig. 2 the embodiment of the present invention additionally provides a kind of internal memory migration method, methods described is applied to virtual motor-driven State internal memory migration system, the virtual machine Dram migratory system include source virtual machine and purpose virtual machine, and the source is virtual Data in the internal memory of machine are divided into the page of multiple identical address length, and the source virtual machine internal memory contains first threshold, institute The method of stating includes:
S21:Obtain the offset address length in the page each changed;
The source virtual machine obtains skew initial address and the skew end address for the page each changed, and is repaiied each The difference that the skew end address of the page changed subtracts each other to obtain with skew initial address is labeled as the skew in the page changed Address size;
S22:The number is arrived into the identity information of the page changed, skew initial address and the storage of skew end address According to structure;
The source virtual machine stores the identity information of the page changed, skew initial address and skew end address To the data structure, the identity information for establishing the page changed is corresponding with the identity information of the data structure Table.
In the embodiment of the present invention, in order to obtain working set, it is necessary to start after source virtual machine initiates migration signal to each The page bias internal address realm changed keeps a record, and sets data structure, the skew changed in each containing dirty pages of definition record The data structure of address realm, define the page number page_num of the data structure, skew initial address start_ Offset, offset end address end_offset, offset address length data_size and the pointer for pointing to next structure page_next。
S23:Obtain offset address total length;
The source virtual machine adds up multiple offset address length, obtains offset address total length.
S24:Obtain containing dirty pages quantity;
Result of calculation is labeled as by the source virtual machine by the offset address total length divided by the address size of the page Containing dirty pages quantity.Because the address size of the page is fixed, although the first address of each page differs, due to each Page size is identical, for example is 4KB or 8KB, then the address size of each page is identical, by offset address total length divided by page Address size, the number for the page that can be divided as standard using the address size of the page with regard to the offset address total length can be obtained Amount.
S25:Judge whether containing dirty pages quantity is less than first threshold;
The source virtual machine compares the containing dirty pages quantity with the first threshold, if comparison result is the containing dirty pages quantity More than the first threshold, then S26 is performed.
S26:By the start offset address of the page changed and the data terminated between offset address and institute Data structure is stated to send to the purpose virtual machine;
The identity information of each containing dirty pages, that is, page number, therefore, the embodiment of the present invention are stored with the data structure In, the source virtual machine sends the start offset address of the page changed and the data terminated between offset address To the purpose virtual machine, the purpose virtual machine correspondingly changes the starting partially according to the page number of page in the data structure Move address and the data terminated between offset address.
When performing S25 steps, the source virtual machine compares the containing dirty pages quantity with the first threshold, if comparing knot Fruit is that the containing dirty pages quantity is less than the first threshold, then performs S27.
S27:Shut down copy;
The source virtual machine stops changing the data in the internal memory, and all containing dirty pages not being transmitted in the internal memory are sent out Deliver to the purpose virtual machine.
Now, the source virtual machine, which enters, shuts down the copy stage, the page that internal memory is not always transmitted and CPU state information hair Deliver to the purpose virtual machine.
In addition, the source virtual machine internal memory contains Second Threshold and is preset with iterations, methods described also includes:
When the source virtual machine judges that the containing dirty pages quantity is more than the first threshold, by the page changed and the quilt The identity information of the page of modification is sent to the purpose virtual machine, and afterwards, the iterations is added one by the source virtual machine, institute State source virtual machine and judge whether the iterations is equal to the Second Threshold, if so, stop changing the data in the internal memory, The data not being transmitted in the internal memory are sent to the purpose virtual machine.
In the embodiment of the present invention, obtain the offset address in the page each changed first, then changed all Page in offset address add up, obtain an offset address summation, then divided by page address size, it becomes possible to obtain skew ground The summation of location can be divided into how many page, therefore, the quantity for the page changed in internal memory can be calculated according to the method.
Therefore, as long as just being existed just using the data as a containing dirty pages number by modification with the data in the page of prior art In containing dirty pages quantity in internal memory plus one compare, the embodiment of the present invention by it is traditional using page be that working set narrows down to granularity as based on page Bias internal section is working set, adds the agility of iteration, accelerates the speed of iteration, improve convergence rate, effectively improve The transport efficiency of existing virutal machine memory migration mechanism.
In addition, when the source virtual machine sends the identity information of the page changed and the page changed to described After purpose virtual machine, methods described also includes:
The source virtual machine returns to the offset address length performed again in the page that the source virtual machine acquisition is each changed The step of spending, stop changing the data in the internal memory until performing, the data not being transmitted in the internal memory are sent to institute The step of stating purpose virtual machine.
When the source virtual machine returns the source virtual machine is performed again obtain offset address in the page each changed During the step of length, methods described also includes:
The source virtual machine obtains skew initial address and the skew end address of the page each changed, the source again Virtual machine judges to whether there is the body of data structure corresponding with the identity information of the page changed in the corresponding table Part information, if so, the skew initial address of renewal data structure corresponding with the identity information of the page changed and inclined Move end address;If it is not, be that the identity information of the page changed distributes new data structure, storage is described to be changed The skew initial address of page and skew end address, update the corresponding table.
It is furthermore each described inclined inciting somebody to action when the source virtual machine judges that the containing dirty pages quantity is more than the first threshold Move the identity for the data changed corresponding to the data changed corresponding to address size and each offset address length When information is sent to the purpose virtual machine, the source virtual machine obtains the offset address length in the page each changed again Degree.
Therefore, the embodiment of the present invention is in order to reduce storage allocation operation as far as possible, to improve the efficiency of collection work collection, This paper algorithm preserves data structure using three chained lists, and chained list next collects the working set of next round, chained list current The pending working set of epicycle is preserved, the idle structure of distribution before chained list free is preserved.Record epicycle modification internal memory operation Data structure can all be added to the table tails of next chained lists, when needing to add new structure in next chained lists, can arrive first Taken in free chained lists, if there is no idle structure in free, just distribute new structure into next, when beginning epicycle iteration When, the data structure chain that current chained lists point to next obtains epicycle working set, and then next is pointed to empty, to collect next round Working set, the structure in current can be added to free table tail after being read, as idle structure by next round Iteration uses.
Because the operation of process has locality of reference feature, in order to not allow the too many space of data structure committed memory, protect Demonstrate,prove each page and only correspond to a data structure to keep a record, herein by the offset address scope of modification data in record containing dirty pages When often take turns in a refresh page start offset address and terminate offset address.
After the pre-copy stage starts, the first round transmit all internal memories and starting collect next round working set (time is grown, Containing dirty pages accumulation is more), before page is changed, traversal next chained lists determine whether the page data structure has been present, if not having The page_num for finding matching is just recorded with a new structure and is inserted into next chained list corresponding positions by page_num sequences Put to improve next matching efficiency, otherwise, illustrate there has been the page structure body in next chained lists, it is only necessary to directly update this page Data structure, update start_ with the value if the start offset address for the address realm changed is less than start_offset Offset, if the termination offset address for the address realm changed is more than end_offset, end_ is updated in the same way Offset fields, then update data_size and subtract start_offset equal to end_offset.
Defined variable sum, come the data_size fields of each data structure in the current chained lists that add up, so as to obtain Offset address total length, so as to obtain the dirty data size in units of byte, and often read a data structure just from Just it is deleted from current, is then added in free chained lists, ensures that next chained lists obtain and do not have to redistribute in time Influence efficiency.
Therefore, the embodiment of the present invention, in order to ensure the corresponding page of each data structure, I am simply to influenceing start offset The renewal operation of address and termination offset address is modified.It is no more than number of pages so as to ensure that data structure number is maximum.In order that Faster, chained list uses to be sorted by page number, and guarantee is quickly searched and changes data structure for renewal operation that must be to working set.In order to not Lost time on data structure is created, in whole iterative process, created data structure does not discharge, and is placed on a free time In chained list, the first request for data structure in idle chained list of later iteration, new data structure is just created if sky, so Improve collection efficiency.
In addition, the embodiment of the present invention only transmits start offset address and terminates the data between offset address, so can be with Network latency is greatly shortened, accelerates iteration.
For example, it is 300 milliseconds to access internal memory time interval, the gross migration time of existing pre-copy algorithm is 111.332 Second, iterations is 27 times, and the transit time required for the internal memory migration method of the embodiment of the present invention is 53.409, iterations It is 4 times.
Therefore, the embodiment of the present invention is by the working set estimation algorithm to the pre-copy stage in legacy migration mechanism flow, Pre-copy stage and shutting down transmits containing dirty pages data structure in the copy stage is improved, and introduces the inclined of dirty data in record page Move address realm and be used as working set, with the working set of epicycle record come compared with threshold values before each iteration terminates, because entering Cheng Zhihang has enough small of locality characteristic and working set granularity so that the chance that working set is less than threshold values is larger, and the present invention is real Apply the chance for catching iteration to terminate that example can be more sensitive.And because the total data of every wheel network transmission is a little relative to page granularity More, the embodiment of the present invention makes the time of every wheel iteration reduce rapidly, i.e. the agility of iteration is more and more faster, so as to often wheel acquisition The size of working set reduces rapidly, can be less than threshold values condition faster.Based on both the above factor, the embodiment of the present invention Iteration can be jumped out faster so that migration is substantially shortened total time, shows efficient migration performance.
A kind of internal memory migration device as shown in Figure 3, it is described virtual motor-driven applied to virtual machine Dram migratory system State internal memory migration system includes being provided with the source virtual machine and purpose virtual machine of the internal memory migration device, the source virtual machine Data in internal memory are divided into the page of multiple identical address length, and the source virtual machine internal memory contains first threshold, described interior Moving apparatus is deposited, including:
Acquiring unit 301, for obtaining the offset address length in the page each changed;
Summing elements 302, for multiple offset address length to be added up, obtain offset address total length;
Computing unit 303, for by the address size of the offset address total length divided by the page, by result of calculation mark It is designated as containing dirty pages quantity;
First judging unit 304, judge whether the containing dirty pages quantity is less than described first for the source virtual machine Threshold value, if it is not, by the data changed corresponding to each offset address length and each offset address length pair The identity information for the data changed answered is sent to the purpose virtual machine, if so, stop changing the data in the internal memory, All data not being transmitted in the internal memory are sent to the purpose virtual machine.
In addition, the source virtual machine internal memory contains Second Threshold and is preset with iterations, the internal memory migration device is also Including:
Second judging unit, will be by for judging that the containing dirty pages quantity is more than the first threshold when the source virtual machine The identity information of the page of modification and the page changed is sent to the purpose virtual machine, and afterwards, the source virtual machine will The iterations adds one, and the source virtual machine judges whether the iterations is equal to the Second Threshold, if so, stopping repairing Change the data in the internal memory, the data not being transmitted in the internal memory are sent to the purpose virtual machine.
In addition, the source virtual machine is provided with multiple data structures;
The acquiring unit includes:
Address acquisition subelement, will for obtaining skew initial address and the skew end address of the page each changed The difference that the skew end address for the page each changed subtracts each other to obtain with skew initial address is labeled as the page changed Interior offset address length;
Storing sub-units, for by the identity information of the page changed, skew initial address and skew end address The data structure is stored, establishes the identity information of the page changed and the identity information of the data structure Corresponding table;
First judging unit includes:
Transmission sub-unit, for by the skew initial address in the page in each data structure body and it is described partially The data and the data structure moved between end address are sent to the purpose virtual machine.
In addition, the internal memory migration device also includes:
Allocation unit, for being obtained when the iteration unit performs the source virtual machine again in the page each changed During the step of offset address length, skew initial address and the skew end address of the page each changed are obtained again, it is described Source virtual machine is judged in the corresponding table with the presence or absence of data structure corresponding with the identity information of the page changed Identity information, if so, the skew initial address of corresponding with the identity information of the page the changed data structure of renewal and Offset end address;If it is not, distributing new data structure for the identity information of the page changed, storage is described to be changed Page skew initial address and skew end address, update the corresponding table.
Furthermore first judging unit also includes:
Subelement is collected, for when the source virtual machine judges that the containing dirty pages quantity is more than the first threshold, inciting somebody to action Changed corresponding to the data and each offset address length changed corresponding to each offset address length When the identity information of data is sent to the purpose virtual machine, the source virtual machine obtains inclined in the page each changed again Move address size.
It is apparent to those skilled in the art that for convenience and simplicity of description, the dress of above-mentioned Fig. 3 descriptions The specific work process with unit is put, the corresponding process in preceding method embodiment is may be referred to, will not be repeated here.
Referring to Fig. 4, the embodiment of the present invention also provides a kind of internal memory migration device 400, including:Processor 404, memory 401, bus 402 and communication interface 403, the processor 404, communication interface 403 and memory 401 are connected by bus 402; Processor 404 is used to perform the executable module stored in memory 401, such as computer program.
Wherein, memory 401 may include high-speed random access memory (RAM:Random Access Memory), Non-labile memory (non-volatile memory), for example, at least a magnetic disk storage may also be included.By extremely A few communication interface 403 (can be wired or wireless) is realized logical between the system network element and at least one other network element Letter connection, can use internet, wide area network, LAN, Metropolitan Area Network (MAN) etc..
Bus 402 can be isa bus, pci bus or eisa bus etc..The bus can be divided into address bus, number According to bus, controlling bus etc..For ease of representing, only represented in Fig. 4 with a four-headed arrow, it is not intended that an only bus Or a type of bus.
Wherein, memory 401 is used for storage program, and the processor 404 performs the journey after execute instruction is received Sequence, the method performed by the device for the flow definition that foregoing any embodiment of the embodiment of the present invention discloses can apply to processor In 404, or realized by processor 404.
Processor 404 is probably a kind of IC chip, has the disposal ability of signal.It is above-mentioned in implementation process Each step of method can be completed by the integrated logic circuit of the hardware in processor 404 or the instruction of software form.On The processor 404 stated can be general processor, including central processing unit (Central Processing Unit, referred to as CPU), network processing unit (Network Processor, abbreviation NP) etc.;It can also be digital signal processor (DSP), special Integrated circuit (ASIC), ready-made programmable gate array (FPGA) either other PLDs, discrete gate or transistor Logical device, discrete hardware components.It can realize or perform disclosed each method, step and the logic in the embodiment of the present invention Block diagram.General processor can be microprocessor or the processor can also be any conventional processor etc..With reference to this hair The step of method disclosed in bright embodiment, can be embodied directly in hardware decoding processor and perform completion, or be handled with decoding Hardware and software module combination in device perform completion.Software module can be located at random access memory, flash memory, read-only storage, In the ripe storage medium in this area such as programmable read only memory or electrically erasable programmable memory, register.This is deposited Storage media is located at memory 401, and processor 404 reads the information in memory 401, and the step of the above method is completed with reference to its hardware Suddenly.
In addition, the flow chart and block diagram in accompanying drawing show system, method and the meter of multiple embodiments according to the present invention Architectural framework in the cards, function and the operation of calculation machine program product.At this point, each square frame in flow chart or block diagram Can represent a part for a module, program segment or code, the part of the module, program segment or code include one or Multiple executable instructions for being used to realize defined logic function.It should also be noted that some as replace realization in, square frame Middle marked function can also be with different from the order marked in accompanying drawing generation.For example, two continuous square frames are actually It can perform substantially in parallel, they can also be performed in the opposite order sometimes, and this is depending on involved function.Also to note Meaning, the combination of each square frame and block diagram in block diagram and/or flow chart and/or the square frame in flow chart can be with holding Function as defined in row or the special hardware based system of action are realized, or can use specialized hardware and computer instruction Combination realize.
A kind of computer program product of information interacting method of progress that the embodiment of the present invention is provided, including store journey The computer-readable recording medium of sequence code, the instruction that described program code includes can be used for performing institute in previous methods embodiment The method stated, specific implementation can be found in embodiment of the method, will not be repeated here.
It is apparent to those skilled in the art that for convenience and simplicity of description, the system of foregoing description, The specific work process of device and unit, the corresponding process in preceding method embodiment is may be referred to, will not be repeated here.
In several embodiments provided herein, it should be understood that disclosed systems, devices and methods, can be with Realize by another way.Device embodiment described above is only schematical, for example, the division of the unit, Only a kind of division of logic function, can there is other dividing mode when actually realizing, in another example, multiple units or component can To combine or be desirably integrated into another system, or some features can be ignored, or not perform.It is another, it is shown or beg for The mutual coupling of opinion or direct-coupling or communication connection can be by some communication interfaces, device or unit it is indirect Coupling or communication connection, can be electrical, mechanical or other forms.
The unit illustrated as separating component can be or may not be physically separate, show as unit The part shown can be or may not be physical location, you can with positioned at a place, or can also be distributed to multiple On NE.Some or all of unit therein can be selected to realize the mesh of this embodiment scheme according to the actual needs 's.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, can also That unit is individually physically present, can also two or more units it is integrated in a unit.
If the function is realized in the form of SFU software functional unit and is used as independent production marketing or in use, can be with It is stored in a computer read/write memory medium.Based on such understanding, technical scheme is substantially in other words The part to be contributed to prior art or the part of the technical scheme can be embodied in the form of software product, the meter Calculation machine software product is stored in a storage medium, including some instructions are causing a computer equipment (can be People's computer, server, or network equipment etc.) perform all or part of step of each embodiment methods described of the present invention. And foregoing storage medium includes:USB flash disk, mobile hard disk, read-only storage (ROM, Read-Only Memory), arbitrary access are deposited Reservoir (RAM, Random Access Memory), magnetic disc or CD etc. are various can be with the medium of store program codes.
It should be noted that herein, such as first and second or the like relational terms are used merely to a reality Body or operation make a distinction with another entity or operation, and not necessarily require or imply and deposited between these entities or operation In any this actual relation or order.Moreover, term " comprising ", "comprising" or its any other variant are intended to Nonexcludability includes, so that process, method, article or equipment including a series of elements not only will including those Element, but also the other element including being not expressly set out, or it is this process, method, article or equipment also to include Intrinsic key element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that Other identical element also be present in process, method, article or equipment including the key element.
The foregoing is only a specific embodiment of the invention, but protection scope of the present invention is not limited thereto, any Those familiar with the art the invention discloses technical scope in, change or replacement can be readily occurred in, should all be contained Cover within protection scope of the present invention.Therefore, protection scope of the present invention described should be defined by scope of the claims.

Claims (10)

  1. A kind of 1. internal memory migration method, it is characterised in that applied to virtual machine Dram migratory system, the virtual machine dynamic Internal memory migration system includes source virtual machine and purpose virtual machine, and the data in the internal memory of the source virtual machine are divided into multiple phases With the page of address size, the source virtual machine internal memory contains first threshold, and methods described includes:
    The source virtual machine obtains the offset address length in the page each changed;
    The source virtual machine adds up multiple offset address length, obtains offset address total length;
    Result of calculation is labeled as containing dirty pages by the offset address total length divided by the address size of the page by the source virtual machine Quantity;
    The source virtual machine judges whether the containing dirty pages quantity is less than the first threshold, if it is not, will each offset address The modification corresponding to data changed corresponding to the data and each offset address length changed corresponding to length The identity information of page is sent to the purpose virtual machine, if so, stop changing the data in the internal memory, by the internal memory not All data being transmitted are sent to the purpose virtual machine.
  2. 2. internal memory migration method according to claim 1, it is characterised in that the source virtual machine internal memory contains Second Threshold Be preset with iterations, methods described also includes:
    When the source virtual machine judges that the containing dirty pages quantity is more than the first threshold, by the page changed and described changed Data corresponding to the identity information of modification page send to the purpose virtual machine, afterwards, the source virtual machine will it is described repeatedly Generation number adds one, and the source virtual machine judges whether the iterations is equal to the Second Threshold, if so, stopping described in modification Data in internal memory, the data not being transmitted in the internal memory are sent to the purpose virtual machine.
  3. 3. internal memory migration method according to claim 1 or 2, it is characterised in that the source virtual machine is provided with multiple data Structure;
    The source virtual machine obtains the offset address length in the page each changed, including:
    The source virtual machine obtains skew initial address and the skew end address for the page each changed, and is changed each The difference that the skew end address of page subtracts each other to obtain with skew initial address is labeled as the offset address in the page changed Length;
    The source virtual machine stores the identity information of the page changed, skew initial address and skew end address to institute Data structure is stated, establishes the corresponding table of the identity information of the page changed and the identity information of the data structure;
    It is described that the data changed corresponding to each offset address length and each offset address length are corresponding The identity informations of the data changed send to the purpose virtual machine, including:
    By the number between the skew initial address in the page in each data structure body and the skew end address According to this and the data structure is sent to the purpose virtual machine.
  4. 4. internal memory migration method according to claim 3, it is characterised in that methods described also includes:
    When the source virtual machine obtains skew initial address and the skew end address of the page each changed again, the source Virtual machine judges to whether there is the body of data structure corresponding with the identity information of the page changed in the corresponding table Part information, if so, the skew initial address of renewal data structure corresponding with the identity information of the page changed and inclined Move end address;If it is not, be that the identity information of the page changed distributes new data structure, storage is described to be changed The skew initial address of page and skew end address, update the corresponding table.
  5. 5. internal memory migration method according to claim 1, it is characterised in that methods described also includes:
    When the source virtual machine judges that the containing dirty pages quantity is more than the first threshold, each offset address length is being incited somebody to action The identity information for the data changed corresponding to the corresponding data changed and each offset address length send to During the purpose virtual machine, the source virtual machine obtains the offset address length in the page each changed again.
  6. A kind of 6. internal memory migration device, it is characterised in that applied to virtual machine Dram migratory system, the virtual machine dynamic Internal memory migration system includes being provided with the source virtual machine and purpose virtual machine of the internal memory migration device, the source virtual machine it is interior Data in depositing are divided into the page of multiple identical address length, and the source virtual machine internal memory contains first threshold, the internal memory Moving apparatus, including:
    Acquiring unit, for obtaining the offset address length in the page each changed;
    Summing elements, for multiple offset address length to be added up, obtain offset address total length;
    Computing unit, for by the address size of the offset address total length divided by the page, by result of calculation labeled as dirty Number of pages;
    First judging unit, judge whether the containing dirty pages quantity is less than the first threshold for the source virtual machine, if It is no, it will be repaiied corresponding to the data changed corresponding to each offset address length and each offset address length The identity information of modification page corresponding to the data changed is sent to the purpose virtual machine, if so, stopping changing in the internal memory Data, all data not being transmitted in the internal memory are sent to the purpose virtual machine.
  7. 7. internal memory migration device according to claim 6, it is characterised in that the source virtual machine internal memory contains Second Threshold Be preset with iterations, the internal memory migration device also includes:
    Second judging unit, for judging that the containing dirty pages quantity is more than the first threshold when the source virtual machine, it will be changed Page and the data changed corresponding to the identity information of modification page send to the purpose virtual machine, afterwards, institute State source virtual machine and the iterations is added one, the source virtual machine judges whether the iterations is equal to second threshold Value, if so, stopping changing the data in the internal memory, the data not being transmitted in the internal memory are sent virtual to the purpose Machine.
  8. 8. the internal memory migration device according to claim 6 or 7, it is characterised in that the source virtual machine is provided with multiple data Structure;
    The acquiring unit includes:
    Address acquisition subelement, will be each for obtaining skew initial address and the skew end address of the page each changed The difference that the skew end address for the page changed subtracts each other to obtain with skew initial address is labeled as in the page changed Offset address length;
    Storing sub-units, for the identity information of the page changed, skew initial address and skew end address to be stored To the data structure, the identity information for establishing the page changed is corresponding with the identity information of the data structure Table;
    First judging unit includes:
    Transmission sub-unit, for the skew initial address in the page in each data structure body and the skew to be tied Data and the data structure between beam address are sent to the purpose virtual machine.
  9. 9. internal memory migration device according to claim 8, it is characterised in that the internal memory migration device also includes:
    Allocation unit, for obtaining offset address in the page each changed when iteration unit performs the source virtual machine again During the step of length, skew initial address and the skew end address of the page each changed, the source virtual machine are obtained again Judge in the corresponding table whether there is data structure corresponding with the identity information of the page changed identity information, If so, the skew initial address of renewal data structure corresponding with the identity information of the page changed and skew terminate ground Location;If it is not, distributing new data structure for the identity information of the page changed, the skew of the page changed is stored Initial address and skew end address, update the corresponding table.
  10. 10. internal memory migration device according to claim 6, it is characterised in that first judging unit also includes:
    Subelement is collected, for when the source virtual machine judges that the containing dirty pages quantity is more than the first threshold, inciting somebody to action each The data changed corresponding to the data and each offset address length changed corresponding to the offset address length Identity information when sending to the purpose virtual machine, the source virtual machine with obtaining the skew in the page each changed again Location length.
CN201510196682.2A 2015-04-23 2015-04-23 A kind of internal memory migration method and device Expired - Fee Related CN104750620B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510196682.2A CN104750620B (en) 2015-04-23 2015-04-23 A kind of internal memory migration method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510196682.2A CN104750620B (en) 2015-04-23 2015-04-23 A kind of internal memory migration method and device

Publications (2)

Publication Number Publication Date
CN104750620A CN104750620A (en) 2015-07-01
CN104750620B true CN104750620B (en) 2018-02-16

Family

ID=53590346

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510196682.2A Expired - Fee Related CN104750620B (en) 2015-04-23 2015-04-23 A kind of internal memory migration method and device

Country Status (1)

Country Link
CN (1) CN104750620B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108121589A (en) * 2016-11-30 2018-06-05 中标软件有限公司 A kind of online migration automatic convergent method of virtual machine
CN107092563B (en) * 2017-04-20 2021-02-26 新华三信息技术有限公司 Garbage recovery method and device
CN107392011B (en) * 2017-08-22 2019-11-22 海光信息技术有限公司 A kind of page transfer method
CN110134490B (en) * 2018-02-08 2023-12-29 中兴通讯股份有限公司 Virtual machine dynamic migration method, device and storage medium
CN110187968B (en) * 2019-05-22 2023-03-14 上海交通大学 Graph data processing acceleration method in heterogeneous computing environment
CN111078407B (en) * 2019-12-10 2022-11-01 Oppo(重庆)智能科技有限公司 Memory management method and device, storage medium and electronic equipment
CN111290830B (en) * 2020-01-15 2023-10-20 海光信息技术股份有限公司 Virtual machine migration method, processor and electronic equipment
CN113254161B (en) * 2021-06-29 2021-10-26 飞腾信息技术有限公司 CPU-based rapid virtual machine live migration method

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103414769A (en) * 2013-07-31 2013-11-27 华为技术有限公司 Virtual machine thermal migration method and physical machine
CN103955399A (en) * 2014-04-30 2014-07-30 华为技术有限公司 Migrating method and device for virtual machine, as well as physical host

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103414769A (en) * 2013-07-31 2013-11-27 华为技术有限公司 Virtual machine thermal migration method and physical machine
CN103955399A (en) * 2014-04-30 2014-07-30 华为技术有限公司 Migrating method and device for virtual machine, as well as physical host

Also Published As

Publication number Publication date
CN104750620A (en) 2015-07-01

Similar Documents

Publication Publication Date Title
CN104750620B (en) A kind of internal memory migration method and device
US10565063B2 (en) Virtual machine snapshot backup based on multilayer de-duplication
CN105204781B (en) Compression method, device and equipment
CN103810020B (en) Virtual machine elastic telescopic method and device
CN103370691B (en) Managing buffer overflow conditions
CN107395665A (en) A kind of block chain service handling and business common recognition method and device
CN104123280B (en) File comparison method and equipment
CN103870514A (en) Repeating data deleting method and device
CN105487987B (en) A kind of concurrent sequence of processing reads the method and device of IO
WO2017107812A1 (en) User log storage method and device
CN106201659A (en) A kind of method of live migration of virtual machine and host
CN106371764A (en) Virtual block device-based data processing method and apparatus
CN106815254A (en) A kind of data processing method and device
CN109508144A (en) A kind of log processing method and relevant apparatus
CN106020722A (en) Method, device and system for deduplication of repeated data of cloud storage system
CN109614045A (en) A kind of metadata rule method, apparatus and relevant device
CN104484132B (en) The method and device of data reduction
CN104503868B (en) Method of data synchronization, device and system
US20160334996A1 (en) In-flash immutable object processing
WO2019061667A1 (en) Electronic apparatus, data processing method and system, and computer-readable storage medium
CN109800074A (en) Task data concurrently executes method, apparatus and electronic equipment
CN104317735A (en) High-capacity cache and method for data storage and readout as well as memory allocation and recovery
CN103885859B (en) It is a kind of to go fragment method and system based on global statistics
CN105260423A (en) Duplicate removal method and apparatus for electronic cards
US11593318B2 (en) Techniques for asynchronous snapshot invalidation

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20180216

CF01 Termination of patent right due to non-payment of annual fee