Re: [Lhms-devel] Re: [patch 0/3] memory hotplug prototype

From: Dave Hansen
Date: Wed Apr 07 2004 - 14:22:23 EST


On Wed, 2004-04-07 at 11:59, Mike Kravetz wrote:
> I've been thinking about how to take a section (or any 'block') of
> memory offline. To do this the offlining code needs to somehow
> 'allocate' all the pages associated with the section. After
> 'allocation', the code knows the pages are not 'in use' and safely
> offline. Any suggestions on how to approach this? I don't think
> we can add any infrastructure to section definitions as these will
> need to be relatively small. Do we need to teach some of the code
> paths that currently understand zones about sections?

No, we don't need to teach zones about sections, yet (we may never have
to). Zones currently know about contiguous pfn ranges.
CONFIG_NONLINEAR (CNL) allows arbirary mappings from virtual and
physical memory locations to pfns. Using this, we can keep zones
dealing with contiguous pfn ranges, and still back them with any random
memory that we want.

I think that the code changes that will be needed to offline sections
will be mostly limited to teaching the page allocator a few things about
allocating particular pfn (or physical) ranges. If you can alloc() a
certain set of memory, then it's free to offline.

offline_section(section) {
mark_section_going_offline(section)
pfn = section_to_pfn(section)
some_alloc_pages(SECTION_ORDER, pfn, ...)
if alloc is ok
mark_section_offline(section)
else
try smaller pieces
}

The mark_section_going_offline() will be used by the __free_pages() path
to intercept any page that's going offline from getting freed back into
the page allocator. After being intercepted like this, the page can
then be considered "allocated" for the removal process.

I think the mark_section_going_offline() stage is what some others have
referred to as a "caged" state before memory is offlined.

-- Dave

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/