[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [fedora-virt] ksmtuned, v2



On Wed, Sep 16, 2009 at 07:21:14PM +0100, Daniel P. Berrange wrote:
> On Wed, Sep 16, 2009 at 09:19:01PM +0300, Dan Kenigsberg wrote:
> > On Wed, Sep 16, 2009 at 05:46:27PM +0100, Mark McLoughlin wrote:
> > > 
> > > Pushing this to rawhide now
> > 
> > Thanks. Though only now did I notice that you dropped my non-standard
> > "signal" verb. http://gitorious.org/ksm-control-scripts/ksm-control-scripts/commit/84e59d1e2d4c243f010c8a4fdd1c4d147e1cd2ee
> > This is how I want managemet to tell ksmtune that something has changed
> > (new qemu process up, or just died). I want ksm to kick in as soon as
> > this happens, not wait another minute.
> > 
> > If you really hate this, we can add a SIGUSR handler to ksmtune for the
> > same aim.
> 
> I think your 'signal' verb makes sense - I'd just call it 'reload' instead
> 

Mark, would you prefer the attached implementation? (I know I do)
DPB, is the name 'retune' good enough? (I just do not see what is 'loaded')

Dan.
>From 3ddbec1508e505469780ce3561997d5b89824638 Mon Sep 17 00:00:00 2001
From: Dan Kenigsberg <danken redhat com>
Date: Wed, 23 Sep 2009 10:31:28 +0300
Subject: [PATCH 1/2] retune ksm parameters when SIGUSR1 is caught

---
 ksmtuned |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/ksmtuned b/ksmtuned
index f72859f..7da8b68 100644
--- a/ksmtuned
+++ b/ksmtuned
@@ -12,6 +12,9 @@
 # make ksm work harder and harder untill memory load falls below that
 # threshold.
 #
+# send SIGUSR1 to this process right after a new qemu process is started, or
+# following its death, to retune ksm accordingly
+#
 # needs testing and ironing. contact danken redhat com if something breaks.
 
 if [ -f /etc/ksmtuned.conf ]; then
@@ -105,10 +108,16 @@ adjust () {
     return 0
 }
 
+function nothing () {
+    :
+}
+
 loop () {
+    trap nothing SIGUSR1
     while true
     do
-        sleep $KSM_MONITOR_INTERVAL
+        sleep $KSM_MONITOR_INTERVAL &
+        wait $!
         adjust
     done
 }
-- 
1.6.2.5

>From 7eae738c08a20fe70215ec2e74cf2f19cfe08a38 Mon Sep 17 00:00:00 2001
From: Dan Kenigsberg <danken redhat com>
Date: Wed, 23 Sep 2009 10:46:40 +0300
Subject: [PATCH 2/2] add 'retune' verb to ksmtuned.init

---
 ksmtuned.init |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/ksmtuned.init b/ksmtuned.init
index 205531a..46332f8 100644
--- a/ksmtuned.init
+++ b/ksmtuned.init
@@ -75,8 +75,11 @@ case "$1" in
   condrestart)
 	condrestart
 	;;
+  retune)
+        kill -SIGUSR1 `cat ${pidfile}`
+        RETVAL=$?
   *)
-	echo $"Usage: $prog {start|stop|restart|condrestart|status|help}"
+	echo $"Usage: $prog {start|stop|restart|condrestart|status|retune|help}"
 	RETVAL=3
 esac
 
-- 
1.6.2.5


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]