I have:
$ free
total used free shared buffers cached
Mem: 16586352 16040828 545524 0 84724 14219280
-/+ buffers/cache: 1736824 14849528
Swap: 4192960 252 4192708
Three virtual machines (VMPlayer) are open. And no swap is in use. Then
I syncronyze the .thunderbird directory, using rsync, with the host.
Before that, in conky, I had
Swap Usage: 0/4.00GiB
After the syncronyzation, I have:
Swap Usage: 252KiB/4.00GiB
Swap is 1/4 of total RAM, partition was created when the system had
4.00GiB of RAM. As never have gotten close even to half use, did not
bother to increase the size.
However, I run a script:
$ ./.find-out-what-is-using-your-swap.sh | sort -nk3
Overall swap used: 0 KB
Script reproduced below. Line in conky is:
${color lightgrey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar}
I do not understand:
1. Why the discrepancy?
2. How a system with so much RAM is swapping?
Is there a difference in the way the script and conky ways of finding
the swap use?
Swap gets worse recurrently, for example, if I build and install a
kernel simultaneously in three VM and the host (actually, I also do it
in another LFS using chroot at the same time, but even without it, the
difference appears). But then, the script finds out what is swapping.
A different doubt, as I have just talked about it: why the chrooted
system takes more than twice the time than any of the other 4 machines
to build the same kernel, i.i., why would it be so much slower?
[]s,
Fernando
#!/bin/bash
# Get current swap usage for all running processes
# Erik Ljungstrom 27/05/2011
# http://northernmost.org/blog/find-out-what-is-using-your-swap/
# Modified by Mikko Rantalainen 2012-08-09
#
http://stackoverflow.com/questions/479953/how-to-find-out-which-processes-are-swapping-in-linux
# Pipe the output to "sort -nk3" to get sorted output
SUM=0
OVERALL=0
for DIR in `find /proc/ -maxdepth 1 -type d -regex "^/proc/[0-9]+"`
do
PID=`echo $DIR | cut -d / -f 3`
PROGNAME=`ps -p $PID -o comm --no-headers`
for SWAP in `grep Swap $DIR/smaps 2>/dev/null | awk '{ print $2 }'`
do
let SUM=$SUM+$SWAP
done
if (( $SUM > 0 )); then
echo "PID=$PID swapped $SUM KB ($PROGNAME)"
fi
let OVERALL=$OVERALL+$SUM
SUM=0
done
echo "Overall swap used: $OVERALL KB"
--
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page