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.