Messages in this thread Patch in this message | | | Subject | [PATCH 6 of 6] xen-balloon: define a section_ops | Date | Thu, 03 Apr 2008 17:05:46 -0700 | From | Jeremy Fitzhardinge <> |
| |
Define a xen_balloon_section_ops to control how xen balloon pages are onlined.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> --- drivers/xen/balloon.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c @@ -139,6 +139,21 @@ } } +/* Only online a page if there's some memory backing it */ +static bool xen_online_page(struct page *page) +{ + unsigned long pfn = page_to_pfn(page); + + if (get_phys_to_machine(pfn) == INVALID_P2M_ENTRY) + return false; + + return online_page(page); +} + +static const struct section_ops xen_balloon_section_ops = { + .online_page = xen_online_page +}; + /* hotplug some memory we can add pages to */ static void balloon_expand(unsigned pages) { @@ -165,7 +180,7 @@ start_pfn = res->start >> PAGE_SHIFT; end_pfn = (res->end + 1) >> PAGE_SHIFT; - ret = add_memory_resource(0, res, &default_section_ops); + ret = add_memory_resource(0, res, &xen_balloon_section_ops); if (ret) goto release_res;
| |