summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorJan Kara <jack@suse.com>2016-01-12 10:24:16 -0500
committerJens Axboe <axboe@fb.com>2016-02-04 11:50:12 -0500
commit6c80731c75bd3289d35b89a21a4e317cbcb306e3 (patch)
tree6436e8e33ca1f8cd62a46c900547bab559504384 /block
parente795421e40b39bf874c5ed9434365fb4a4b6c5d1 (diff)
cfq-iosched: Reorder checks in cfq_should_preempt()
Move check for preemption by rt class up. There is no functional change but it makes arguing about conditions simpler since we can be sure both cfq queues are from the same ioprio class. Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jan Kara <jack@suse.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r--block/cfq-iosched.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 0a6a70a9bca8..2544c219c00c 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -3959,6 +3959,13 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
3959 if (cfq_slice_used(cfqq)) 3959 if (cfq_slice_used(cfqq))
3960 return true; 3960 return true;
3961 3961
3962 /*
3963 * Allow an RT request to pre-empt an ongoing non-RT cfqq timeslice.
3964 */
3965 if (cfq_class_rt(new_cfqq) && !cfq_class_rt(cfqq))
3966 return true;
3967
3968 WARN_ON_ONCE(cfqq->ioprio_class != new_cfqq->ioprio_class);
3962 /* Allow preemption only if we are idling on sync-noidle tree */ 3969 /* Allow preemption only if we are idling on sync-noidle tree */
3963 if (cfqd->serving_wl_type == SYNC_NOIDLE_WORKLOAD && 3970 if (cfqd->serving_wl_type == SYNC_NOIDLE_WORKLOAD &&
3964 cfqq_type(new_cfqq) == SYNC_NOIDLE_WORKLOAD && 3971 cfqq_type(new_cfqq) == SYNC_NOIDLE_WORKLOAD &&
@@ -3973,12 +3980,6 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
3973 if ((rq->cmd_flags & REQ_PRIO) && !cfqq->prio_pending) 3980 if ((rq->cmd_flags & REQ_PRIO) && !cfqq->prio_pending)
3974 return true; 3981 return true;
3975 3982
3976 /*
3977 * Allow an RT request to pre-empt an ongoing non-RT cfqq timeslice.
3978 */
3979 if (cfq_class_rt(new_cfqq) && !cfq_class_rt(cfqq))
3980 return true;
3981
3982 /* An idle queue should not be idle now for some reason */ 3983 /* An idle queue should not be idle now for some reason */
3983 if (RB_EMPTY_ROOT(&cfqq->sort_list) && !cfq_should_idle(cfqd, cfqq)) 3984 if (RB_EMPTY_ROOT(&cfqq->sort_list) && !cfq_should_idle(cfqd, cfqq))
3984 return true; 3985 return true;