Search This Blog

Thursday, October 19, 2006


Most of people (even Klauss Knopper [1]) think that swap partition has better performance compare to swapfile (Ok. Most of people don't know what is swap file or swap partition ;). However, it isn't true, at least for 2.6 linux kernel. Check thread at Linux-Kernel Mailing list [ 2]. I think the most important is the 3rd point
Does creating the swapfile on a journaled filesystem (e.g. ext3 or reiser) incur a significant performance hit?
and answer
None at all. The kernel generates a map of swap offset -> disk blocks at swapon time and from then on uses that map to perform swap I/O directly against the underlying disk queue, bypassing all caching, metadata and filesystem code.
[1] Klaus Knopper, "Questions and Answers", Linux Magazine Polish ed., 3(25) March 2006, pp 38-40.
[2] Andre Morton et al., "Swap partition vs swap file" thread Linux-Kernel Mailing List, July 2005.
Post a Comment