From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162840AbcG0WF3 (ORCPT ); Wed, 27 Jul 2016 18:05:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34934 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162357AbcG0WFT (ORCPT ); Wed, 27 Jul 2016 18:05:19 -0400 Date: Thu, 28 Jul 2016 01:05:12 +0300 From: "Michael S. Tsirkin" To: Dave Hansen Cc: Liang Li , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, virtio-dev@lists.oasis-open.org, kvm@vger.kernel.org, qemu-devel@nongnu.org, dgilbert@redhat.com, quintela@redhat.com, Andrew Morton , Vlastimil Babka , Mel Gorman , Paolo Bonzini , Cornelia Huck , Amit Shah Subject: Re: [PATCH v2 repost 6/7] mm: add the related functions to get free page info Message-ID: <20160728010030-mutt-send-email-mst@kernel.org> References: <1469582616-5729-1-git-send-email-liang.z.li@intel.com> <1469582616-5729-7-git-send-email-liang.z.li@intel.com> <5798E418.7080608@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5798E418.7080608@intel.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 27 Jul 2016 22:05:18 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 27, 2016 at 09:40:56AM -0700, Dave Hansen wrote: > On 07/26/2016 06:23 PM, Liang Li wrote: > > + for_each_migratetype_order(order, t) { > > + list_for_each(curr, &zone->free_area[order].free_list[t]) { > > + pfn = page_to_pfn(list_entry(curr, struct page, lru)); > > + if (pfn >= start_pfn && pfn <= end_pfn) { > > + page_num = 1UL << order; > > + if (pfn + page_num > end_pfn) > > + page_num = end_pfn - pfn; > > + bitmap_set(bitmap, pfn - start_pfn, page_num); > > + } > > + } > > + } > > Nit: The 'page_num' nomenclature really confused me here. It is the > number of bits being set in the bitmap. Seems like calling it nr_pages > or num_pages would be more appropriate. > > Isn't this bitmap out of date by the time it's send up to the > hypervisor? Is there something that makes the inaccuracy OK here? Yes. Calling these free pages is unfortunate. It's likely to confuse people thinking they can just discard these pages. Hypervisor sends a request. We respond with this list of pages, and the guarantee hypervisor needs is that these were free sometime between request and response, so they are safe to free if they are unmodified since the request. hypervisor can detect modifications so it can detect modifications itself and does not need guest help. Maybe just call these "free if unmodified" and reflect this everywhere - verbose but hey. Better naming suggestions would be welcome. -- MST