diff options
author | Vivek Goyal <vgoyal@redhat.com> | 2009-11-26 03:45:40 -0500 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-11-26 03:46:46 -0500 |
commit | d9449ce35a1e8fb58dd2d419f9215562a14ecca0 (patch) | |
tree | 322f88901d3e494134354dcd5b7f63fa723145e8 | |
parent | c16632bab1a17e357cec66920ceb3f0630009360 (diff) |
Fix regression in direct writes performance due to WRITE_ODIRECT flag removal
There seems to be a regression in direct write path due to following
commit in for-2.6.33 branch of block tree.
commit 1af60fbd759d31f565552fea315c2033947cfbe6
Author: Jeff Moyer <jmoyer@redhat.com>
Date: Fri Oct 2 18:56:53 2009 -0400
block: get rid of the WRITE_ODIRECT flag
Marking direct writes as WRITE_SYNC_PLUG instead of WRITE_ODIRECT, sets
the NOIDLE flag in bio and hence in request. This tells CFQ to not expect
more request from the queue and not idle on it (despite the fact that
queue's think time is less and it is not seeky).
So direct writers lose big time when competing with sequential readers.
Using fio, I have run one direct writer and two sequential readers and
following are the results with 2.6.32-rc7 kernel and with for-2.6.33
branch.
Test
====
1 direct writer and 2 sequential reader running simultaneously.
[global]
directory=/mnt/sdc/fio/
runtime=10
[seqwrite]
rw=write
size=4G
direct=1
[seqread]
rw=read
size=2G
numjobs=2
2.6.32-rc7
==========
direct writes: aggrb=2,968KB/s
readers : aggrb=101MB/s
for-2.6.33 branch
=================
direct write: aggrb=19KB/s
readers aggrb=137MB/s
This patch brings back the WRITE_ODIRECT flag, with the difference that we
don't set the BIO_RW_UNPLUG flag so that device is not unplugged after
submission of request and an explicit unplug from submitter is required.
That way we fix the jeff's issue of not enough merging taking place in aio
path as well as make sure direct writes get their fair share.
After the fix
=============
for-2.6.33 + fix
----------------
direct writes: aggrb=2,728KB/s
reads: aggrb=103MB/s
Thanks
Vivek
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r-- | fs/direct-io.c | 2 | ||||
-rw-r--r-- | include/linux/fs.h | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/fs/direct-io.c b/fs/direct-io.c index 3af761c8c5cc..b912270942fa 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c | |||
@@ -1124,7 +1124,7 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
1124 | int acquire_i_mutex = 0; | 1124 | int acquire_i_mutex = 0; |
1125 | 1125 | ||
1126 | if (rw & WRITE) | 1126 | if (rw & WRITE) |
1127 | rw = WRITE_SYNC_PLUG; | 1127 | rw = WRITE_ODIRECT_PLUG; |
1128 | 1128 | ||
1129 | if (bdev) | 1129 | if (bdev) |
1130 | bdev_blkbits = blksize_bits(bdev_logical_block_size(bdev)); | 1130 | bdev_blkbits = blksize_bits(bdev_logical_block_size(bdev)); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 2f5fca4147c2..79cea8051736 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -129,6 +129,7 @@ struct inodes_stat_t { | |||
129 | * WRITE_SYNC Like WRITE_SYNC_PLUG, but also unplugs the device | 129 | * WRITE_SYNC Like WRITE_SYNC_PLUG, but also unplugs the device |
130 | * immediately after submission. The write equivalent | 130 | * immediately after submission. The write equivalent |
131 | * of READ_SYNC. | 131 | * of READ_SYNC. |
132 | * WRITE_ODIRECT_PLUG Special case write for O_DIRECT only. | ||
132 | * SWRITE_SYNC | 133 | * SWRITE_SYNC |
133 | * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer. | 134 | * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer. |
134 | * See SWRITE. | 135 | * See SWRITE. |
@@ -150,6 +151,7 @@ struct inodes_stat_t { | |||
150 | #define READ_META (READ | (1 << BIO_RW_META)) | 151 | #define READ_META (READ | (1 << BIO_RW_META)) |
151 | #define WRITE_SYNC_PLUG (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) | 152 | #define WRITE_SYNC_PLUG (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) |
152 | #define WRITE_SYNC (WRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) | 153 | #define WRITE_SYNC (WRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) |
154 | #define WRITE_ODIRECT_PLUG (WRITE | (1 << BIO_RW_SYNCIO)) | ||
153 | #define SWRITE_SYNC_PLUG \ | 155 | #define SWRITE_SYNC_PLUG \ |
154 | (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) | 156 | (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) |
155 | #define SWRITE_SYNC (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) | 157 | #define SWRITE_SYNC (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) |