1. A long time ago I posted a tip on how to regularly free up RAM of the caches and buffers used by Linux (the cache and buffers used does gradually fill up again of course):
http://www.murga-linux.com/puppy/viewtopic.php?t=43298
Code: Select all
#!/bin/sh
sync && echo 3 > /proc/sys/vm/drop_caches
http://www.murga-linux.com/puppy/viewto ... 596#356501
It works.
HOWTO free up swap space:
2. However, for a long time I've noticed another problem in terms of my low-memory (256MByte) low-end (500MHz CPU) old laptop machine, which is currently running Wary 500:
Even when quite a bit of free RAM remains available... the machine has a tendency to eventually use a little swap. Once that happens, I've observed that the machine becomes noticably slower... (even when the amount swapped stays very low - a few tens of kilobytes even...). I suspect a problem with the algorithm used in Linux to determine when swap should occur.
For my machine, I'd like to have no swapping at all unless a certain percentage of RAM was being utilised, but I know of no method for doing exactly that.
I've tried: echo 0 > /proc/sys/vm/swappiness; a mechanism I earlier also discussed here: http://www.murga-linux.com/puppy/viewto ... 506#313208
In practice, however, that does not stop swap occurring.
What does I find work, which is why I'm providing this tip, and I've been using this method for a long time, is to regularly empty swap as follows:
Code: Select all
swapoff <whatever_your_swap_partition_is>
# on my machine I use: swapoff /dev/sda3 (since that's my swap partition...)
swapon <whatever_your_swap_partition_is>
You might like to run "sync" first though I rarely bother...
So if you've noticed your system gradually slowing down, the method I'm suggested may be the "keep-your-old-machine-running-fastish" solution you need...
The method isn't perfect, because if the system RAM really is over-utilised, turning off swap as per the above can crash the system. However, today, when I was looking into the matter further, I stumbled across the following script at help.ubuntu.com which suggested the same as I already do, but which checks for the RAM already over-utilised danger. I haven't bothered providing a ready-made script of this, so just cut and paste it into your favourite text editor, save it as, say, "freeswap", make the script executable and put it in, for example, in /usr/sbin or somewhere in your else in your "PATH"):
Very slightly modified from https://help.ubuntu.com/community/SwapFaq:
Code: Select all
#!/bin/sh
err="not enough RAM to write swap back, nothing done"
mem=$(free|grep Mem:|awk '{print $4}')
swap=$(free|grep Swap:|awk '{print $3}')
[ $mem -lt $swap ] && echo -e $err && exit 1
swapoff <whatever_your_swap_partition_is> && swapon <whatever_your_swap_partition_is> && exit 0
HOWTO somewhat drastically at least resolve a runaway /sbin/udev daemon problem I've come across in irregular circumstances:
3. One last thing I've come across in this system-slowing-down regard (which is probably hard to reproduce without the dodgy power connector problem I have...):
One of my old laptop machines (300MHz Celeron, 256 MBytes, running Wary 500) has a dodgy power connector. For reasons I know nothing about, that occasionally causes a great deal of activity from the daemon: /sbin/udevd --daemon --resolve-names=never Indeed, running "top" when that happens reveals the CPU io load becomes really high when the power becomes intermittent in that fashion; the fan turns on and the machine slows to a crawl... Killing off the /sbin/udevd daemon then has the dramatic effect of fixing the problem... I do wonder why /sbin/udevd doesn't recover by itself when I jiggle the power connector about a bit, which does restore "regular" power to my machine. Perhaps someone has an answer. For now I just mention it here, with what at least is a (somewhat drastic) "remedy".
[EDIT: I'm currently experimenting with running freeupram and freeswap regularly (every ten minutes or so) with cron (in Wary at least, you can use Menu->System->Pschedule to conveniently set up crontab entries)]