[linux-elitists] Performance issues with swap file vs. swap partition

Jason Spence jspence@lightconsulting.com
Thu Nov 6 12:15:38 PST 2003


On Thu, Nov 06, 2003 at 02:22:15PM -0500, Matthew Galgoci wrote: 
> > I might also mention, adding the swap partition to the end of your drive 
> > should give you a little more speed since the partitions are setup from 
> > the inside of the disk spreading out.
> 
> I've actually wondered about this before, and as far as I've been
> told that the physical location of start and end of the drive are
> undefined and not necessarily where you might intuitively expect
> them to be.

This is true.  For a while I was disassembling drive firmware and you
would not believe the kinds of things the disk manufacturers do these
days.

Highlights:

 - Some disks actually have 2x or 3x the advertised capacity, but this
   extra capacity is wiped through a low level format process you
   can't undo using the GMR heads on the disk itself.  This is done to
   make the disks hit certain market price points or for compatibility
   or whatever.

 - Many disks have a big chunk of unused raw capacity interleaved
   throughout the disk or located at the beginning or end.  This area
   is used to store blocks which have been ECC recovered from the main
   area of the disk.  SCSI disks actually allow you to query the
   number of blocks in this state - check your modepages for the
   number of factory defect blocks and grown defect blocks (blocks
   allocated after the drive has left the factory)

 - Some disks map the first 8GB of logical blocks to the outer
   cylinders of the disk for speed or compatibility reasons.

This is why TCQ is necessary to get any kind of good I/O performance
for things like Maildir, where you have a bunch of small files
scattered randomly among the physical blocks.  You can't command an
non-TCQ disk to chunk the I/O and so it can't put together a good seek
strategy for the requested blocks, only deliver them one at a time as
you ask for them.

-- 
 - Jason       Last known location:  11.0 miles northeast of MOUNTAIN VIEW, CA

Kerr's Three Rules for a Successful College:
	Have plenty of football for the alumni, sex for the students,
and parking for the faculty.



More information about the linux-elitists mailing list