CN101853219B - Virtualized platform based Method for swapping in disc page - Google Patents

Virtualized platform based Method for swapping in disc page Download PDF

Info

Publication number
CN101853219B
CN101853219B CN2010101621769A CN201010162176A CN101853219B CN 101853219 B CN101853219 B CN 101853219B CN 2010101621769 A CN2010101621769 A CN 2010101621769A CN 201010162176 A CN201010162176 A CN 201010162176A CN 101853219 B CN101853219 B CN 101853219B
Authority
CN
China
Prior art keywords
page
changes
change operation
item
swapping
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
CN2010101621769A
Other languages
Chinese (zh)
Other versions
CN101853219A (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.)
Zhejiang University ZJU
Original Assignee
Zhejiang University ZJU
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 Zhejiang University ZJU filed Critical Zhejiang University ZJU
Priority to CN2010101621769A priority Critical patent/CN101853219B/en
Publication of CN101853219A publication Critical patent/CN101853219A/en
Application granted granted Critical
Publication of CN101853219B publication Critical patent/CN101853219B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Memory System Of A Hierarchy Structure (AREA)

Abstract

The invention discloses a virtualized platform method for swapping in a disc page, which comprises the following steps of: (1) establishing trace cache used for tracing page swap-in operations of various progresses, wherein the trace cache comprises a plurality of items and each item is recorded with the information of a progress on the latest page swap-in operation; (2) tracing the page swap-in operation of each client progress, and when interrupting due to page missing, finding a matched item in the trace cache according to an identifier of the progress subjected to interruption; and (3) calculating the number of prefetched pages to be swapped-in by the current pages according to the obtained item. A dynamic page swapping-in calculation method realized by the invention improves the page continuity of the internal memory of each client through a page swapping mechanism based on the internal memory state of the client, and can dynamically change the page swapping-in number each time when paging, therefore disc IO (Input Output) access frequency is sufficiently lowered and the system efficiency is improved on the premise of ensuring the disc switching cache hit.

Description

