Re: Interleaving swap and filesystem to reduce seek times

Mike A. Harris (mharris@ican.net)
Sat, 16 Jan 1999 16:10:36 -0500 (EST)


On Thu, 7 Jan 1999, Oskar Pearson wrote:

>I have a PC at home with 4Mb of ram. To say that it compiles slowly is an
>understatement (it's been compiling the kernel for more than 24 hours now :)
>
>When I originally installed Linux, I placed my swap at the beginning of the
>disk, leaving the rest to data.
>
>Since the machine has so little ram the cpu is 98% idle, it simply waits for the
>disk heads to seek from one end of the disk (where the swap is) to the
>middle of the disks (where the data is). Listening to this 'seek, seek,
>seek' ad nauseum, it occurred to me that if I had put the swap in the middle
>of the disk, average seek time would have been less.
>
>I think it's possible to generalise this, though. (And I am sure that I am
>not the first to think about this.)
>
>Modern filesystems spread their inodes around the disk: only very old ones
>kept their inode lists right at the beginning of the disk.
>
>If we were to interleave the swap and filesystem, the seek time would (for
>machines with one disk, at least) be reduced.
>
>The kernel could also decide which section of swap to write to based on the
>current position of the disk heads: if the heads seek back and forth
>between the gcc compiler binary (to page the original binary back into
>memory) and the source code, an intermediate block of swap could be used.
>Disk head movements would then be limited to a fairly small section of
>disk.
>
>Has anyone seen any references to this? Has it been tried and discarded?

Hi Oskar,

When I read your suggestion, I thought it was a fantastic idea!
You could start out with ext2, and add some special swap feature
to it. mke2fs would need to be modified likely.

It sounds very complex, but I for one am interested in hearing
about any development in this area. I have several systems here
which I could use for testing out any patches or code you may
have. They are slower systems (386/486) but would just magnify
any gains/losses that the new swap system would give.

Example:

mke2fs -c --swap-reserve 65536 /dev/hda1

This would format the disk, reserving 64M for swap, but
interleaving it all over the filesystem. In theory, it could be
backwards compatible with ext2. Also, it should be possible to
reclaim the swap space for the filesystem as well. Kindof the
same way you can reclaim reserved space on a filesystem.

Personally, I think it is a fantastic idea! Let me know if you
(or anyone else) gets working on this.

TTYL

--
Mike A. Harris  -  Computer Consultant  -  Linux advocate

Linux software galore: http://freshmeat.net

- 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/