From: Dmitry Torokhov <dtor@vmware.com>
To: linux-kernel@vger.kernel.org
Cc: pv-drivers@vmware.com
Subject: [RFC/PATCH 1/2] VMware balloon: add module parameter limiting ballon size
Date: Tue, 29 Jun 2010 16:15:43 -0700 [thread overview]
Message-ID: <1277853344-19617-1-git-send-email-dtor@vmware.com> (raw)
From: Wei Huang <whuang@vmware.com>
To avoid over-ballooning a VM and causing OOM situation introduce module
parameter allowing to specify amount of memory (percentage-wise) that is
reserved for the kernel, and which is not balloonable.
Signed-off-by: Wei Huang <whuang@vmware.com>
Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
---
Documentation/kernel-parameters.txt | 4 ++++
drivers/misc/vmware_balloon.c | 18 ++++++++++++++----
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 82d6aeb..3aabe6e 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2813,6 +2813,10 @@ and is between 256 and 4096 characters. It is defined in the file
vmpoff= [KNL,S390] Perform z/VM CP command after power off.
Format: <command>
+ vmware_balloon.os_percentage =
+ [HW] Percentage of memory reserved for OS needs and
+ therefore is not balloonable. Default is 20%.
+
vt.cur_default= [VT] Default cursor shape.
Format: 0xCCBBAA, where AA, BB, and CC are the same as
the parameters of the <Esc>[?A;B;Cc escape sequence;
diff --git a/drivers/misc/vmware_balloon.c b/drivers/misc/vmware_balloon.c
index 2a1e804..061cc3e 100644
--- a/drivers/misc/vmware_balloon.c
+++ b/drivers/misc/vmware_balloon.c
@@ -45,13 +45,13 @@
MODULE_AUTHOR("VMware, Inc.");
MODULE_DESCRIPTION("VMware Memory Control (Balloon) Driver");
-MODULE_VERSION("1.2.1.1-k");
+MODULE_VERSION("1.2.1.2-k");
MODULE_ALIAS("dmi:*:svnVMware*:*");
MODULE_ALIAS("vmware_vmmemctl");
MODULE_LICENSE("GPL");
/*
- * Various constants controlling rate of inflaint/deflating balloon,
+ * Various constants controlling rate of inflating/deflating balloon,
* measured in pages.
*/
@@ -218,6 +218,14 @@ static struct vmballoon balloon;
static struct workqueue_struct *vmballoon_wq;
/*
+ * We reserve, by default, 20% of the total RAM for OS needs, limiting
+ * balloon size to 80% of the total RAM.
+ */
+static unsigned int vmballoon_os_percentage = 20;
+module_param_named(os_percentage, vmballoon_os_percentage, uint, 0644);
+MODULE_PARM_DESC(os_percentage, "Amount of memory reserved for OS and therefore is not balloonable (default=20%)");
+
+/*
* Send "start" command to the host, communicating supported version
* of the protocol.
*/
@@ -651,7 +659,7 @@ static void vmballoon_work(struct work_struct *work)
{
struct delayed_work *dwork = to_delayed_work(work);
struct vmballoon *b = container_of(dwork, struct vmballoon, dwork);
- unsigned int target;
+ unsigned int max_target, target;
STATS_INC(b->stats.timer);
@@ -663,7 +671,9 @@ static void vmballoon_work(struct work_struct *work)
if (vmballoon_send_get_target(b, &target)) {
/* update target, adjust size */
- b->target = target;
+ max_target = b->sysinfo.totalram *
+ (100 - vmballoon_os_percentage) / 100;
+ b->target = min(target, max_target);
if (b->size < target)
vmballoon_inflate(b);
--
1.7.0
next reply other threads:[~2010-06-29 23:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-29 23:15 Dmitry Torokhov [this message]
2010-06-29 23:15 ` [RFC/PATCH 2/2] VMware balloon: add page sharing interface Dmitry Torokhov
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=1277853344-19617-1-git-send-email-dtor@vmware.com \
--to=dtor@vmware.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pv-drivers@vmware.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.