The method that changes to based on the disc page of virtual platform
Technical field
The present invention relates to field of computer technology, relate in particular to a kind of disc page and change to method based on the support Host-Swapping mechanism on the virtual platform.
Background technology
At present innumerable in the managerial research approach of internal memory, but these researchs had just been interrupted before 5 years basically.In recent years, owing to be subjected to the complicacy of memory model and lack the promotion of hardware technological development, recede to a low ebb the phase for the concern of memory management.Even those previous researchs, memory management for virtual platform, most all concentrating on allocation strategy and the page replacement policy, still, the influence of replacing the device model that input and output (IO) operation that causes involved for the page of virtual machine but relates to less.
In virtual, physical resource has an attribute to be called host (Host) usually, and virtual resource of coming out has an attribute to be called client (Guest) usually.In essence, virtual is exactly by the software module that is positioned at lower floor, by a method with its original on all four interface of running environment of expecting is provided to the last layer software module, take out virtual software or hardware interface, make upper layer software (applications) can run directly on the virtual environment.KVM (Kemel-based Virtual Machine, virtual machine based on kernel) is an emerging Virtual Machine Manager software based on linux kernel, the virtual method that is based on Intel hardware virtual technology that its adopts, and finish device virtualization (Device Model) in conjunction with simulator Qemu.For Linux, KVM is a common process, so its management is very simple, and the virtualized environment performance that provides is very high, thereby and very strong to the very little extendability of existing system influence.For the technology that this paper realizes, the KVM biggest advantage is its support internal memory above quota distribution and Host-swapping mechanism.
In the virutal machine memory page replacement mechanism originally, page removal process is as follows: virtual machine itself is initiated the page and is reclaimed, and its page reclaims algorithm and chooses the recovery page frame, proposes the IO operation requests to the universal I layer then.The disk drive of universal I layer receives Intra-request Concurrency and goes out corresponding IO instruction, and these IO instructions are caught the back exception throw by hardware and withdrawed from virtual machine environment, and abnormal cause can be detected by VMM.Next, detected abnormal cause and IO instruction are submitted to the finger daemon of user's attitude, and (Device ModelLayer DML) goes to call the local disk device drives, thereby finishes (Swap out) operation that swaps out of memory pages through the device model layer for it; Shown in Fig. 1 dotted line process.The advantage of this Host-swapping mechanism is that the memory pages switching path of virtual machine shortens greatly, and simultaneously unnecessary level of privilege switching is avoided, and system effectiveness is improved raising, and its process is shown in figure-1 solid line.
If supported a plurality of client computer to move simultaneously on the VMM that has introduced Host-Swapping, different client computer may be mapped to the physics continuous page.The page originally swap out can attempt in the strategy with physics continuously page or leaf swap out together; But in the virtualized environment of having introduced Host-Swapping, this can allow the page frame that belongs to different virtual machine be left in the exchange partition continuously.For the spatial locality that utilizes disk access provides optimization, the disc page mechanism of changing to is proposed.But (SuSE) Linux OS is provided with the disc page of a manual adjustments and changes to size, is defaulted as an exchange partition read operation and attempts 8 continuous pages.But on the VMM that has introduced Host-Swapping, because " uncontinuity " of the single virtual machine page transferred the big page to change to scope and do not had what effect.This uncontinuity causes disc page to change to hit rate decline, IO number increases and the increase of disk seek time.If the IO operation too much, then may make in disk operating, reach capacity the working time of system.
Internal memory Host-swapping mechanism by shortening virtual machine greatly the memory pages switching path and avoided unnecessary level of privilege to switch improving the performance of virtual machine, but this mechanism also makes disc page change to that hit rate descends, IO number increases and the increase of disk seek time simultaneously.
Summary of the invention
The method of page number when the invention provides a kind of intelligent management disc page and changing to, change to page number when helping the mechanism of skipping dynamically to change each paging, guaranteeing fully to reduce the disk I access times under the prerequisite that the disk cache exchanging hits, improve system effectiveness.
A kind of method that changes to based on the disc page of virtual platform comprises the steps:
(1) set up trace cache, be used to follow the tracks of the page change operation of each process, trace cache is a buffer circle, comprising some (Entry), as shown in Figure 2, the information in each during the last page change operation of process of record comprises:
PID represents the process ID number of this process, and the page change operation that has promptly indicated this record occurs in process ID number in the process of PID.
Priority represents the term of validity of item;
The initial sum of page slot on exchange partition that Base and End change to when representing the last page change operation of this process respectively stops off-set value;
The page number that changes to during the last page change operation of this process is then represented by Pages.
In the term of validity of an item, when just priority also is not 0, also be before this also is not replaced, the always corresponding same process of information that item is described, and this information record be the last page change operation of its process of describing the time information, (perhaps or rather, be after the last page change operation of this process is finished, the information of this operation, such as being where reading from the swapace, having read several page or leaf is recorded in this) when with box lunch this process page change operation next time being taken place need skip, be that reference calculation goes out the page change operation that takes place this time and need read what pages in advance with this information).What can obscure in the middle of this may be unclear to the page change operation of process, that is to say, there are a lot of processes to move at the same time in the system, angle from the overall situation, a page change operation only can corresponding process, after page operation is finished, just in item, the information of current operation is upgraded corresponding to this process, also be the information of the only corresponding process of an item in the last page change operation.
(2) page of following the tracks of each client (Guest) process changes to (swap in) operation, when interrupting when skipping leaf, according to the identifier of the process that takes place to interrupt in trace cache, find coupling.
All items correctly initialization in system starting process in the trace cache is the relevant field zero clearing.Number as parameter, go to mate each the PID field in the trace cache with the process ID of the current process/Guest that interrupts of skipping leaf.This function adopts the linear sweep mode, and this is based on the fair access principle to trace buffer, is not very big situation for the buffer zone item number, and this method is simple and easy to safeguard and performance can be accepted.
Scanning is at first since Swap in chooses last time item;
With coupling PID is that it is the highest for priority;
Thereby inferior priority selects first idle of scanning to write down this change operation for the item that does not find coupling PID, promptly writes down a new item;
If what be scanned is not full of above-mentioned two kinds of situations, this term of validity Priority of then successively decreasing when a certain term of validity Priority is 0, then removes this.If after a wheel scan, do not choose satisfy condition the item this return NULL, the page subsequently changes to computing function will return a default value.Obviously, each can have Priority chance not to be replaced at most.
(3), calculate the number that current page changes to the page of need looking ahead according to the item that obtains.
The position of the slot of target pages on exchange partition that the current page change operation is related is designated as Target.The distance D istance value of the page that changes to during the last page change operation of the process of record in the item of target pages and coupling is | Target-Base| and | smaller among the Target-End|.
For ease of describing " the last page change operation of the process of record in the item of coupling " abbreviation " last page change operation "
Wherein Base and End represent respectively in the item of coupling, and the initial sum of page slot on exchange partition that last page change operation changes to stops off-set value;
If Distance then shows the spatial locality height less than the intermediate value (MDistance) that the user sets, therefore increase the page number that changes to.The each unit that increases of the page is 8, when the page number that changes to reaches maximal value MPF, will no longer increase.The value of MPF is 32.
If Distance is not less than MDistance, the page number that changes to during page change operation will directly be got the acquiescence minimum value of default.
The present invention has introduced the notion of spatial locality in this step, if the spatial locality height then once changes to the more page, if spatial locality is low, then changes to execution according to the minimum page.Because changing to the effective page as far as possible in batches is the final purpose that dynamic page changes to, so we introduce one and change to window, and this window increases when spatial locality is high, and reduces when spatial locality is low, and the speed that reduces is faster than the speed of growth.Each step-length that increases is artificial the setting, and reduce step-length greater than the step-length that increases (being actually when increasing increases with fixed step size, then is the disposable minimum length of window that is reduced to during minimizing).
The rotating speed of main flow hard disk is 7200RPM at present, and be 8 milliseconds its average seek time.Based on this, and consider the time that average seek time and kernel fetcher code path are consumed simultaneously, measured value shows being more or less the same T.T. of the T.T. of the disk change operation of once reading 8 pages and the disk change operation of once reading 2 pages, and therefore the minimum change unit that a time page changes to is decided to be 8 pages.
The probability statistics principle shows, after probability surpasses certain threshold value, changes to page number thereby just can regard as the higher increase of spatial locality.Our definition space locality is the distance between the page of twice continuous disc page change operation.In trace cache, Base and End have write down the exchange partition slot initial sum that last page change operation changes to respectively and have stopped skew, simultaneously, the slot position of target pages on exchange partition of this paging are designated as Target.The distance D istance value of the page that target pages and last page change operation change to is | Target-Base| and | smaller among the Target-End|, it is compared with distance threshold MDistance just can predict the space continuity that this changes to.
The page number that the front has changed to minimum is defined as 8, i.e. MDistance=8.When the page changes to, at first need to judge this target slot and changed to the distance that slot is offset last time, promptly check the height of spatial locality.The disposal route that dynamic page changes to computing function is that the distance D istance of the page that target pages and last page change operation are changed to compares with the minimum page number MDistance that changes to.
If Distance less than MDistance, then shows the spatial locality height, therefore increase the page number that changes to.The each unit that increases of the page is 8, i.e. MDistance.When the page number that changes to reaches maximal value MPF, will no longer increase.The value of MPF is 32.According to the study, numerical value 32 is that the page changes to the equilibrium point that reaches optimum efficiency with two kinds of mechanism of memory shared jointly.Next, function also need to judge this page changes to and last time the page change to relative position between the skew, further determine this page to change to the reference position of slot skew.
If Distance is not less than MDistance, page change operation will be got the acquiescence minimum value of default.
The dynamic page that the present invention realized changes to computing method and improves the page continuity of each client internal memory in exchange partition by the page exchanging mechanism based on the client internal memory state, the page in the time of can dynamically changing each paging changes to number, thereby, improve system effectiveness guaranteeing fully to reduce the disk I access times under the prerequisite that the disk cache exchanging hits.
Description of drawings
Fig. 1 replaces the contrast synoptic diagram for memory pages;
Fig. 2 is a trace cache and a structure thereof;
Embodiment
It is on the framework of virtual machine that the inventive method is implemented in based on linux kernel, KVM, attempts to solve the discontinuous problem that causes disc page to change to hit rate decline, IO number increase and the increase of disk seek time of the single virtual machine page that Host-swaping mechanism is brought.
Detailed process is: Host sets up a trace cache when system initialization, and this is a buffer circle following the tracks of each process change operation, the relevant information of wherein each the last change operation of process of record.When process/Guest interrupted owing to skipping leaf, it was parameter finds coupling in trace cache item with their Process identifier (PID) just that the intelligent disc page among the Host changes to manager;
Scanning is at first since Swap in chooses last time item;
With coupling PID is that it is the highest for priority;
Thereby inferior priority selects first idle of scanning to write down this change operation for the item that does not find coupling PID, promptly writes down a new item;
Next, calculate what pages of to look ahead specifically according to this.
The position of the slot of target pages on exchange partition that the current page change operation is related is designated as Target.The distance D istance value of the page that changes to during the last page change operation of the process of record in the item of target pages and coupling is | Target-Base and | smaller among the Target-End|.
If Distance then shows the spatial locality height less than the intermediate value of setting 8, therefore increase the page number that changes to.The each unit that increases of the page is 8, when the page number that changes to reaches maximal value MPF, will no longer increase.The value of MPF is 32.
If Distance is not less than intermediate value, the page number that changes to during page change operation will directly be got the acquiescence minimum value 8 of default.
, promptly write down a new item if thereby fruit does not find the item of coupling PID to select first idle of scanning to write down this change operation; Distance gets acquiescence minimum value 8.
We test the actual effect that the dynamic page method that changes to is brought.At testing hardware, we use the CPU of Intel Q9300, and the internal memory of 768MB, rotating speed are 7200 and buffer memory is the disk of 16MB.The employed system of Host and Guest all is Fedora Core 9, is 2.6.31-RC5 but Host goes up the kernel version of Fedora Core, is approximately higher than the kernel version of Guest: 2.6.25.
For testing software, adopt SpecJBB here, and SpecJBB heap is set is 256MB.3 the Guest OS that have been system configuration during test, the internal memory of each OS all is 320MB.
System performance testing
Based on above-mentioned configuration, we have compared common KVM and have enabled KVM that dynamic page changes to device and used expection (Anticipatory) and the performance score under fair-queueing (CFQ) disc scheduler all the time respectively.Change in the computing method at dynamic page, maximum is changed to page number be defined as 32, it is 8 that minimum changes to page number, and test result shows that in the SpecJBB operational process, the dynamic page mechanism of changing to cooperates the selection of respective schedulers, and performance improves nearly 20%.
The disk I operation relatively
Next will further specify the advantage place that dynamic page changes to from IO operation for disk number of times and cache exchanging hit rate level analysis.
We are testing tool with SpecJBB, and the disk of system is read in data volume, reads the disk number of times and the cache exchanging hit rate compares.The result shows, though the value that the dynamic page mechanism of changing to reduces at IO not have directly to increase Page Cluster aspect the number of times (page bunch) shows well, but the dynamic page mechanism of changing to is got the hit rate that can effectively guarantee the exchange area buffer memory, makes disk consume simultaneously and reduces at most T.T..

