This commit was generated by cvs2svn to track changes on a CVS vendor
[unix-history] / usr.sbin / swapinfo / README
CommitLineData
4d554349
NW
1swapinfo
2========
3
4Swapinfo is designed to provide some information to the user about the
5state of the swap space on the system. I've written it based on a
6brief (!) perusal of the VM code in 386BSD. I could be pretty confused
7about how it all fits together, and perhaps this is totally bogus.
8It seems to work for me, though.
9
10How it works:
11
12During startup, the system traverses the list of configured swap partitions,
13and determines the size of the various partitions. As each new partition
14is added for swapping (via swapon), the free space on that disk is added
15to a linked list of free space. Adjacent areas are coalesced to form
16larger areas. The swapping algorithm seems to take the first free section
17that it finds [?].
18
19Swapinfo reads in the list of configured swap partitions from the /dev/kmem,
20to determine the size of the partitions. It then traverses the list
21of free space, figuring up how much is still available and how much
22has therefore been used. Things get a little hairy in that the swap space
23is divided amongst the configured swap partitions so that the first
244096 blocks of swap go on the first swap partition, the second 4096 on
25the second swap partition, and so on. This works out to be a fairly
26simple bit of code, though.
27
28More caveats:
29
30This works on my system. Your milage may vary. Since I'm reading /dev/kmem
31to follow a linked list, the program could easily get lost looking for
32some free space if anything got changed between reads of /dev/kmem.
33If you get occasional inconsistant results, ignore 'em.
34
35Feel free to send bug reports, flames, etc., to:
36
37Kevin Lahey
38kml@rokkaku.atl.ga.us