On Thu, Sep 18, 2014 at 6:00 AM, Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote: > Il 18/09/2014 01:11, Steven ha scritto: >> I agree with you that the memory allocated from the >> kmem_cache_alloc_node and kmalloc_node should be not returned to the >> user space process in the VM. >> >> Can I understand in this way " for small size memory allocation array >> or the VM has already have some pages, the hypervisor uses kmalloc or >> kmem_cache_alloc for some bookkeeping purpose to provide VM the free >> memory, instead of calling mm_page_alloc"? Is this correct? Thanks. > > No. The hypervisor's uses of kmalloc or kmem_cache_alloc are unrelated > to providing the VM with memory. > > For example, the hypervisor could be allocating its own private data > structure to track the guest's memory. But pages will always be > obtained via get_user_pages and the buddy allocator. Thanks for your reply. Could you give me some guidance about how to trace the page allocation for the user space application in the VM? Say, I have a simple program in the VM, that allocate and initialize the array like array [10240]; // 10 page integer array. When the program is running, it should causes page fault to the hypervisor. How can I track the guest virtual address and physical page address during the page fault handling? Thanks. - Steven > > Paolo -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html