xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Kiper <daniel.kiper@oracle.com>
To: ian.campbell@citrix.com, ian.jackson@eu.citrix.com,
	konrad.wilk@oracle.com, xen-devel@lists.xensource.com
Cc: Daniel Kiper <daniel.kiper@oracle.com>
Subject: [PATCH v2 2/2] xl: Add mem_set_enforce_limit option to xl.conf file
Date: Thu, 21 Mar 2013 14:52:59 +0100	[thread overview]
Message-ID: <1363873979-6087-3-git-send-email-daniel.kiper@oracle.com> (raw)
In-Reply-To: <1363873979-6087-1-git-send-email-daniel.kiper@oracle.com>

Add mem_set_enforce_limit option to xl.conf file.
It gives a chance to align xl mem-set behavior
to xm mem-set behavior. Default xl mem-set
behavior is not changed.

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
 docs/man/xl.conf.pod.5   |    9 +++++++++
 tools/examples/xl.conf   |    4 ++++
 tools/libxl/xl.c         |    4 ++++
 tools/libxl/xl.h         |    1 +
 tools/libxl/xl_cmdimpl.c |    2 +-
 5 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/docs/man/xl.conf.pod.5 b/docs/man/xl.conf.pod.5
index 7b9fcac..4e489dd 100644
--- a/docs/man/xl.conf.pod.5
+++ b/docs/man/xl.conf.pod.5
@@ -55,6 +55,15 @@ reduce the amount of memory given to domain 0 by default.
 
 Default: C<1>
 
+=item B<mem_set_enforce_limit=BOOLEAN>
+
+If enabled then C<xl mem-set> will set memory allocation target
+and enforce maximum memory allocation for given domain.
+If disabled then C<xl mem-set> will set memory allocation target
+only for given domain.
+
+Default: C<1>
+
 =item B<run_hotplug_scripts=BOOLEAN>
 
 If disabled hotplug scripts will be called from udev, as it used to
diff --git a/tools/examples/xl.conf b/tools/examples/xl.conf
index b0caa32..7913bd8 100644
--- a/tools/examples/xl.conf
+++ b/tools/examples/xl.conf
@@ -4,6 +4,10 @@
 # memory to create a domain
 #autoballoon=1
 
+# xl mem-set will set memory allocation target and enforce
+# maximum memory allocation for given domain
+#mem_set_enforce_limit=1
+
 # full path of the lockfile used by xl during domain creation
 #lockfile="/var/lock/xl"
 
diff --git a/tools/libxl/xl.c b/tools/libxl/xl.c
index 4c598db..5c445ca 100644
--- a/tools/libxl/xl.c
+++ b/tools/libxl/xl.c
@@ -38,6 +38,7 @@ xentoollog_logger_stdiostream *logger;
 int dryrun_only;
 int force_execution;
 int autoballoon = 1;
+int mem_set_enforce_limit = 1;
 char *blkdev_start;
 int run_hotplug_scripts = 1;
 char *lockfile;
@@ -72,6 +73,9 @@ static void parse_global_config(const char *configfile,
     if (!xlu_cfg_get_long (config, "autoballoon", &l, 0))
         autoballoon = l;
 
+    if (!xlu_cfg_get_long (config, "mem_set_enforce_limit", &l, 0))
+        mem_set_enforce_limit = l;
+
     if (!xlu_cfg_get_long (config, "run_hotplug_scripts", &l, 0))
         run_hotplug_scripts = l;
 
diff --git a/tools/libxl/xl.h b/tools/libxl/xl.h
index b881f92..321a0d0 100644
--- a/tools/libxl/xl.h
+++ b/tools/libxl/xl.h
@@ -143,6 +143,7 @@ int xl_child_pid(xlchildnum); /* returns 0 if child struct is not in use */
 
 /* global options */
 extern int autoballoon;
+extern int mem_set_enforce_limit;
 extern int run_hotplug_scripts;
 extern int dryrun_only;
 extern char *lockfile;
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 2d40f8f..9c83afd 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -2505,7 +2505,7 @@ static void set_memory_target(uint32_t domid, const char *mem)
         exit(3);
     }
 
-    libxl_set_memory_target(ctx, domid, memorykb, 0, /* enforce */ 1);
+    libxl_set_memory_target(ctx, domid, memorykb, 0, mem_set_enforce_limit);
 }
 
 int main_memset(int argc, char **argv)
-- 
1.7.10.4

  parent reply	other threads:[~2013-03-21 13:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-21 13:52 [PATCH v2 0/2] libxl: memory management patches Daniel Kiper
2013-03-21 13:52 ` [PATCH v2 1/2] libxl: xl mem-max et consortes must update static-max in xenstore too Daniel Kiper
2013-03-25 16:17   ` Ian Jackson
2013-04-10  9:02     ` Ian Campbell
2013-03-21 13:52 ` Daniel Kiper [this message]
2013-03-23 13:42   ` [PATCH v2 2/2] xl: Add mem_set_enforce_limit option to xl.conf file Konrad Rzeszutek Wilk
2013-03-25 16:15   ` Ian Jackson
2013-03-26 13:10     ` Konrad Rzeszutek Wilk
2013-03-27 21:02 ` [PATCH v2 0/2] libxl: memory management patches Daniel Kiper

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=1363873979-6087-3-git-send-email-daniel.kiper@oracle.com \
    --to=daniel.kiper@oracle.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=konrad.wilk@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).