...making Linux just a little more fun!

<-- prev | next -->

2-Cent Tips

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.


Mulyadi Santosa, RHCE

[ Thread continues here (2 messages/2.60kB) ]

The danger of too many related config variables

Benjamin A. Okopnik [ben at linuxgazette.net]
Tue, 31 Oct 2006 15:06:37 -0500

Well, I've just learned something important.

In rewriting the mini-MTA I've been working on, "bssmtp", I've stayed with the original code and procedure where I thought they were OK; at least where I assumed they were OK. I just got bitten, hard, by that assumption - with the result that I could send mail to anyone but TAG and Lgang for the past X hours.

Here's the relevant part of my 'bssmtprc':

# Information about the local host
# domain=linuxgazette.net
# Information about the mail relay
# preconnect=/usr/bin/ssh -f rick 'sleep 10'
preconnect=/usr/bin/ssh -f lg 'sleep 10'
# port=2525
In order to switch hosts, I have to flip the 'domain', the 'preconnect', and the 'port' options - and I fat-fingered the first one, so Rick's MTA has been rejecting my mail left and right.

The very next code tweak to go into "bssmtp" is to have a "domain:hostname:port:preconnect" line per *bloody* host. I spent enough hours battling this problem this morning that I never want to do that kind of crap again - or expose anyone else to it.

* Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *

Talkback: Discuss this article with The Answer Gang

Copyright © 2007, . Released under the Open Publication license unless otherwise noted in the body of the article. Linux Gazette is not produced, sponsored, or endorsed by its prior host, SSC, Inc.

Published in Issue 134 of Linux Gazette, January 2007

<-- prev | next -->