From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: How KVM hypervisor allocates physical pages to the VM. Date: Wed, 17 Sep 2014 09:39:03 +0200 Message-ID: <54193A97.7010401@redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit To: Steven , KVM Return-path: Received: from mail-we0-f175.google.com ([74.125.82.175]:35222 "EHLO mail-we0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751203AbaIQHjJ (ORCPT ); Wed, 17 Sep 2014 03:39:09 -0400 Received: by mail-we0-f175.google.com with SMTP id w61so969996wes.34 for ; Wed, 17 Sep 2014 00:39:08 -0700 (PDT) In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: Il 17/09/2014 05:56, Steven ha scritto: > When size = 10MB and 20MB, it looks like that KVM use > kmem_cache_alloc_node and kmalloc_node to allocate physical pages. > However, when size = 40MB, KVM hypervisor uses mm_page_alloc to > allocator physical pages. The former is based on the slab allocator, > while the latter is directly from the buddy allocator. > > So what is the heuristic used by the KVM to determine when to use the > slab allocator or directly from the buddy allocator? Or is there > anything wrong with my trace file? Thanks in advance. I think you're simply tracking different things. You should find the symbols associated to the call sites. KVM doesn't do anything special to allocate physical pages. It simply calls get_user_pages. Paolo