Re: New Feature Idea: Compress swap file

Arnd Bergmann (arnd@uni.de)
Tue, 24 Feb 1998 15:32:15 +0100


On Mon, 23 Feb 1998, Emil Briggs <briggs@bucky.physics.ncsu.edu> wrote:

> >On Sun, 22 Feb 1998, Lars Marowsky-Bree wrote:
> >
> >An ext2 like approximation would work however. Or just
> >queueing up _everything_ at once for writing and have
> >the lowlevel drivers do the work, but that might generate
> >too much I/O at once.
> >

Could we perhaps use a mounted fs for swapping? I'm not talking
of a single swapfile but of the way swapping was done back in the
DOS/Win 2.x days, where each Program had its own temporary file.
OK, a swap file/partition is usually a lot faster than this approach,
but if we have a good mapping for memory areas/filenames, the swap
code doesn't have to mess with bad page sizes of the compressed memory,
hard disk geometry and swap space fragmentation.
As the filesystem evolves (think of reiserfs), swapping will get
better as well. You could even let the fs code do the compression for
you, when you have your swap space on a e2compr (see
http://www.netspace.net.au/~reiter/e2compr/ ). This worked fine with
'DOS-disk-doublers'.

Another thought: It should be easy to have a 'minimum RLE' compression,
which only checkes if the whole pages that is going to be swapped is
empty (all zeroes, or all bytes the same) and then only marking the
pages as empty instead of swapping it to disk. This could be useful when
newly allocated memory is always being cleared.
Maybe this isn't useful at all but if someone could take a look at his
swapfile, he could see if 'empty' pages are swapped that often.

>
> I'm not sure though how to check how good the correlation is,
> particularly since the drive firmware might be doing some
> sort of geometry translation as well.
>

Today's hard disks are optimized to have the best speed in a linear
access. For example, in a linear read, most drives use one sector after
another. When all sectors of one head/cylinder have been used, they move
over to the next head and after the last head, they get to the next
cylinder. (of course)
However, some new drives first use only the cylinders of the first head
and then they move backwards from the last cylinder of the second head
to the first cylinder, because the manufacturers have found out that
it is sometimes faster to move the head to the next track than to switch
over to the next head.

Arnd

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu