Re: [PATCH v2 repost 3/7] mm: add a function to get the max pfn

From: Dave Hansen
Date: Wed Jul 27 2016 - 18:52:38 EST


On 07/27/2016 03:08 PM, Michael S. Tsirkin wrote:
>> > +unsigned long get_max_pfn(void)
>> > +{
>> > + return max_pfn;
>> > +}
>> > +EXPORT_SYMBOL(get_max_pfn);
>> > +
>
> This needs a coment that this can change at any time.
> So it's only good as a hint e.g. for sizing data structures.

Or, if we limit the batches to 1GB like you suggested earlier, then we
might not even need this exported. It would mean that in the worst
case, we temporarily waste 28k out of the 32k allocation for a small VM
that had <128MB of memory.

That seems like a small price to pay for not having to track max_pfn
anywhere.