I'm sorry if my understanding is incorrect. Here are some topics on
pci passthrough to guests.

When pci passthrough is used with kvm, guest's all memory are pinned by extra
reference count of get_page(). That pinned pages are never be reclaimable and
movable by migration and cannot be merged by KSM.

Now, the information that 'the page is pinned by kvm' is just represented by
page_count(). So, there are following problems.

a) pages are on ANON_LRU. So, try_to_free_page() and kswapd will scan XX GB of
   pages hopelessly.

b) KSM cannot recognize the pages in its early stage. So, it breaks transparent
   huge page mapped by kvm into small pages. But it fails to merge them finally,
   because of raised page_count(). So, all hugepages are split without any
   benefits.

2 ideas for fixing this....

for a) I guess the pages should go to UNEVICTABLE list. But it's not mlocked.
       I think we use PagePinned() instread of it and move pages to UNEVICTABLE 
list.
       Then, kswapd etc will ignore pinned pages.

for b) At first, I thought qemu should call madvise(MADV_UNMERGEABLE). But I 
think
       kernel may be able to handle situation with an extra check, PagePinned() 
or
       checking a flag in mm_struct. Should we avoid this in userland or kernel 
?

BTW, I think pinned pages cannot be freed until the kvm process exits. Is it 
right ?

Thanks,
-Kame

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to