From: Shan Wei <shanwei@cn.fujitsu.com>
To: Jens Axboe <jens.axboe@oracle.com>
Cc: rdunlap@xenotime.net, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH]cfq: add the document of the tuning parameters
Date: Fri, 31 Jul 2009 11:10:29 +0800 [thread overview]
Message-ID: <4A7260A5.2040502@cn.fujitsu.com> (raw)
In-Reply-To: <4A7160B5.8010301@cn.fujitsu.com>
This little file attempts to document how the cfq io scheduler works.
In particular, it will clarify the meaning of the tuning parameters.
Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
Cc: Randy Dunlap <rdunlap@xenotime.net>
---
Documentation/block/00-INDEX | 2 +
Documentation/block/cfq-iosched.txt | 82 +++++++++++++++++++++++++++++++++++
2 files changed, 84 insertions(+), 0 deletions(-)
create mode 100644 Documentation/block/cfq-iosched.txt
diff --git a/Documentation/block/00-INDEX b/Documentation/block/00-INDEX
index 961a051..2ce5c7a 100644
--- a/Documentation/block/00-INDEX
+++ b/Documentation/block/00-INDEX
@@ -8,6 +8,8 @@ biodoc.txt
- Notes on the Generic Block Layer Rewrite in Linux 2.5
capability.txt
- Generic Block Device Capability (/sys/block/<disk>/capability)
+cfq-iosched.txt
+ - CFQ(Complete Fairness Queueing) IO scheduler tunables
deadline-iosched.txt
- Deadline IO scheduler tunables
ioprio.txt
diff --git a/Documentation/block/cfq-iosched.txt b/Documentation/block/cfq-iosched.txt
new file mode 100644
index 0000000..ccf5c61
--- /dev/null
+++ b/Documentation/block/cfq-iosched.txt
@@ -0,0 +1,82 @@
+CFQ(Complete Fairness Queueing) IO scheduler tunables
+=====================================================
+Shan Wei <shanwei@cn.fujitsu.com> 30 Jun 2009
+
+
+The main goal of he "Complete Fairness Queueing" elevator is ensuring
+a fair allocation of the disk I/O bandwidth among all the processes
+that trigger the I/O requests.
+
+For synchronous requests, CFQ creates per-process queues to manage the requests.
+But asynchronous requests are batched together in fewer queues,
+one per IO priority. See Documentation/block/ioprio.txt for details
+of the IO priority. CFQ schedules queues in a round-robin manner and
+dispatches requests in queue's time slice, so that it can ensure that
+every process accesses the disk fairly.
+
+Now, CFQ is the default IO scheduler.
+
+
+Selecting IO schedulers
+-----------------------
+Refer to Documentation/block/switching-sched.txt for information on
+selecting an io scheduler on a per-device basis.
+
+
+Tuning the CFQ IO scheduler
+---------------------------
+When using 'cfq', there are 9 parameters under /sys/block/*/queue/iosched/.
+
+The parameters are:
+* back_seek_max (in KByte)
+ The parameter sets the max distance for backward seeking,
+ default is 16MBytes. The idea comes from the AS scheduler.
+ Like forward requests, CFQ may dispatch a back request that accesses sector
+ at the backward of current magnetic head.
+
+* back_seek_penalty
+ The parameter is used to calculate the cost of backward seeking,
+ default is 2. Relative to front request, if the backward distance of
+ a request is just 1/2 (1/back_seek_penalty) of it,
+ the seeking cost of the two requests is considered equivalent.
+
+* fifo_expire_async (in ms)
+ The parameter is used to set the timeout of asynchronous requests,
+ default is 250ms. CFQ maintains a fifo list to manage timeout requests.
+ CFQ doesn't check the expired requests from the fifo queue, after one
+ timeout request is dispatched.
+
+* fifo_expire_sync (in ms)
+ Same as fifo_expire_async, but the parameter is for synchronous requests,
+ default is 125ms.
+
+* slice_sync (in ms)
+ The parameter is used to calculate time slice of synchronous queue,
+ default is 100ms. But the actual time slice also depends on
+ the io priority. The formula is:
+ time_slice = slice_sync + (slice_sync / 5 * (4 - io_priority)).
+
+* slice_async (in ms)
+ Same as slice_sync, but the parameter is for asynchronous queue,
+ default is 40ms.
+
+* slice_async_rq
+ The parameter is used to limit dispatching of asynchronous requests
+ to the device request-queue in queue's slice time, default is 2.
+ The max number of requests that are allowed to be dispatched also
+ depends on the io priority. The formula is: max_nr_requests =
+ 2 * (slice_async_rq + slice_async_rq * (7 - io_priority)).
+
+* slice_idle (in ms)
+ The parameter is the idle time for synchronous queue only, default is 8ms.
+ In queue's time slice, when there is no request in the synchronous queue,
+ CFQ will not switch to another queue, but idle to wait for process creating
+ more requests. If no new requests are submitted, the queue will expire.
+
+* quantum (number of requests)
+ The number of dispatched requests to the device request-queue is restricted
+ by this parameter, default is 4. In queue's time slice, request will not be
+ dispatched if the number of requests in the device request-queue
+ exceeds the limit. For asynchronous queue, dispatching is also
+ restricted by slice_async_rq. Note, the parameter has no effect
+ on the IDLE queue(IDLE is the class of the IO priority).
--
1.6.0.4
parent reply other threads:[~2009-07-31 3:09 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <4A7160B5.8010301@cn.fujitsu.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A7260A5.2040502@cn.fujitsu.com \
--to=shanwei@cn.fujitsu.com \
--cc=jens.axboe@oracle.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@xenotime.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox