lkml.org 
[lkml]   [2008]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 6 of 6] xen-balloon: define a section_ops
Date
From
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;




\
 
 \ /
  Last update: 2008-04-04 02:21    [W:0.081 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site