All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ky Srinivasan" <ksrinivasan@novell.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] Implement a floor for xm mem-set
Date: Fri, 19 May 2006 10:14:47 -0600	[thread overview]
Message-ID: <446DB6B7.E57C.0030.0@novell.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 191 bytes --]

The attached (trivial)  patch implements a floor for the memory a domain
can be ballooned down to.

Please apply this to 3.0 as well

Signed-off-by K. Y. Srinivasan <ksrinivasan@novell.com>


[-- Attachment #2: balloon.diff --]
[-- Type: application/octet-stream, Size: 1553 bytes --]

--- linux-2.6.16/drivers/xen/balloon/balloon.c	2006-05-15 02:57:14.000000000 -0400
+++ NEW/drivers/xen/balloon/balloon.c	2006-05-15 03:00:48.000000000 -0400
@@ -370,11 +370,29 @@
 	.node = "memory/target"
 };
 
+/*
+ * Compute the minimum value this domain can be ballooned down to 
+ * (in kilo bytes). This is little over 2% of the maximum pages the domain
+ * will ever handle (with a floor).
+ */
+static unsigned long long  min_target(void)
+{
+	unsigned long long	min_mem;
+	
+
+	min_mem = 
+	(192000 +  (((max_pfn << (PAGE_SHIFT -10))) >> 6) +
+	(((max_pfn << (PAGE_SHIFT -10))) >> 7));
+	
+	return (min_mem);
+}
+
 /* React to a change in the target key */
 static void watch_target(struct xenbus_watch *watch,
 			 const char **vec, unsigned int len)
 {
 	unsigned long long new_target;
+	unsigned long long min_value = min_target();
 	int err;
 
 	err = xenbus_scanf(XBT_NULL, "memory", "target", "%llu", &new_target);
@@ -382,12 +400,17 @@
 		/* This is ok (for domain0 at least) - so just return */
 		return;
 	} 
-        
+
 	/* The given memory/target value is in KiB, so it needs converting to
 	   pages.  PAGE_SHIFT converts bytes to pages, hence PAGE_SHIFT - 10.
+	   But first make sure that we are not lowering the value below the 
+	   "minimum".
 	*/
-	set_new_target(new_target >> (PAGE_SHIFT - 10));
-    
+	if (new_target > min_value) {
+		set_new_target(new_target >> (PAGE_SHIFT - 10));
+	} else {
+		set_new_target(min_value >> (PAGE_SHIFT - 10));
+	}
 }
 
 static int balloon_init_watcher(struct notifier_block *notifier,

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

                 reply	other threads:[~2006-05-19 16:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=446DB6B7.E57C.0030.0@novell.com \
    --to=ksrinivasan@novell.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.