blob: 9f5c5a4c370e15c5d7534b377063abc9e1be7f22 [file] [log] [blame]
Mauro Carvalho Chehab898bd372019-04-18 19:45:00 -03001==============================
Linus Torvalds1da177e2005-04-16 15:20:36 -07002Deadline IO scheduler tunables
3==============================
4
5This little file attempts to document how the deadline io scheduler works.
6In particular, it will clarify the meaning of the exposed tunables that may be
7of interest to power users.
8
Alan D. Brunelle23c76982007-10-15 13:22:26 +02009Selecting IO schedulers
10-----------------------
Mauro Carvalho Chehab898bd372019-04-18 19:45:00 -030011Refer to Documentation/block/switching-sched.rst for information on
Alan D. Brunelle23c76982007-10-15 13:22:26 +020012selecting an io scheduler on a per-device basis.
Linus Torvalds1da177e2005-04-16 15:20:36 -070013
Mauro Carvalho Chehab898bd372019-04-18 19:45:00 -030014------------------------------------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
16read_expire (in ms)
Mauro Carvalho Chehab898bd372019-04-18 19:45:00 -030017-----------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -070018
Matt LaPlantea2ffd272006-10-03 22:49:15 +020019The goal of the deadline io scheduler is to attempt to guarantee a start
Linus Torvalds1da177e2005-04-16 15:20:36 -070020service time for a request. As we focus mainly on read latencies, this is
21tunable. When a read request first enters the io scheduler, it is assigned
22a deadline that is the current time + the read_expire value in units of
Matt LaPlante2fe0ae72006-10-03 22:50:39 +020023milliseconds.
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
25
26write_expire (in ms)
Mauro Carvalho Chehab898bd372019-04-18 19:45:00 -030027-----------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
29Similar to read_expire mentioned above, but for writes.
30
31
Aaron Carroll6a421c12008-08-14 18:17:15 +100032fifo_batch (number of requests)
Mauro Carvalho Chehab898bd372019-04-18 19:45:00 -030033------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -070034
Mauro Carvalho Chehab898bd372019-04-18 19:45:00 -030035Requests are grouped into ``batches`` of a particular data direction (read or
Aaron Carroll6a421c12008-08-14 18:17:15 +100036write) which are serviced in increasing sector order. To limit extra seeking,
37deadline expiries are only checked between batches. fifo_batch controls the
38maximum number of requests per batch.
39
40This parameter tunes the balance between per-request latency and aggregate
41throughput. When low latency is the primary concern, smaller is better (where
42a value of 1 yields first-come first-served behaviour). Increasing fifo_batch
43generally improves throughput, at the cost of latency variation.
Linus Torvalds1da177e2005-04-16 15:20:36 -070044
45
Alan D. Brunelle23c76982007-10-15 13:22:26 +020046writes_starved (number of dispatches)
Mauro Carvalho Chehab898bd372019-04-18 19:45:00 -030047--------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -070048
49When we have to move requests from the io scheduler queue to the block
50device dispatch queue, we always give a preference to reads. However, we
51don't want to starve writes indefinitely either. So writes_starved controls
52how many times we give preference to reads over writes. When that has been
53done writes_starved number of times, we dispatch some writes based on the
54same criteria as reads.
55
56
57front_merges (bool)
Mauro Carvalho Chehab898bd372019-04-18 19:45:00 -030058----------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -070059
Matt LaPlante19f59462009-04-27 15:06:31 +020060Sometimes it happens that a request enters the io scheduler that is contiguous
Linus Torvalds1da177e2005-04-16 15:20:36 -070061with a request that is already on the queue. Either it fits in the back of that
62request, or it fits at the front. That is called either a back merge candidate
63or a front merge candidate. Due to the way files are typically laid out,
64back merges are much more common than front merges. For some work loads, you
65may even know that it is a waste of time to spend any time attempting to
66front merge requests. Setting front_merges to 0 disables this functionality.
67Front merges may still occur due to the cached last_merge hint, but since
68that comes at basically 0 cost we leave that on. We simply disable the
69rbtree front sector lookup when the io scheduler merge function is called.
70
71
Rob Landley26bbb292007-10-15 11:42:52 +020072Nov 11 2002, Jens Axboe <jens.axboe@oracle.com>