Claims (2)

1. a method that changes to based on the disc page of virtual platform is characterized in that, comprises the steps:
(1) set up trace cache, be used to follow the tracks of the page change operation of each process, comprised somely in the trace cache, the information in each during the last page change operation of process of record comprises:
The process ID of this process number;
The term of validity of item;
The initial sum of the page slot on exchange partition that changes to during the last page change operation of this process stops off-set value;
The page number that changes to during the last page change operation of this process;
(2) follow the tracks of the page change operation of each client process, when interrupting, in trace cache, find the item of coupling according to the identifier of the process that takes place to interrupt when skipping leaf;
(3), calculate the number that current page changes to the page of need looking ahead according to the item that obtains; The position of the slot of target pages in exchange partition that the current page change operation is related is designated as Target, if | Target-Base| and | the smaller is not less than the intermediate value of setting among the Target-End|, need the acquiescence minimum value of number for setting of the page of looking ahead so, otherwise increase the page number that changes to;
Wherein Base and End represent respectively in the item of coupling, and the initial sum of the page slot on exchange partition that changes to during the last page change operation of the process that is write down stops off-set value.
2. the method for claim 1 is characterized in that, described trace cache is a buffer circle.
CN2010101621769A 2010-04-30 2010-04-30 Virtualized platform based Method for swapping in disc page Expired - Fee Related CN101853219B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2010101621769A CN101853219B (en) 2010-04-30 2010-04-30 Virtualized platform based Method for swapping in disc page

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2010101621769A CN101853219B (en) 2010-04-30 2010-04-30 Virtualized platform based Method for swapping in disc page

