Changes

1,705 bytes added ,  17:58, 14 May 2013
no edit summary
Line 15: Line 15:  
; [[Live migration]]
 
; [[Live migration]]
 
: When doing live migration a lot of time takes the procedure of copying tasks' memory on remote host. And yet again, during this time process is frozen. Acting like in the previous example also reduces the freeze time, i.e. -- the live migration becomes really Live.
 
: When doing live migration a lot of time takes the procedure of copying tasks' memory on remote host. And yet again, during this time process is frozen. Acting like in the previous example also reduces the freeze time, i.e. -- the live migration becomes really Live.
 +
 +
== How we track memory changes ==
 +
 +
In order to find out what pages in memory has changed, we [http://lwn.net/Articles/546966/ patched] the kernel. Tracking the memory changes consists of two steps:
 +
 +
* Tell the kernel that we want it to keep track of memory changes by particular task by writing 4 into <core>/proc/$pid/clear_refs</code> file.
 +
 +
and after a while
 +
 +
* Get what pages were modified by task by reading its <code>/proc/$pid/pagemap</code> file and looking at so called ''soft-dirty'' bit in the pagemap entries.
 +
 +
 +
On the first step kernel will re-map all the tasks' mapping in read-only manner. If a task will try to write into one of its pages later, a page fault would occur and the kernel would note which page was written to. Reading the <code>pagemap</code> file reveals this information.
 +
 +
== How to use this with CRIU ==
 +
 +
There are several options how this functionality can be used.
 +
 +
;<code>--prev-images-dir</code> option
 +
:This option says where the images from previous <code>dump</code> or <code>pre-dump</code> (see below) action reside. If possible, CRIU will not dump memory pages that hasn't changed since that time.
 +
 +
;<code>--track-mem</code> option
 +
:This option makes CRIU to reset memory changes tracker. If done, the next dump <code>--prev-images-dir</code> will have chances to successfully find not changed pages.
 +
 +
;<code>pre-dump</code> action
 +
:This action dumps only part of information about processes and does this keeping tasks frozen for minimally possible time. The images generated by pre-dump cannot and should not be used for restore. After this action the proper <code>dump</code> should be performed with properly configured <code>--prev-images-dir</code> path.