Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932589AbcKHSag (ORCPT ); Tue, 8 Nov 2016 13:30:36 -0500 Received: from mga06.intel.com ([134.134.136.31]:21014 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750938AbcKHSab (ORCPT ); Tue, 8 Nov 2016 13:30:31 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,462,1473145200"; d="scan'208";a="28958759" Subject: Re: [PATCH kernel v4 7/7] virtio-balloon: tell host vm's unused page info To: "Li, Liang Z" , "mst@redhat.com" References: <1478067447-24654-1-git-send-email-liang.z.li@intel.com> <1478067447-24654-8-git-send-email-liang.z.li@intel.com> <281acd8d-fd94-6318-35e5-9eb130303dc6@intel.com> Cc: "pbonzini@redhat.com" , "amit.shah@redhat.com" , "quintela@redhat.com" , "dgilbert@redhat.com" , "qemu-devel@nongnu.org" , "kvm@vger.kernel.org" , "virtio-dev@lists.oasis-open.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , "mgorman@techsingularity.net" , "cornelia.huck@de.ibm.com" From: Dave Hansen Message-ID: <2dcef4a7-4909-a994-a7d0-bc54a268e991@intel.com> Date: Tue, 8 Nov 2016 10:30:30 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1190 Lines: 27 On 11/07/2016 09:50 PM, Li, Liang Z wrote: > Sounds good. Should we ignore some of the order-0 pages in step 4 if the bitmap is full? > Or should retry to get a complete list of order-0 pages? I think that's a pretty reasonable thing to do. >>> It seems the benefit we get for this feature is not as big as that in fast >> balloon inflating/deflating. >>>> >>>> You should not be using get_max_pfn(). Any patch set that continues >>>> to use it is not likely to be using a proper algorithm. >>> >>> Do you have any suggestion about how to avoid it? >> >> Yes: get the pfns from the page free lists alone. Don't derive >> them from the pfn limits of the system or zones. > > The ' get_max_pfn()' can be avoid in this patch, but I think we can't > avoid it completely. We need it as a hint for allocating a proper > size bitmap. No? If you start with higher-order pages, you'll be unlikely to get anywhere close to filling up a bitmap that was sized to hold all possible order-0 pages on the system. Any use of max_pfn also means that you'll completely mis-size bitmaps on sparse systems with large holes. I think you should size it based on the size of the free lists, if anything.