linuxlinux-kernelpaging

Does Linux 0.11 support swap space?


I'm currently looking into Linux 0.11 source code. I can't find any swapping mechanism in the page_fault_handler or any other part of the code. It seems that 0.11 doesn't support swap space for main memory. Please tell me, am I right?


Solution

  • You are right. Seems like swap support was added in Linux 0.12 (January 15, 1992), here's the commit (2ab763b2e26be65551e717bd547497ffb9ba7267). The implementation is at mm/swap.c and the file did not exist prior to this point.

    The relevant excerpt from the commit message is:

    Major milestone! Over the christmas break, I implemented paging to disk, meaning that you could actually use gcc on a 2MB system. Some poor sod (Robert Blum) wanted to use Linux on such a system, and couldn't get the kernel to compile with anything less "bloated" than gcc.

    [...]

    Virtual memory.

    In addition to the "mkfs" program, there is now a "mkswap" program on the root disk. The syntax is identical: "mkswap -c /dev/hdX nnn", and again: this writes over the partition, so be careful. Swapping can then be enabled by changing the word at offset 506 in the bootimage to the desired device. Use the same program as for setting the root file system (but change the 508 offset to 506 of course).

    NOTE! This has been tested by Robert Blum, who has a 2M machine, and it allows you to run gcc without much memory. HOWEVER, I had to stop using it, as my diskspace was eaten up by the beta-gcc-2.0, so I'd like to hear that it still works: I've been totally unable to make a swap-partition for even rudimentary testing since about christmastime. Thus the new changes could possibly just have backfired on the VM, but I doubt it.