Tux

...making Linux just a little more fun!

Brings back swapped out pages

Mulyadi Santosa [mulyadi.santosa at gmail.com]
Sat, 16 Dec 2006 21:12:28 +0700

After you start a memory-hogger application such as manipulating a large bitmap graphic file, some portions of RAM are likely pushed away to swap. This is normal especially if you have not so big RAM (256MB or less). The problem is, after you finish with this application, whatever you do will be creepingly slow since those pages must be brought back to RAM.

One way you can try is to do these:

# swapoff -a
(wait for some seconds... continue after hard disk's LED stops blinking)
# swapon -a
Swapoff will push everything back to RAM and eventuall disables the swap spaces. Simply execute swapon to enable them again. If you want to play safe, check free output first:
# free -m
             total       used       free     shared    buffers     cached
Mem:           249        170         79          0         12         45
-/+ buffers/cache:        111        137
Swap:          376          0        376
There you can find out that the free RAM (free+buffers+cached) exceeds the size of used swap space (in this case, since nothing is there, it is zero). Knowing this, swapoff will sucessfully push things back to RAM

Another way you can try, is to use swap prefetch feature included in Con Kolivas patchset (-ck). You can find it in kernel.kolivas.org and it's also included in -mm (Andrew Morton) patchset.

I hope this tip is useful for all of LG readers.

regards,

Mulyadi Santosa, RHCE


Top    Back


Predrag Ivanovic [predivan at ptt.yu]
Tue, 19 Dec 2006 14:58:09 +0100

On Sat, 16 Dec 2006 21:12:28 +0700 Mulyadi Santosa wrote:

<snip swapon/swapoff>

> 
> Another way you can try, is to use swap prefetch feature included in Con 
> Kolivas patchset (-ck). You can find it in kernel.kolivas.org and it's also 
> included in -mm (Andrew Morton) patchset.
> 

Recently, Con posted a swap prefetch tester to ck ML[1], so it's possible to test benefits of swap prefetch feature from ck patchset. Several results are also in that thread, and it seems it does make a difference.

[1]http://bhhdoa.org.au/pipermail/ck/2006-December/006503.html

Pedja

-- 
"There are some benefits to high blood pressure", Bob mused as
another mosquito exploded.
            --  Bulwer-Lytton contest entry, author unknown.

Top    Back