]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
dio: optimize cache misses in the submission path
authorAndi Kleen <ak@linux.intel.com>
Fri, 16 Dec 2011 04:50:49 +0000 (15:50 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 20 Dec 2011 07:44:09 +0000 (18:44 +1100)
commit898cce4356aaf14a985eb2b54177b42e5db675e8
treee3996fa12c1925c0002628370256b865027f4d32
parent89ffc8fed9e62af9e0653345c2bb83dda0b9f55f
dio: optimize cache misses in the submission path

Some investigation of a transaction processing workload showed that a
major consumer of cycles in __blockdev_direct_IO is the cache miss while
accessing the block size.  This is because it has to walk the chain from
block_dev to gendisk to queue.

The block size is needed early on to check alignment and sizes.  It's only
done if the check for the inode block size fails.  But the costly block
device state is unconditionally fetched.

- Reorganize the code to only fetch block dev state when actually
  needed.

Then do a prefetch on the block dev early on in the direct IO path.  This
is worth it, because there is substantial code run before we actually
touch the block dev now.

- I also added some unlikelies to make it clear the compiler that block
  device fetch code is not normally executed.

This gave a small, but measurable improvement on a large database
benchmark (about 0.3%)

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: Jeff Moyer <jmoyer@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/direct-io.c