Commit 64e4f41c authored by Mike Hibler's avatar Mike Hibler
Browse files

Make it easier to tweak the amount of "reserved" memory (memory that

frisbee won't suck up for buffering).  Also check the kernel limit for
maximum datasize and take that into account.  (Related to this: I have
changed the frisbee MFS loader.conf file to set kern.maxdsiz=2000000000)
parent da4f1e82
...@@ -5,6 +5,12 @@ ...@@ -5,6 +5,12 @@
# All rights reserved. # All rights reserved.
# #
#
# Amount of memory in MB to leave for everyone else in the system. If you
# get out-of-memory or vm_pager error while running frisbee, increase this.
#
RESIDMEM=32
if [ -r /etc/emulab/paths.sh ]; then if [ -r /etc/emulab/paths.sh ]; then
. /etc/emulab/paths.sh . /etc/emulab/paths.sh
else else
...@@ -38,7 +44,7 @@ DISK=`echo $LOADINFO | awk -F= '{ printf $5 }' | awk -F' ' '{ print $1 }'` ...@@ -38,7 +44,7 @@ DISK=`echo $LOADINFO | awk -F= '{ printf $5 }' | awk -F' ' '{ print $1 }'`
DISK=${DISK:-'ad0'} DISK=${DISK:-'ad0'}
if [ "$PARTITION" != "0" ]; then if [ "$PARTITION" != "0" ]; then
SLICE="-s $PARTITION"; SLICE="-s $PARTITION"
case $PARTOS in case $PARTOS in
FreeBSD) FreeBSD)
SLICE="$SLICE -D 165" SLICE="$SLICE -D 165"
...@@ -64,16 +70,21 @@ fi ...@@ -64,16 +70,21 @@ fi
# #
# set memory limits: # set memory limits:
# allow 16MB for non-frisbee stuff # allow $RESIDMEM MB for non-frisbee stuff
# split remaining memory (at least 2MB) between network/disk buffering # split remaining memory (min of 2MB) between network/disk buffering
# in frisbee
# #
HOSTMEM=`sysctl -n hw.usermem` HOSTMEM=`sysctl -n hw.usermem`
HOSTMEM=`expr $HOSTMEM / 1024` HOSTMEM=`expr $HOSTMEM / 1048576`
if [ $HOSTMEM -ge 26624 ]; then if [ $HOSTMEM -ge `expr $RESIDMEM + 2` ]; then
HOSTMEM=`expr $HOSTMEM - 24576` HOSTMEM=`expr $HOSTMEM - $RESIDMEM`
ulimit -v $HOSTMEM BYTES=`expr $HOSTMEM \* 1024`
HOSTMEM=`expr $HOSTMEM / 1024` DATASEGSZ=`ulimit -d`
if [ $BYTES -gt $DATASEGSZ ]; then
BYTES=$DATASEGSZ
HOSTMEM=`expr $BYTES / 1024`
echo "WARNING: kernel limits buffering to $HOSTMEM MB"
fi
ulimit -v $BYTES
## For GaTech we use more memory for disks since the disks are so slow ## For GaTech we use more memory for disks since the disks are so slow
#NETMEM=`expr $HOSTMEM \* 1 / 3` #NETMEM=`expr $HOSTMEM \* 1 / 3`
...@@ -86,24 +97,24 @@ if [ $HOSTMEM -ge 26624 ]; then ...@@ -86,24 +97,24 @@ if [ $HOSTMEM -ge 26624 ]; then
fi fi
if [ x"$ADDRESS" != x ]; then if [ x"$ADDRESS" != x ]; then
PORT=`echo $ADDRESS | awk -F: '{ printf $2 }'`; PORT=`echo $ADDRESS | awk -F: '{ printf $2 }'`
MCAST=`echo $ADDRESS | awk -F: '{ printf $1 }'`; MCAST=`echo $ADDRESS | awk -F: '{ printf $1 }'`
if [ -e $BOOTDIR/myip ]; then if [ -e $BOOTDIR/myip ]; then
MCASTIF="-i `cat $BOOTDIR/myip`" MCASTIF="-i `cat $BOOTDIR/myip`"
else else
MCASTIF="" MCASTIF=""
fi fi
MCASTADDR="-m $MCAST -p $PORT"; MCASTADDR="-m $MCAST -p $PORT"
echo "Running $BINDIR/frisbee $LOADIP $MEMARGS $SLICE $MCASTIF $MCASTADDR /dev/$DISK at `date`"; echo "Running $BINDIR/frisbee $LOADIP $MEMARGS $SLICE $MCASTIF $MCASTADDR /dev/$DISK at `date`"
$BINDIR/tmcc state RELOADING; $BINDIR/tmcc state RELOADING
$BINDIR/frisbee $LOADIP $MEMARGS $SLICE $MCASTIF $MCASTADDR /dev/$DISK; $BINDIR/frisbee $LOADIP $MEMARGS $SLICE $MCASTIF $MCASTADDR /dev/$DISK
case $? in case $? in
0) 0)
echo "Frisbee run finished"; echo "Frisbee run finished"
echo "Resizing final disk partition"; echo "Resizing final disk partition"
$BINDIR/growdisk -vW /dev/$DISK; $BINDIR/growdisk -vW /dev/$DISK
# #
# XXX limit the use of slicefix for now to just # XXX limit the use of slicefix for now to just
# those machines with "ad4" as their root disk # those machines with "ad4" as their root disk
...@@ -112,10 +123,10 @@ if [ x"$ADDRESS" != x ]; then ...@@ -112,10 +123,10 @@ if [ x"$ADDRESS" != x ]; then
echo "Adjusting slice-related files"; echo "Adjusting slice-related files";
$BINDIR/slicefix $PARTITION $DISK $BINDIR/slicefix $PARTITION $DISK
fi fi
echo "Image load complete, rebooting ..."; echo "Image load complete, rebooting ..."
$BINDIR/tmcc state RELOADDONE; $BINDIR/tmcc state RELOADDONE
/sbin/reboot; /sbin/reboot
sleep 100; sleep 100
;; ;;
*) *)
echo "Frisbee run failed, status $?" echo "Frisbee run failed, status $?"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment