From: Mark Williamson Subject: [PATCH] Fix balloon handling of highmem pages Date: Fri, 29 Jun 2007 16:53:14 +0100 Message-ID: <200706291653.14578.mark.williamson@cl.cam.ac.uk> Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_qrShGUQpfeawPy8" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: xen-devel@lists.xensource.com, anthony@communitymesh.com List-Id: xen-devel@lists.xenproject.org --Boundary-00=_qrShGUQpfeawPy8 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline I knocked up a quick patch to fix the balloon driver's handling of highmem pages. Should apply cleanly to the Linux dev tree. I can also submit it for 3.1 if wanted. Without this, LowTotal can go negative (given it's an unsigned integer) and then appears as ~4Gig, which is a bit silly. I beliee this fixes Anthony Wright's bug #733 in Bugzilla (http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=733). Credit to Anthony for noticing the problem, and figuring out that he was actually seeing an unsigned int going "negative". Cheers, Mark -- Dave: Just a question. What use is a unicyle with no seat? And no pedals! Mark: To answer a question with a question: What use is a skateboard? Dave: Skateboards have wheels. Mark: My wheel has a wheel! --Boundary-00=_qrShGUQpfeawPy8 Content-Type: all/allfiles; name="fix-balloon-highmem.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="fix-balloon-highmem.patch" # HG changeset patch # User mark.williamson@cl.cam.ac.uk # Date 1183132109 -3600 # Node ID 64dba2f5f5e1bc219f699ceebf69c73ce993eb3d # Parent 6433fb4f88d6779073bb527e0ea13814206d3259 Stop low memory from appearing -ve in /proc/meminfo when ballooned. Signed-off-by: Mark Williamson diff -r 6433fb4f88d6 -r 64dba2f5f5e1 drivers/xen/balloon/balloon.c --- a/drivers/xen/balloon/balloon.c Thu Jun 21 22:37:49 2007 +0100 +++ b/drivers/xen/balloon/balloon.c Fri Jun 29 16:48:29 2007 +0100 @@ -83,6 +83,7 @@ static unsigned long frame_list[PAGE_SIZ /* VM /proc information for memory */ extern unsigned long totalram_pages; +extern unsigned long totalhigh_pages; /* List of ballooned pages, threaded through the mem_map array. */ static LIST_HEAD(ballooned_pages); @@ -118,6 +119,7 @@ static void balloon_append(struct page * if (PageHighMem(page)) { list_add_tail(PAGE_TO_LIST(page), &ballooned_pages); bs.balloon_high++; + totalhigh_pages--; } else { list_add(PAGE_TO_LIST(page), &ballooned_pages); bs.balloon_low++; @@ -135,8 +137,10 @@ static struct page *balloon_retrieve(voi page = LIST_TO_PAGE(ballooned_pages.next); UNLIST_PAGE(page); - if (PageHighMem(page)) + if (PageHighMem(page)) { bs.balloon_high--; + totalhigh_pages++; + } else bs.balloon_low--; --Boundary-00=_qrShGUQpfeawPy8 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --Boundary-00=_qrShGUQpfeawPy8--