diff options
| -rw-r--r-- | Documentation/block/cfq-iosched.txt | 45 | ||||
| -rw-r--r-- | Documentation/cgroups/blkio-controller.txt | 28 | ||||
| -rw-r--r-- | block/blk-cgroup.c | 2 | ||||
| -rw-r--r-- | block/blk-core.c | 6 | ||||
| -rw-r--r-- | block/blk-sysfs.c | 1 | ||||
| -rw-r--r-- | block/blk.h | 8 | ||||
| -rw-r--r-- | block/cfq-iosched.c | 103 | ||||
| -rw-r--r-- | block/elevator.c | 44 | ||||
| -rw-r--r-- | drivers/block/cciss.c | 11 | ||||
| -rw-r--r-- | drivers/block/loop.c | 2 | ||||
| -rw-r--r-- | drivers/block/mg_disk.c | 3 | ||||
| -rw-r--r-- | drivers/s390/char/tape_block.c | 3 | ||||
| -rw-r--r-- | fs/bio-integrity.c | 4 | ||||
| -rw-r--r-- | fs/fs-writeback.c | 2 | ||||
| -rw-r--r-- | include/linux/elevator.h | 1 | ||||
| -rw-r--r-- | lib/scatterlist.c | 14 | ||||
| -rw-r--r-- | mm/backing-dev.c | 7 |
17 files changed, 238 insertions, 46 deletions
diff --git a/Documentation/block/cfq-iosched.txt b/Documentation/block/cfq-iosched.txt new file mode 100644 index 000000000000..e578feed6d81 --- /dev/null +++ b/Documentation/block/cfq-iosched.txt | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | CFQ ioscheduler tunables | ||
| 2 | ======================== | ||
| 3 | |||
| 4 | slice_idle | ||
| 5 | ---------- | ||
| 6 | This specifies how long CFQ should idle for next request on certain cfq queues | ||
| 7 | (for sequential workloads) and service trees (for random workloads) before | ||
| 8 | queue is expired and CFQ selects next queue to dispatch from. | ||
| 9 | |||
| 10 | By default slice_idle is a non-zero value. That means by default we idle on | ||
| 11 | queues/service trees. This can be very helpful on highly seeky media like | ||
| 12 | single spindle SATA/SAS disks where we can cut down on overall number of | ||
| 13 | seeks and see improved throughput. | ||
| 14 | |||
| 15 | Setting slice_idle to 0 will remove all the idling on queues/service tree | ||
| 16 | level and one should see an overall improved throughput on faster storage | ||
| 17 | devices like multiple SATA/SAS disks in hardware RAID configuration. The down | ||
| 18 | side is that isolation provided from WRITES also goes down and notion of | ||
| 19 | IO priority becomes weaker. | ||
| 20 | |||
| 21 | So depending on storage and workload, it might be useful to set slice_idle=0. | ||
| 22 | In general I think for SATA/SAS disks and software RAID of SATA/SAS disks | ||
| 23 | keeping slice_idle enabled should be useful. For any configurations where | ||
| 24 | there are multiple spindles behind single LUN (Host based hardware RAID | ||
| 25 | controller or for storage arrays), setting slice_idle=0 might end up in better | ||
| 26 | throughput and acceptable latencies. | ||
| 27 | |||
| 28 | CFQ IOPS Mode for group scheduling | ||
| 29 | =================================== | ||
| 30 | Basic CFQ design is to provide priority based time slices. Higher priority | ||
| 31 | process gets bigger time slice and lower priority process gets smaller time | ||
| 32 | slice. Measuring time becomes harder if storage is fast and supports NCQ and | ||
| 33 | it would be better to dispatch multiple requests from multiple cfq queues in | ||
| 34 | request queue at a time. In such scenario, it is not possible to measure time | ||
| 35 | consumed by single queue accurately. | ||
| 36 | |||
| 37 | What is possible though is to measure number of requests dispatched from a | ||
| 38 | single queue and also allow dispatch from multiple cfq queue at the same time. | ||
| 39 | This effectively becomes the fairness in terms of IOPS (IO operations per | ||
| 40 | second). | ||
| 41 | |||
| 42 | If one sets slice_idle=0 and if storage supports NCQ, CFQ internally switches | ||
| 43 | to IOPS mode and starts providing fairness in terms of number of requests | ||
| 44 | dispatched. Note that this mode switching takes effect only for group | ||
| 45 | scheduling. For non-cgroup users nothing should change. | ||
diff --git a/Documentation/cgroups/blkio-controller.txt b/Documentation/cgroups/blkio-controller.txt index 48e0b21b0059..6919d62591d9 100644 --- a/Documentation/cgroups/blkio-controller.txt +++ b/Documentation/cgroups/blkio-controller.txt | |||
| @@ -217,6 +217,7 @@ Details of cgroup files | |||
| 217 | CFQ sysfs tunable | 217 | CFQ sysfs tunable |
| 218 | ================= | 218 | ================= |
| 219 | /sys/block/<disk>/queue/iosched/group_isolation | 219 | /sys/block/<disk>/queue/iosched/group_isolation |
| 220 | ----------------------------------------------- | ||
| 220 | 221 | ||
| 221 | If group_isolation=1, it provides stronger isolation between groups at the | 222 | If group_isolation=1, it provides stronger isolation between groups at the |
| 222 | expense of throughput. By default group_isolation is 0. In general that | 223 | expense of throughput. By default group_isolation is 0. In general that |
| @@ -243,6 +244,33 @@ By default one should run with group_isolation=0. If that is not sufficient | |||
| 243 | and one wants stronger isolation between groups, then set group_isolation=1 | 244 | and one wants stronger isolation between groups, then set group_isolation=1 |
| 244 | but this will come at cost of reduced throughput. | 245 | but this will come at cost of reduced throughput. |
| 245 | 246 | ||
| 247 | /sys/block/<disk>/queue/iosched/slice_idle | ||
| 248 | ------------------------------------------ | ||
| 249 | On a faster hardware CFQ can be slow, especially with sequential workload. | ||
| 250 | This happens because CFQ idles on a single queue and single queue might not | ||
| 251 | drive deeper request queue depths to keep the storage busy. In such scenarios | ||
| 252 | one can try setting slice_idle=0 and that would switch CFQ to IOPS | ||
| 253 | (IO operations per second) mode on NCQ supporting hardware. | ||
| 254 | |||
| 255 | That means CFQ will not idle between cfq queues of a cfq group and hence be | ||
| 256 | able to driver higher queue depth and achieve better throughput. That also | ||
| 257 | means that cfq provides fairness among groups in terms of IOPS and not in | ||
| 258 | terms of disk time. | ||
| 259 | |||
| 260 | /sys/block/<disk>/queue/iosched/group_idle | ||
| 261 | ------------------------------------------ | ||
| 262 | If one disables idling on individual cfq queues and cfq service trees by | ||
| 263 | setting slice_idle=0, group_idle kicks in. That means CFQ will still idle | ||
| 264 | on the group in an attempt to provide fairness among groups. | ||
| 265 | |||
| 266 | By default group_idle is same as slice_idle and does not do anything if | ||
| 267 | slice_idle is enabled. | ||
| 268 | |||
| 269 | One can experience an overall throughput drop if you have created multiple | ||
| 270 | groups and put applications in that group which are not driving enough | ||
| 271 | IO to keep disk busy. In that case set group_idle=0, and CFQ will not idle | ||
| 272 | on individual groups and throughput should improve. | ||
| 273 | |||
| 246 | What works | 274 | What works |
| 247 | ========== | 275 | ========== |
| 248 | - Currently only sync IO queues are support. All the buffered writes are | 276 | - Currently only sync IO queues are support. All the buffered writes are |
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index a6809645d212..2fef1ef931a0 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
| @@ -966,7 +966,7 @@ blkiocg_create(struct cgroup_subsys *subsys, struct cgroup *cgroup) | |||
| 966 | 966 | ||
| 967 | /* Currently we do not support hierarchy deeper than two level (0,1) */ | 967 | /* Currently we do not support hierarchy deeper than two level (0,1) */ |
| 968 | if (parent != cgroup->top_cgroup) | 968 | if (parent != cgroup->top_cgroup) |
| 969 | return ERR_PTR(-EINVAL); | 969 | return ERR_PTR(-EPERM); |
| 970 | 970 | ||
| 971 | blkcg = kzalloc(sizeof(*blkcg), GFP_KERNEL); | 971 | blkcg = kzalloc(sizeof(*blkcg), GFP_KERNEL); |
| 972 | if (!blkcg) | 972 | if (!blkcg) |
diff --git a/block/blk-core.c b/block/blk-core.c index ee1a1e7e63cc..32a1c123dfb3 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
| @@ -1198,9 +1198,9 @@ static int __make_request(struct request_queue *q, struct bio *bio) | |||
| 1198 | int el_ret; | 1198 | int el_ret; |
| 1199 | unsigned int bytes = bio->bi_size; | 1199 | unsigned int bytes = bio->bi_size; |
| 1200 | const unsigned short prio = bio_prio(bio); | 1200 | const unsigned short prio = bio_prio(bio); |
| 1201 | const bool sync = (bio->bi_rw & REQ_SYNC); | 1201 | const bool sync = !!(bio->bi_rw & REQ_SYNC); |
| 1202 | const bool unplug = (bio->bi_rw & REQ_UNPLUG); | 1202 | const bool unplug = !!(bio->bi_rw & REQ_UNPLUG); |
| 1203 | const unsigned int ff = bio->bi_rw & REQ_FAILFAST_MASK; | 1203 | const unsigned long ff = bio->bi_rw & REQ_FAILFAST_MASK; |
| 1204 | int rw_flags; | 1204 | int rw_flags; |
| 1205 | 1205 | ||
| 1206 | if ((bio->bi_rw & REQ_HARDBARRIER) && | 1206 | if ((bio->bi_rw & REQ_HARDBARRIER) && |
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 001ab18078f5..0749b89c6885 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c | |||
| @@ -511,6 +511,7 @@ int blk_register_queue(struct gendisk *disk) | |||
| 511 | kobject_uevent(&q->kobj, KOBJ_REMOVE); | 511 | kobject_uevent(&q->kobj, KOBJ_REMOVE); |
| 512 | kobject_del(&q->kobj); | 512 | kobject_del(&q->kobj); |
| 513 | blk_trace_remove_sysfs(disk_to_dev(disk)); | 513 | blk_trace_remove_sysfs(disk_to_dev(disk)); |
| 514 | kobject_put(&dev->kobj); | ||
| 514 | return ret; | 515 | return ret; |
| 515 | } | 516 | } |
| 516 | 517 | ||
diff --git a/block/blk.h b/block/blk.h index 6e7dc87141e4..d6b911ac002c 100644 --- a/block/blk.h +++ b/block/blk.h | |||
| @@ -142,14 +142,18 @@ static inline int queue_congestion_off_threshold(struct request_queue *q) | |||
| 142 | 142 | ||
| 143 | static inline int blk_cpu_to_group(int cpu) | 143 | static inline int blk_cpu_to_group(int cpu) |
| 144 | { | 144 | { |
| 145 | int group = NR_CPUS; | ||
| 145 | #ifdef CONFIG_SCHED_MC | 146 | #ifdef CONFIG_SCHED_MC |
| 146 | const struct cpumask *mask = cpu_coregroup_mask(cpu); | 147 | const struct cpumask *mask = cpu_coregroup_mask(cpu); |
| 147 | return cpumask_first(mask); | 148 | group = cpumask_first(mask); |
| 148 | #elif defined(CONFIG_SCHED_SMT) | 149 | #elif defined(CONFIG_SCHED_SMT) |
| 149 | return cpumask_first(topology_thread_cpumask(cpu)); | 150 | group = cpumask_first(topology_thread_cpumask(cpu)); |
| 150 | #else | 151 | #else |
| 151 | return cpu; | 152 | return cpu; |
| 152 | #endif | 153 | #endif |
| 154 | if (likely(group < NR_CPUS)) | ||
| 155 | return group; | ||
| 156 | return cpu; | ||
| 153 | } | 157 | } |
| 154 | 158 | ||
| 155 | /* | 159 | /* |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index eb4086f7dfef..f65c6f01c475 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
| @@ -30,6 +30,7 @@ static const int cfq_slice_sync = HZ / 10; | |||
| 30 | static int cfq_slice_async = HZ / 25; | ||
