]> www.infradead.org Git - users/jedix/linux-maple.git/commit
DIO: optimize cache misses in the submission path
authorAndi Kleen <ak@linux.intel.com>
Thu, 1 Dec 2011 21:38:15 +0000 (15:38 -0600)
committerDave Kleikamp <dave.kleikamp@oracle.com>
Thu, 1 Dec 2011 21:38:15 +0000 (15:38 -0600)
commit521efcd73e7faf6769dfa8ece9ccd3d14e5c943c
treed79d385a5fff2023ae43fc4364250777276d7235
parentcf95845e82782ac51781d242fc020c50488d6dce
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 runbefore 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%)

v2: Remove unlikely (Jeff Moyer)
Signed-off-by: Andi Kleen <ak@linux.intel.com>
fs/direct-io.c