算法描述:
将to_send中的位全部置为1;
for(;;)
{
iter++; send_this_iter = 0; skip_this_iter = 0;
while(N<p2m_size)//p2m_size为i拟机物理内存页面量
{
调用函数xc_shadow_control()的查看操作把脏页位图拷贝到to_skip中;
for ( batch = 0;(batch < MAX—BATCH一SIZE) && (N < p2m_size);N++ )
{
if ( !last_iter &&test_bit(n, to_send) &&test_bit(n, to_kip))
skip_this_iterl++;
if (页N满足三类条件)
将该页面放到发送缓冲区pfn_type[batch]中;
batch++;
}
将buffer中的内存页映射到对应的内存;
断开pfn与mfn的映射关系;
传送内存页面;
}
if (last_iter) //循环出口
break;
if(满足退出条件)
{
last_iter = 1 ;
挂起虚拟机;
}
调用函数xc_shadow_control()的拷贝清空操作把脏页位图拷贝到to_send中;
}
转载于:https://blog.51cto.com/yang19890314/1252254