Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1307545

[PATCH 2/5] cfq-iosched: Reorder checks in cfq_should_preempt()

From Jan Kara <jack@suse.cz>
Newsgroups linux.kernel
Subject [PATCH 2/5] cfq-iosched: Reorder checks in cfq_should_preempt()
Date 2016-01-12 16:30 +0100
Message-ID <qQ93t-2Pd-41@gated-at.bofh.it> (permalink)
References <qQ93r-2Pd-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Jan Kara <jack@suse.com>

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>
---
 block/cfq-iosched.c | 13 +++++++------
 1 file 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,
 	if (cfq_slice_used(cfqq))
 		return true;
 
+	/*
+	 * Allow an RT request to pre-empt an ongoing non-RT cfqq timeslice.
+	 */
+	if (cfq_class_rt(new_cfqq) && !cfq_class_rt(cfqq))
+		return true;
+
+	WARN_ON_ONCE(cfqq->ioprio_class != new_cfqq->ioprio_class);
 	/* Allow preemption only if we are idling on sync-noidle tree */
 	if (cfqd->serving_wl_type == SYNC_NOIDLE_WORKLOAD &&
 	    cfqq_type(new_cfqq) == SYNC_NOIDLE_WORKLOAD &&
@@ -3973,12 +3980,6 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
 	if ((rq->cmd_flags & REQ_PRIO) && !cfqq->prio_pending)
 		return true;
 
-	/*
-	 * Allow an RT request to pre-empt an ongoing non-RT cfqq timeslice.
-	 */
-	if (cfq_class_rt(new_cfqq) && !cfq_class_rt(cfqq))
-		return true;
-
 	/* An idle queue should not be idle now for some reason */
 	if (RB_EMPTY_ROOT(&cfqq->sort_list) && !cfq_should_idle(cfqd, cfqq))
 		return true;
-- 
2.6.2

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5 v3] SYNC_NOIDLE preemption for ancestor cgroups Jan Kara <jack@suse.cz> - 2016-01-12 16:30 +0100
  [PATCH 3/5] cfq-iosched: Allow sync noidle workloads to preempt each other Jan Kara <jack@suse.cz> - 2016-01-12 16:30 +0100
  [PATCH 1/5] cfq-iosched: Don't group_idle if cfqq has big thinktime Jan Kara <jack@suse.cz> - 2016-01-12 16:30 +0100
    Re: [PATCH 1/5] cfq-iosched: Don't group_idle if cfqq has big  thinktime Tejun Heo <tj@kernel.org> - 2016-01-12 17:20 +0100
  [PATCH 2/5] cfq-iosched: Reorder checks in cfq_should_preempt() Jan Kara <jack@suse.cz> - 2016-01-12 16:30 +0100
  [PATCH 5/5] cfq-iosched: Allow parent cgroup to preempt its child Jan Kara <jack@suse.cz> - 2016-01-12 16:30 +0100
  Re: [PATCH 0/5 v3] SYNC_NOIDLE preemption for ancestor cgroups Jens Axboe <axboe@kernel.dk> - 2016-01-12 18:20 +0100

csiph-web