On Tue, Nov 24, 2009 at 12:52:51PM -0600, Justin M. Forbes wrote:
> On Tue, Nov 24, 2009 at 04:31:34PM +0200, Dan Kenigsberg wrote:
> > ---
> >  ksmtuned      |   25 ++++++++++++++++---------
> >  ksmtuned.conf |    5 +++++
> >  2 files changed, 21 insertions(+), 9 deletions(-)
> > 
> > diff --git a/ksmtuned b/ksmtuned
> > index 7da8b68..decf41d 100644
> > --- a/ksmtuned
> > +++ b/ksmtuned
> > @@ -21,6 +21,13 @@ if [ -f /etc/ksmtuned.conf ]; then
> >      . /etc/ksmtuned.conf
> >  fi
> >  
> > +debug() {
> > +    if [ -n "$DEBUG" ]; then
> > +        s="`/bin/date`: $*"
> > +        [ -n "$LOGFILE" ] && echo "$s" >> "$LOGFILE" || echo "$s"
> > +    fi
> > +}
> > +
> >  KSM_MONITOR_INTERVAL=${KSM_MONITOR_INTERVAL:-60}
> >  KSM_NPAGES_BOOST=${KSM_NPAGES_BOOST:-300}
> >  KSM_NPAGES_DECAY=${KSM_NPAGES_DECAY:--50}
> > @@ -35,17 +42,17 @@ KSM_THRES_COEF=${KSM_THRES_COEF:-20}
> >  KSM_THRES_CONST=${KSM_THRES_CONST:-2048}
> >  
> >  total=`awk '/^MemTotal:/ {print $2}' /proc/meminfo`
> > -[ -n "$DEBUG" ] && echo total $total
> > +debug total $total
> >  
> >  npages=0
> >  sleep=$[KSM_SLEEP_MSEC * 16 * 1024 * 1024 / total]
> >  [ $sleep -le 10 ] && sleep=10
> > -[ -n "$DEBUG" ] && echo sleep $sleep
> > +debug sleep $sleep
> >  thres=$[total * KSM_THRES_COEF / 100]
> >  if [ $KSM_THRES_CONST -gt $thres ]; then
> >      thres=$KSM_THRES_CONST
> >  fi
> > -[ -n "$DEBUG" ] && echo thres $thres
> > +debug thres $thres
> >  
> >  KSMCTL () {
> >      case x$1 in
> > @@ -89,22 +96,22 @@ adjust () {
> >      local free committed
> >      free=`free_memory`
> >      committed=`committed_memory`
> > -    [ -n "$DEBUG" ] && echo committed $committed free $free
> > +    debug committed $committed free $free
> >      if [ $[committed + thres] -lt $total -a $free -gt $thres ]; then
> >          KSMCTL stop
> > -        [ -n "$DEBUG" ] && echo "$[committed + thres] < $total and free > 
> > $thres, stop ksm"
> > +        debug "$[committed + thres] < $total and free > $thres, stop ksm"
> >          return 1
> >      fi
> > -    [ -n "$DEBUG" ] && echo "$[committed + thres] > $total, start ksm"
> > +    debug "$[committed + thres] > $total, start ksm"
> >      if [ $free -lt $thres ]; then
> >          npages=`increase_npages $KSM_NPAGES_BOOST`
> > -        [ -n "$DEBUG" ] && echo "$free < $thres, boost"
> > +        debug "$free < $thres, boost"
> >      else
> >          npages=`increase_npages $KSM_NPAGES_DECAY`
> > -        [ -n "$DEBUG" ] && echo "$free > $thres, decay"
> > +        debug "$free > $thres, decay"
> >      fi
> >      KSMCTL start $npages $sleep
> > -    [ -n "$DEBUG" ] && echo "KSMCTL start $npages $sleep"
> > +    debug "KSMCTL start $npages $sleep"
> >      return 0
> >  }
> >  
> > diff --git a/ksmtuned.conf b/ksmtuned.conf
> > index 87b9178..fc4518c 100644
> > --- a/ksmtuned.conf
> > +++ b/ksmtuned.conf
> > @@ -14,3 +14,8 @@
> >  
> >  # KSM_THRES_COEF=20
> >  # KSM_THRES_CONST=2048
> > +
> > +# uncomment the following if you want ksmtuned debug info
> > +
> > +# LOGFILE=/var/log/ksmtuned
> > +# DEBUG=1
> > -- 
> 
> Patch looks good, I will get it applied. I will also add a logrotate file
> so that this log doesn't grow unrestrained.
> 
> Justin

Mark, Justin: would you push it for Fedora 13?
_______________________________________________
virt mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/virt

Reply via email to