From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162536AbcG1AMa (ORCPT ); Wed, 27 Jul 2016 20:12:30 -0400 Received: from mga04.intel.com ([192.55.52.120]:8077 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161875AbcG1AMX convert rfc822-to-8bit (ORCPT ); Wed, 27 Jul 2016 20:12:23 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,432,1464678000"; d="scan'208";a="1003847917" From: "Li, Liang Z" To: "Hansen, Dave" , "linux-kernel@vger.kernel.org" CC: "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 , "Michael S. Tsirkin" , Paolo Bonzini , "Cornelia Huck" , Amit Shah Subject: RE: [PATCH v2 repost 6/7] mm: add the related functions to get free page info Thread-Topic: [PATCH v2 repost 6/7] mm: add the related functions to get free page info Thread-Index: AQHR56aVngOJam3PHUGH+OrnCL7UZ6Ar9eEAgAB9i9A= Date: Thu, 28 Jul 2016 00:10:16 +0000 Message-ID: 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> In-Reply-To: <5798E418.7080608@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTc4YmYwNDktOGUwZC00OWE4LTkwMjUtYTQ3Njg3ZWVmODI1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IlNwSHA2ZnBJYzBUZURkR3JXXC9xWWZxTGJQNVB3ZWtmeUhcL1hqaUVMK0ZSbz0ifQ== x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Subject: Re: [PATCH v2 repost 6/7] mm: add the related functions to get free > page info > > 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. > You are right, will change. > 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. The dirty page logging will be used to correct the inaccuracy. The dirty page logging should be started before getting the free page bitmap, then if some of the free pages become no free for writing, these pages will be tracked by the dirty page logging mechanism. Thanks! Liang