Re: [PATCH v2 repost 6/7] mm: add the related functions to get free page info

From
Michael S. Tsirkin <mst@redhat.com>
Date
2016-07-28 00:17:00
On Thu, Jul 28, 2016 at 12:10:16AM +0000, Li, Liang Z wrote:
quoted
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:
quoted
+	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);
quoted
+			}
+		}
+	}
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.
quoted
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
Right but this should be clear from code and naming.
Thread (1 message) 1 message, 1 author, last reply 2016-07-28
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help