[PATCH 6 of 6] xen-balloon: define a section_ops

From: Jeremy Fitzhardinge
Date: Thu Apr 03 2008 - 20:18:38 EST


Define a xen_balloon_section_ops to control how xen balloon pages are onlined.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
---
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;



--
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/