Publications (2)

Publication Number Publication Date
CN101853219A CN101853219A (en) 2010-10-06
CN101853219B true CN101853219B (en) 2011-09-21

Family

ID=42804720

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2010101621769A Expired - Fee Related CN101853219B (en) 2010-04-30 2010-04-30 Virtualized platform based Method for swapping in disc page

Country Status (1)

Country Link
CN (1) CN101853219B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103713882A (en) * 2013-12-20 2014-04-09 华为技术有限公司 Method and device for swapping data in memory
CN107247618B (en) * 2017-05-13 2021-01-15 成都长天信息技术有限公司 Disk redirection method based on instruction external acquisition architecture
CN113138941A (en) 2020-01-20 2021-07-20 华为技术有限公司 Memory exchange method and device
CN111427804B (en) * 2020-03-12 2022-05-20 深圳震有科技股份有限公司 Method for reducing missing page interruption times, storage medium and intelligent terminal

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7624240B1 (en) * 2006-10-17 2009-11-24 Vmware, Inc. Separate swap files corresponding to different virtual machines in a host computer system
CN100527098C (en) * 2007-11-27 2009-08-12 北京大学 Dynamic EMS memory mappings method of virtual machine manager

Also Published As

Publication number Publication date
CN101853219A (en) 2010-10-06

