Skip to contentSkip to conversation

add tmem capability to directed/self-ballooning and monitor tool

PATCH New Dan Magenheimer 1 participant 1 message Jun 10, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add tmem capability to directed/self-ballooning and monitor tool

[tools/xenballoond] add tmem capability to directed/self-ballooning and monitor tool

(Note to Keir: Patch applies in xen-unstable.hg/tools/xenballoon)

This patch adds tmem support to the largely unknown/unused xenballoond scripts that implement both self-ballooning and a foundation for directed-ballooning. Tmem and automated ballooning are highly complementary in that, when ballooning is over-aggressive, paging and swapping can increase noticably. Precache preserves evicted pages that may be needed again soon (thus eliminating disk reads) and preswap provides memory-based swapping that occurs if ballooning is insufficiently responsive to a sudden increase in activity and memory demand (thus eliminating disk writes and reads).

There are two changes in this patch:

1) The xenballoond service is a convenient place to implement userland "preswap shrinking".**
2) The xenballoon-monitor script is a convenient place to report (and view with "watch -d") the frequent memory rebalancing that results from tmem usage on a busy system.

Note that for best results (and for the monitor script to work), the xenstore-* tools should be installed on each guest.

(** In a disk-based swap device, stale pages are often left
on-disk even after they are no longer needed or valid; they are simply overwritten if/when the disk blocks are needed again, which may be a very long time. Preswap behaves much like a disk, but uses precious pages of memory that count against a guest's memory allocation; thus stale pages are very undesirable. Preswap shrinking periodically attempts to remove stale pages from preswap by using a sysfs interface created by the linux-side tmem patch.)

xenballoon.conf +45 -0
diff -Naur v1-xen3.3/xenballoon.conf v2-tmem/xenballoon.conf
@@ -89,3 +89,48 @@
 # If xenbus is enabled, whether selfballooning or directed ballooning,
 # place the result of 'cat /proc/uptime" on xenbus at memory/uptime
 XENBALLOON_SEND_UPTIME=1
+
+## Type: boolean
+## Default: false
+#
+# If tmem is running, pages swapped to a swap disk may instead go
+# into preswap.  These pages may become stale (i.e. no longer need
+# to be saved because, e.g., the process owning them has gone away)
+# and stale pages use precious precious domain-allocated memory.
+# Periodically try to reduce preswap to squeeze out stale pages
+XENBALLOON_PRESWAP_SHRINK=false
+
+## Type: string
+## Default: "/proc/sys/vm/preswap"
+## (change to /sys/proc/vm/preswap in later kernels)
+#
+# If tmem and preswap are running, reading this file gives the number of
+# pages currently in preswap.  Writing it with N invokes the preswap_shrink
+# routine to reduce preswap to N pages.
+XENBALLOON_PRESWAP_SYSFILE=/proc/sys/vm/preswap
+
+## Type: integer (must be > 0)
+## Default: 20
+#
+# If tmem and preswap are running, attempts to reduce number of pages
+# currently in preswap.  For a value of n, 1/n of the pages will
+# be attempted to be shrunk.
+# If xenbus is enabled, may be overridden by {memory/preswaphysteresis}
+XENBALLOON_PRESWAP_HYSTERESIS=20
+
+## Type: integer (must be > 0)
+## Default: 10
+#
+# Number of ballooning intervals where preswap size remains at N pages
+# before preswap shrinking is attempted.  Also if shrinking fails to
+# shrink to the target, counter resets to this value.
+# If xenbus is enabled, may be overridden by {memory/preswapinertia}
+XENBALLOON_PRESWAP_INERTIA=10
+
+## Type: integer (0 or 1)
+## Default: 1
+#
+# If xenbus is enabled, whether selfballooning or directed ballooning,
+# place the size of preswap (in pages) on xenbus at memory/preswap
+XENBALLOON_SEND_PRESWAP=1
+
xenballoond +75 -2

103 lines not on this page · raw message

xenballoond.init +1 -1
diff -Naur v1-xen3.3/xenballoond.init v2-tmem/xenballoond.init
@@ -2,7 +2,7 @@
 #
 # xenballoond	Script to start and stop Xen ballooning daemon.
 #
-# Copyright (C) 2008 Oracle Corporation and/or its affiliates.
+# Copyright (C) 2009 Oracle Corporation and/or its affiliates.
 # All rights reserved.
 # Written by: Dan Magenheimer <[email protected]>
 #
xenballoon-monitor +32 -16

69 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel