lkml.org 
[lkml]   [1999]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Static Swap
On Tue, 13 Apr 1999, Steffen Grunewald wrote:

>> I wanted to know wether linux can instead of having a static
>> size swap have a dynamic size swap . That is if there is disk space
>> available that is there is no valid data , that could be used for swap .
>
>There's the possibility to use swap files instead of swap partitions.
>It has been there for ages now.
>THe only problem is that you cannot free up swap space without
>re-booting (correct me if I'm wrong)

You are wrong. ;o)

If you use a swap file, you can add/remove them on the fly as
needed. If you want dynamic sizing swap, you'll have to write
some sort of daemon which checks every so often the amount of
used swap and compares against 2 threshholds, a high water mark,
and a low water mark. If the low water mark is reached, add some
swap sized based on a fixed granularity, or else use some more
complex algorithm. After so much time has expired, and the swap
space used decreases, have the most newly added space disappear.

man swapon
man swapoff
man mkswap

Create a simple daemon in C to do the dirty work. Shouldn't be
too difficult, but swap files are SLOW compared to partitions,
and dynamically creating them and destroying them will likely end
up with highly fragmented swapspace, and the performance of your
swapping system will be reminiscent of Windows 95 which, by
default uses dynamically resizing temp swap space via file
access. Rediculously slow indeed.

TTYL

--
Mike A. Harris Linux advocate GNU advocate
Computer Consultant Open Source advocate

The DVORAK keyboard layout RULES! I memorized it in 45 minutes
and I don't think I'm ever going back to QWERTY!


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:51    [W:0.201 / U:0.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site