Similar Documents

Publication Publication Date Title
US10761957B2 (en) Optimization of operating system and virtual machine monitor memory management
JP4209906B2 (en) Low power consumption memory management method and computer using the method
US9672158B2 (en) Asymmetric memory migration in hybrid main memory
US8793427B2 (en) Remote memory for virtual machines
Kwon et al. Coordinated and efficient huge page management with ingens
Park et al. CFLRU: a replacement algorithm for flash memory
US10089014B2 (en) Memory-sampling based migrating page cache
US9830262B2 (en) Access tracking mechanism for hybrid memories in a unified virtual system
Yadgar et al. Management of multilevel, multiclient cache hierarchies with application hints
KR101640769B1 (en) Virtual system and instruction executing method thereof
CN105446665A (en) Computer storage acceleration system and optimization method thereof
CN101859282B (en) Disk page swap-in method of virtual platform based on dual tracking
CN101853219B (en) Virtualized platform based Method for swapping in disc page
CN104346284A (en) Memory management method and memory management equipment
Guo et al. $ mars $: Mobile application relaunching speed-up through flash-aware page swapping
JP2021034052A (en) Memory system having different kinds of memory, computer system including the same, and data management method therefor
CN108369624B (en) Techniques for detecting malware with minimal performance degradation
Wen et al. Software hint-driven data management for hybrid memory in mobile systems
Wen et al. Openmem: Hardware/software cooperative management for mobile memory system
Kwon et al. Ingens: Huge page support for the OS and hypervisor
Sha et al. Huge page friendly virtualized memory management
Tjioe et al. Making garbage collection wear conscious for flash SSD
TWI828307B (en) Computing system for memory management opportunities and memory swapping tasks and method of managing the same
CN115087961B (en) Arbitration scheme for coherent and incoherent memory requests
Wang et al. Evaluating non-in-place update techniques for flash-based transaction processing systems

Legal Events

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

Granted publication date: 20110921

Termination date: 20180430