In kvm's TODO page, I saw the item "attach kvm memory to a Linux address_space so that guest memory can be paged out". But I don't think it is as simple as this. Because both host part page fault and guest part page fault interact. As I know, the creation of guest's shadow PTEs don't go through host's PTEs. When a shadow PTE is to be created, it always assumes the page pointer stored in memory region is vaild, and use the page struct to calcuate host physical address. So, if we want to implement a swap mechanism. It is important to mark the page struct pointer as invalid when host frame is swapped out. And replace the page pointer with the new one when a frame is swapped in. Moreover, we should not swapped out pages that are currently mapped by shadow PTEs unless we got a way to invalidate them. On the guest part, when a shadow PTE is to be created, we should make sure the page pointer in memory regeion is vaild (i.e. the page is not swapped out), if not, we should ask to host to bring in the page before guest can resume. I want to know if I misunderstood anything, and wonder if there's any easier way to implement guest pages' swapping?