WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] Xen balloon: fix totalram_pages counting.

To: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Subject: [Xen-devel] [PATCH] Xen balloon: fix totalram_pages counting.
From: Gianluca Guida <gianluca.guida@xxxxxxxxxx>
Date: Thu, 30 Jul 2009 22:54:36 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 30 Jul 2009 15:18:25 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Change totalram_pages when a single page is added/removed to the
ballooned list. This avoid totalram_pages to be set erroneously to
max_pfn at boot.

Signed-off-by: Gianluca Guida <gianluca.guida@xxxxxxxxxx>
---
 drivers/xen/balloon.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index c83da03..85609ec 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -133,6 +133,8 @@ static void balloon_append(struct page *page)
                list_add(&page->lru, &ballooned_pages);
                balloon_stats.balloon_low++;
        }
+
+       totalram_pages--;
 }
 
 /* balloon_retrieve: rescue a page from the balloon, if it is not empty. */
@@ -153,6 +155,8 @@ static struct page *balloon_retrieve(void)
        else
                balloon_stats.balloon_low--;
 
+       totalram_pages++;
+
        return page;
 }
 
@@ -257,7 +261,6 @@ static int increase_reservation(unsigned long nr_pages)
        }
 
        balloon_stats.current_pages += nr_pages;
-       totalram_pages = balloon_stats.current_pages;
 
  out:
        spin_unlock_irqrestore(&xen_reservation_lock, flags);
@@ -320,7 +323,6 @@ static int decrease_reservation(unsigned long nr_pages)
        BUG_ON(ret != nr_pages);
 
        balloon_stats.current_pages -= nr_pages;
-       totalram_pages = balloon_stats.current_pages;
 
        spin_unlock_irqrestore(&xen_reservation_lock, flags);
 
@@ -419,7 +421,6 @@ static int __init balloon_init(void)
        pr_info("xen_balloon: Initialising balloon driver.\n");
 
        balloon_stats.current_pages = min(xen_start_info->nr_pages, max_pfn);
-       totalram_pages   = balloon_stats.current_pages;
        balloon_stats.target_pages  = balloon_stats.current_pages;
        balloon_stats.balloon_low   = 0;
        balloon_stats.balloon_high  = 0;
-- 
1.5.6.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] Xen balloon: fix totalram_pages counting., Gianluca Guida <=