[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH RFC 5/6] hv_balloon: mark inflated pages PG_offline



Mark inflated and never onlined pages PG_offline, to tell the world that
the content is stale and should not be dumped.

Cc: "K. Y. Srinivasan" <kys@xxxxxxxxxxxxx>
Cc: Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>
Cc: Stephen Hemminger <sthemmin@xxxxxxxxxxxxx>
Cc: Kairui Song <kasong@xxxxxxxxxx>
Cc: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxx>
Cc: "Michael S. Tsirkin" <mst@xxxxxxxxxx>
Signed-off-by: David Hildenbrand <david@xxxxxxxxxx>
---
 drivers/hv/hv_balloon.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index 5728dc470eeb..778b6f879d1c 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -681,8 +681,13 @@ static struct notifier_block hv_memory_nb = {
 /* Check if the particular page is backed and can be onlined and online it. */
 static void hv_page_online_one(struct hv_hotadd_state *has, struct page *pg)
 {
-       if (!has_pfn_is_backed(has, page_to_pfn(pg)))
+       if (!has_pfn_is_backed(has, page_to_pfn(pg))) {
+               if (!PageOffline(pg))
+                       __SetPageOffline(pg);
                return;
+       }
+       if (PageOffline(pg))
+               __ClearPageOffline(pg);
 
        /* This frame is currently backed; online the page. */
        __online_page_set_limits(pg);
@@ -1200,6 +1205,7 @@ static void free_balloon_pages(struct hv_dynmem_device 
*dm,
 
        for (i = 0; i < num_pages; i++) {
                pg = pfn_to_page(i + start_frame);
+               __ClearPageOffline(pg);
                __free_page(pg);
                dm->num_pages_ballooned--;
        }
@@ -1212,7 +1218,7 @@ static unsigned int alloc_balloon_pages(struct 
hv_dynmem_device *dm,
                                        struct dm_balloon_response *bl_resp,
                                        int alloc_unit)
 {
-       unsigned int i = 0;
+       unsigned int i, j;
        struct page *pg;
 
        if (num_pages < alloc_unit)
@@ -1244,6 +1250,10 @@ static unsigned int alloc_balloon_pages(struct 
hv_dynmem_device *dm,
                if (alloc_unit != 1)
                        split_page(pg, get_order(alloc_unit << PAGE_SHIFT));
 
+               /* mark all pages offline */
+               for (j = 0; j < (1 << get_order(alloc_unit << PAGE_SHIFT)); j++)
+                       __SetPageOffline(pg + j);
+
                bl_resp->range_count++;
                bl_resp->range_array[i].finfo.start_page =
                        page_to_pfn(pg);
-- 
2.17.2


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.