I used the script below to create 10 330 megabyte files; then cpio them
over to another filesystem while another process was constantly allocating
and writing to 85% of VM. It did 77 iterations allocating about 1.6GB of
RAM during the time (10 * 330 * 2) MB worth of files were created and cpio'd.
The test took 53 minutes.
I do most of my work from console.
http://home.earthlink.net/~rwhron/hardware/matrox.html
There was an obvious but not painful delay for interactive use during
the test. An X desktop would be less kind to the user.
Kernel: 2.4.17rc2aa2
Memory: 901804k/917504k available
1027 MB swap.
Athlon 1333
(1) 40GB 7200 rpm IDE disk.
#!/bin/bash
# What does the VM do when copying big files and a memory hog is running.
cmd=${0##*/}
kern=$(uname -r)
typeset -i i
typeset -i j
log=${cmd}-${kern}.log
src=/usr/src/sources
dest=/opt/testing
mtest01=$src/l/ltp*206/testcases/bin/mtest01
percent=85 # vm to fill
uname -a > $log
# create memhog script to run during test
cat>memhog<<EOF
#!/bin/bash
while :
do # allocate and write to $percent of virtual memory
uptime
head -3 /proc/meminfo
egrep 'inode|dentry|buffer' /proc/slabinfo
time $mtest01 -p $percent -w 2>&1
head -3 /proc/meminfo
egrep 'inode|dentry|buffer' /proc/slabinfo
done
EOF
# execute memhog in background
chmod +x memhog
/memhog >> $log 2>&1 &
mpid=$!
# timer
SECONDS=0
vmstat 15 >> $log &
updatedb
rm -rf $src/?/bigfile $dest
mkdir $dest
df -k /opt /usr/src >> $log
# create 10 big files
for ((i=0; i<=9; i++))
do cat $src/[gbl]/*.{gz,bz2} > $src/$i/bigfile
done
ls -l $src/?/bigfile >> $log
size=$(ls -l $src/?/bigfile|awk '{print $5}'|uniq)
num=$(ls $src/?/bigfile|wc -w)
# copy the files
cd $src
find [0-9] -name bigfile|cpio -pdm $dest >> $log
sync
df -k /opt /usr/src
echo $SECONDS to create and copy $num $size byte files >> $log
# kill memhog and vmstat
kill $! $mpid
rm -rf $src/?/bigfile $dest
echo "log is in $log"
-- Randy Hron- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/