how to drop swap?

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Tom Roche
Date:  
To: plug-discuss
Subject: how to drop swap?

Thanks all for the interesting discussion of SSD and now swappiness. One more set of questions along the latter line:

1. Is there a way to force a (Debian) device to {drop, unload, quit using, your more appropriate term here} current swap?
2. Is there no good reason to do this?
3. Is there a good reason to not do this?

Note that by "drop" I do *not* mean "turn off": more below. What I *do* mean:

Periodically free memory on my main workstation (a laptop running LMDE with Cinnamon) will get low, mostly due to my usage of Firefox tabs being wildly out of balance with the box's amount of RAM. (Note this seems to be mostly about undisciplined tab usage, not Firefox: when I run Chrome, I tend to do the same thing, and free memory decreases similarly, though a bit more slowly.) When this happens, I

1. quit Firefox (saving open tabs but not closed tabs)
2. run (via `sudo`) a script that basically does

if [[ $(id -u) -eq 0 ]] ; then
    echo 3 > /proc/sys/vm/drop_caches
    exit 0
else
    echo -e "${ERROR_PREFIX}: must be run as root, exiting..." 1>&2
    exit 1
fi


(Formerly the script also did

cinnamon --replace

which reclaimed a bit more memory. Unfortunately as of Cinnamon version==2.8.6, that hangs.)

This will get me back to nearly as much free memory as I have initially after reboot ... except for swap. Empirically, until I reboot, swap usage is monotonic increasing--it never goes down, only up.

However I *do not* want to turn swap off, because I sleep/suspend the box frequently. I would just like the ability to have the OS drop the swap its holding, because my belief is that holding swap (when one has lots free memory) is unnecessary and degrades performance. Is that belief incorrect? If so, what is "actually the case?"

Alternately, if my belief is correct,

* how to programmatically drop the swap?

* is there a good reason not to do so?

TIA, Tom Roche <>
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss