Re: [linux-pm] [PATCH] hibernation should work ok with memory hotplug

Rafael J. Wysocki
2008-11-04T16:34:03Z

On Tuesday, 4 of November 2008, Dave Hansen wrote:
> On Tue, 2008-11-04 at 16:35 +0100, Rafael J. Wysocki wrote:
> > On Tuesday, 4 of November 2008, Dave Hansen wrote:
> > > On Tue, 2008-11-04 at 09:54 +0100, Rafael J. Wysocki wrote:
> > > > To handle this, I need to know two things:
> > > > 1) what changes of the zones are possible due to memory hotplugging
> > > > (i.e. can they grow, shring, change boundaries etc.)
> > >
> > > All of the above.
> >
> > OK
> >
> > If I allocate a page frame corresponding to specific pfn, is it guaranteed to
> > be associated with the same pfn in future?
>
> Page allocation is different. Since you hold a reference to a page, it
> can not be removed until you release that reference. That's why every
> normal alloc_pages() user in the kernel doesn't have to worry about
> memory hotplug.

Good. :-)

So, if I allocate the image pages right prior to creating the image, they
won't be touched by memory hotplug.

Now, I need to do one more thing, which is to check how much memory has to be
freed before creating the image. For this purpose I need to lock memory
hotplug temporarily, count pages to free and unlock it. What interface should
I use for this purpose?

[I'll also need to lock memory hotplug temporarily during resume.]

Rafael