PREV UP NEXT The Ftape Installation and Usage Guide - Ftape Tools


7.1.1: Swapout, the memory de-fragmentation utility

You'll need the swapout utility when you stumble over messages like `Couldn't allocate dma-buffer #0' printed to your kernel message log files. The swapout program is part of the separate ftape-tools distribution which can be downloaded from the usual places(1)

The following is an attempt to give you some hints why the swapout program is needed. See Swapout (info file ftape-tools).

The data on a floppy tape cartridge is organised in entities of 1024 bytes, so called sectors. 32 of those sectors constitute a so called floppy tape segment. When the tape is running (i.e. when you make backups or restore data) there is enough time between two subsequent floppy tape segments to program the floppy tape controller and the DMA controller for the next segment. In essence this means that one needs to transfer the data from the host computer to the floppy tape in 32kb entities. Therefore one needs contiguous pieces of RAM of size 32Kb. The physical RAM of the computer, however, is organised in entities of 4Kb, so called pages. This means that it might be very well the case that there is indeed plenty of free RAM on your computer system, but the RAM is fragmented in a way that the system (Linux) is unable to provide pieces of 32Kb of contiguous memory.

To cope with this problem, there exists a small and ugly, but useful, utility called swapout, which does nothing but allocate a HUGE chunk of memory, dirty all pages (i.e. force the system to really allocate those pages) and exit. This forces the Linux kernel to swap out quite a lot of RAM. As a result, the physical RAM of the computer gets de-fragmented (if you are lucky ...).

The program swapout takes an optional parameter that specifies the amount of memory to allocate in megabytes. E.g.

swapout 15

allocates 15 Megs of memory (2). By default swapout allocates 5 Megs of memory. It might be necessary to tune this to get reasonable de-fragmentation of the system's memory. If you own a computer with plenty of RAM it might be necessary to make swapout allocate more than 5 Megs (3).

You may want to automatically run swapout when loading the driver with modprobe. See Inserting ftape. swapout is only available on your system if you installed the ftape-tools package. Also `/usr/local/bin/' only reflects the default installation path of swapout and may be different on your system. See Optional utilities.


(1) Ftape home page
or
ftp://sunsite.unc.edu/pub/Linux/kernel/tapes/

(2) Note for Un*x novices: once a process has finished it returns all allocated memory back to the operating system. A program that allocates, say, 100 Megs of memory, automatically releases this memory when it ceases to exist. This means that you needn't worry about swapout eating up all of the memory of you computer.

(3) My machine currently has 20 megabytes of RAM and I call swapout with an argument of 15, making it allocate 15 megabytes of memory. Make sure that you have enough swap space ... More up-to-date note: My most recent bought system has 128mb of RAM, and I never have experienced this problem with that machine ... lucky me ...


ftape logo Use these buttons to jump to the top menu

TOP (previous node) TOP (parent node) TOP (next node) TOP (this node)