# HG changeset patch # User kaf24@firebug.cl.cam.ac.uk # Date 1148565283 -3600 # Node ID 79d74ce206bbd4a4bfc5fa4890b442522da03223 # Parent 1449c0f57b9dc55c85732401bce24a3cdc54ddbd [BALLOON] Do not allow target to be set below two percent of maximum memory size. Signed-off-by: Keir Fraser diff -r 1449c0f57b9d -r 79d74ce206bb linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c --- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Thu May 25 14:47:23 2006 +0100 +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Thu May 25 14:54:43 2006 +0100 @@ -360,6 +360,12 @@ static void balloon_process(void *unused /* Resets the Xen limit, sets new target, and kicks off processing. */ static void set_new_target(unsigned long target) { + unsigned long min_target; + + /* Do not allow target to reduce below 2% of maximum memory size. */ + min_target = max_pfn / 50; + target = max(target, min_target); + /* No need for lock. Not read-modify-write updates. */ hard_limit = ~0UL; target_pages = target;