This repository has been archived by the owner on Jun 4, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
88 lines (65 loc) · 3.59 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
$Id: README,v 1.2 1995/05/21 20:26:57 alfie Exp alfie $
Every so often, there is an outcry about the Linux kernel, which goes
something like:
o Shock! Linux will grant requests for memory that it might not be
able to satisfy, and how this is terrible.
o All requests to sbrk() should be given real VM, so that no process
has memory promises broken.
o This is refuted by the fact that many system calls, eg fork(), can
cause a need for more VM, as can even a function call (more stack).
o This then prompts a call for the kernel to be able to dyncamically
add swap space.
o Finally, it is said that a user space daemon would be a more
suitable place to do this.
This is where `swapd' comes in. This is a program that will monitor
the amount of free VM available, and will dynamically add swap files
as needed.
I personally don't use this daemon, but there are people who have made
requests for a program of this sort. So, this is for the people who
want it, or for the people that think they want it...
Swapd will allow free space in the filesystem to be used as swap when
needed by adding additional swap files as needed.
Swapd periodically monitors the amount of free swap available in
the system. It tries to maintain the amount of swap using upper and
lower limits. If the amount of free swap falls below the lower limit,
it will add an extra swapfile. A swap file will be removed if it will
still leave the system with at least the upper limit available.
Since swapping from a file is less efficient than swapping from a
partition, this can be used to `top up' the swap when needed (but will
also work as the sole source of swap).
All of the parameters can either be changed at compile time, or at
run time from the command line. The current defaults are arbitary --
if you find better settings, let me know.
The history of swapd is as follows:
* The idea for swapd was originally conceived when I discovered that
I had failed to compile xv due to being short of 1M of swap (after
having 8+8Mb VM).
* The original code was written in April 1993, but needed extra
code (more parameters, signal handling, and parameter checking).
Also it needed fsync() to hit the streets.
* It sat on my disk until April 1994, where the discussion came up
again, and I tidied up the code, and made it available on request.
Only two people requested it, and no feedback was made.
* In February 1995, the discussion appeared again, and the same offer
was made. This was taken up by more people, and feedback was
received.
* May 1995, since it was found useful, and the code seemed stable
(and bugs fixed) it made it first public release.
* April 1996, updated to deal with the new Linux /proc/meminfo format,
and some small tweaks.
* December 1996, fixed lack of handling for '-p' and added support
for enabling real time scheduling (Andreas Kostyrka).
* August 1998, changes for compilation under glibc.
Thanks to Tim Norman, Jim Nance, and David Groves (and possibly others
I have forgotten) for their encourangement and testing.
Thanks to Marc Merlin who submitted patches for using the new
/proc/meminfo layout, which shamed me into finishing off my own almost
completed patch.
More recently, thanks to Andreas Kostyrka for his submitted patches. If
you are interested, he has an X11 configuration tool, ...
Since I have absolutely no idea who actually is using swapd, please tell
me if you are.
I am releasing swapd under the Gnu Public Licence (GPL). See COPYING
for details.
Nick Holloway
<[email protected]> http://www.alfie.demon.co.uk/