From: "Jan Beulich" Subject: RE: [PATCH] linux/balloon: don't allow ballooning down a domain below a reasonable limit Date: Tue, 13 May 2008 08:08:15 +0100 Message-ID: <48295A7F.76E4.0078.0@novell.com> References: <481B7A01020000780004B919@vpn.id2.novell.com> <20080509143852937.00000000936@djm-pc> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20080509143852937.00000000936@djm-pc> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "dan.magenheimer@oracle.com" Cc: Ky Srinivasan , "xen-devel@lists.xensource.com" , "keir.fraser@eu.citrix.com" , "garloff@suse.de" List-Id: xen-devel@lists.xenproject.org >>> "Dan Magenheimer" 09.05.08 22:38 >>> >Hmmm... it appears to me that minimum_target() doesn't >work when balloon.c is built as a module (always returns 0). > >Can you confirm/deny? Yes, that's a change Keir did after noticing that I used an improper variable (totalram_pages) to base the calculation upon in the modular case (max_pfn is not exported anymore in newer kernels). It should be possible though to base the calculation on num_physpages, as in the patch below. Jan --- head-2008-04-15.orig/drivers/xen/balloon/balloon.c +++ head-2008-04-15/drivers/xen/balloon/balloon.c @@ -198,8 +198,8 @@ static unsigned long current_target(void static unsigned long minimum_target(void) { #ifndef CONFIG_XEN - return 0; -#else +#define max_pfn num_physpages +#endif unsigned long min_pages, curr_pages =3D current_target(); =20 #define MB2PAGES(mb) ((mb) << (20 - PAGE_SHIFT)) @@ -227,7 +227,7 @@ static unsigned long minimum_target(void =20 /* Don't enforce growth */ return min(min_pages, curr_pages); -#endif +#undef max_pfn } =20 static int increase_reservation(unsigned long nr_pages)