public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
To: Vivek Goyal <vgoyal@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	containers@lists.linux-foundation.org, dm-devel@redhat.com,
	jens.axboe@oracle.com, nauman@google.com, dpshah@google.com,
	lizf@cn.fujitsu.com, mikew@google.com, fchecconi@gmail.com,
	paolo.valente@unimore.it, ryov@valinux.co.jp,
	fernando@oss.ntt.co.jp, s-uchida@ap.jp.nec.com,
	taka@valinux.co.jp, jmoyer@redhat.com, dhaval@linux.vnet.ibm.com,
	balbir@linux.vnet.ibm.com, righi.andrea@gmail.com,
	m-ikeda@ds.jp.nec.com, jbaron@redhat.com, agk@redhat.com,
	snitzer@redhat.com, akpm@linux-foundation.org,
	peterz@infradead.org
Subject: [PATCH] io-controller: Preempt a non-rt queue if a rt ioq is present in ancestor or sibling groups
Date: Mon, 22 Jun 2009 15:44:08 +0800	[thread overview]
Message-ID: <4A3F3648.7080007@cn.fujitsu.com> (raw)
In-Reply-To: <1245443858-8487-21-git-send-email-vgoyal@redhat.com>

Preempt the ongoing non-rt ioq if there are rt ioqs waiting for dispatching
in ancestor or sibling groups. It will give other group's rt ioq an chance 
to dispatch ASAP.

Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
---
 block/elevator-fq.c |   44 +++++++++++++++++++++++++++++++++++++++-----
 block/elevator-fq.h |    1 +
 2 files changed, 40 insertions(+), 5 deletions(-)

diff --git a/block/elevator-fq.c b/block/elevator-fq.c
index 2ad40eb..80526fd 100644
--- a/block/elevator-fq.c
+++ b/block/elevator-fq.c
@@ -3245,8 +3245,16 @@ void elv_add_ioq_busy(struct elv_fq_data *efqd, struct io_queue *ioq)
 	elv_mark_ioq_busy(ioq);
 	efqd->busy_queues++;
 	if (elv_ioq_class_rt(ioq)) {
+		struct io_entity *entity;
 		struct io_group *iog = ioq_to_io_group(ioq);
+
 		iog->busy_rt_queues++;
+		entity = iog->entity.parent;
+
+		for_each_entity(entity) {
+			iog = io_entity_to_iog(entity);
+			iog->sub_busy_rt_queues++;
+		}
 	}
 
 #ifdef CONFIG_DEBUG_GROUP_IOSCHED
@@ -3290,9 +3298,18 @@ void elv_del_ioq_busy(struct elevator_queue *e, struct io_queue *ioq,
 	elv_clear_ioq_busy(ioq);
 	BUG_ON(efqd->busy_queues == 0);
 	efqd->busy_queues--;
+
 	if (elv_ioq_class_rt(ioq)) {
+		struct io_entity *entity;
 		struct io_group *iog = ioq_to_io_group(ioq);
+
 		iog->busy_rt_queues--;
+		entity = iog->entity.parent;
+
+		for_each_entity(entity) {
+			iog = io_entity_to_iog(entity);
+			iog->sub_busy_rt_queues--;
+		}
 	}
 
 	elv_deactivate_ioq(efqd, ioq, requeue);
@@ -3735,12 +3752,32 @@ int elv_iosched_expire_ioq(struct request_queue *q, int slice_expired,
 	return ret;
 }
 
+static int check_rt_queue(struct io_queue *ioq)
+{
+	struct io_group *iog;
+	struct io_entity *entity;
+
+	iog = ioq_to_io_group(ioq);
+
+	if (iog->busy_rt_queues)
+		return 1;
+
+	entity = iog->entity.parent;
+
+	for_each_entity(entity) {
+		iog = io_entity_to_iog(entity);
+		if (iog->sub_busy_rt_queues)
+			return 1;
+	}
+
+	return 0;
+}
+
 /* Common layer function to select the next queue to dispatch from */
 void *elv_fq_select_ioq(struct request_queue *q, int force)
 {
 	struct elv_fq_data *efqd = &q->elevator->efqd;
 	struct io_queue *new_ioq = NULL, *ioq = elv_active_ioq(q->elevator);
-	struct io_group *iog;
 	int slice_expired = 1;
 
 	if (!elv_nr_busy_ioq(q->elevator))
@@ -3811,12 +3848,9 @@ void *elv_fq_select_ioq(struct request_queue *q, int force)
 	/*
 	 * If we have a RT cfqq waiting, then we pre-empt the current non-rt
 	 * cfqq.
-	 *
-	 * TODO: This does not seem right across the io groups. Fix it.
 	 */
-	iog = ioq_to_io_group(ioq);
 
-	if (!elv_ioq_class_rt(ioq) && iog->busy_rt_queues) {
+	if (!elv_ioq_class_rt(ioq) && check_rt_queue(ioq)) {
 		/*
 		 * We simulate this as cfqq timed out so that it gets to bank
 		 * the remaining of its time slice.
diff --git a/block/elevator-fq.h b/block/elevator-fq.h
index b3193f8..be6c1af 100644
--- a/block/elevator-fq.h
+++ b/block/elevator-fq.h
@@ -248,6 +248,7 @@ struct io_group {
 	 * non-RT cfqq in service when this value is non-zero.
 	 */
 	unsigned int busy_rt_queues;
+	unsigned int sub_busy_rt_queues;
 
 	int deleting;
 	unsigned short iocg_id;
-- 
1.5.4.rc3



  reply	other threads:[~2009-06-22  7:46 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-19 20:37 [RFC] IO scheduler based io controller (V5) Vivek Goyal
2009-06-19 20:37 ` [PATCH 01/20] io-controller: Documentation Vivek Goyal
2009-06-19 20:37 ` [PATCH 02/20] io-controller: Common flat fair queuing code in elevaotor layer Vivek Goyal
2009-06-22  8:46   ` Balbir Singh
2009-06-22 12:43     ` Fabio Checconi
2009-06-23  2:43       ` Vivek Goyal
2009-06-23  4:10         ` Fabio Checconi
2009-06-23  7:32           ` Balbir Singh
2009-06-23 13:42             ` Fabio Checconi
2009-06-23  2:05     ` Vivek Goyal
2009-06-23  2:20       ` Jeff Moyer
2009-06-30  6:40   ` Gui Jianfeng
2009-07-01  1:28     ` Vivek Goyal
2009-07-01  9:24   ` Gui Jianfeng
2009-06-19 20:37 ` [PATCH 03/20] io-controller: Charge for time slice based on average disk rate Vivek Goyal
2009-06-19 20:37 ` [PATCH 04/20] io-controller: Modify cfq to make use of flat elevator fair queuing Vivek Goyal
2009-06-19 20:37 ` [PATCH 05/20] io-controller: Common hierarchical fair queuing code in elevaotor layer Vivek Goyal
2009-06-29  5:27   ` [PATCH] io-controller: optimization for iog deletion when elevator exiting Gui Jianfeng
2009-06-29 14:06     ` Vivek Goyal
2009-06-30 17:14       ` Nauman Rafique
2009-07-01  1:34         ` Vivek Goyal
2009-06-19 20:37 ` [PATCH 06/20] io-controller: cfq changes to use hierarchical fair queuing code in elevaotor layer Vivek Goyal
2009-06-19 20:37 ` [PATCH 07/20] io-controller: Export disk time used and nr sectors dipatched through cgroups Vivek Goyal
2009-06-23 12:10   ` Gui Jianfeng
2009-06-23 14:38     ` Vivek Goyal
2009-06-19 20:37 ` [PATCH 08/20] io-controller: idle for sometime on sync queue before expiring it Vivek Goyal
2009-06-30  7:49   ` [PATCH] io-controller: Don't expire an idle ioq if it's the only ioq in hierarchy Gui Jianfeng
2009-07-01  1:32     ` Vivek Goyal
2009-07-01  1:40       ` Gui Jianfeng
2009-06-19 20:37 ` [PATCH 09/20] io-controller: Separate out queue and data Vivek Goyal
2009-06-19 20:37 ` [PATCH 10/20] io-conroller: Prepare elevator layer for single queue schedulers Vivek Goyal
2009-06-19 20:37 ` [PATCH 11/20] io-controller: noop changes for hierarchical fair queuing Vivek Goyal
2009-06-19 20:37 ` [PATCH 12/20] io-controller: deadline " Vivek Goyal
2009-06-19 20:37 ` [PATCH 13/20] io-controller: anticipatory " Vivek Goyal
2009-06-19 20:37 ` [PATCH 14/20] blkio_cgroup patches from Ryo to track async bios Vivek Goyal
2009-06-19 20:37 ` [PATCH 15/20] io-controller: map async requests to appropriate cgroup Vivek Goyal
2009-06-22  1:45   ` Gui Jianfeng
2009-06-22 15:39     ` Vivek Goyal
2009-06-19 20:37 ` [PATCH 16/20] io-controller: Per cgroup request descriptor support Vivek Goyal
2009-06-19 20:37 ` [PATCH 17/20] io-controller: Per io group bdi congestion interface Vivek Goyal
2009-06-19 20:37 ` [PATCH 18/20] io-controller: Support per cgroup per device weights and io class Vivek Goyal
2009-06-24 21:52   ` Paul Menage
2009-06-25 10:23     ` [PATCH] io-controller: do some changes of io.policy interface Gui Jianfeng
2009-06-25 12:55       ` Vivek Goyal
2009-06-26  0:27         ` Gui Jianfeng
2009-06-26  0:59         ` Gui Jianfeng
2009-06-19 20:37 ` [PATCH 19/20] io-controller: Debug hierarchical IO scheduling Vivek Goyal
2009-06-19 20:37 ` [PATCH 20/20] io-controller: experimental debug patch for async queue wait before expiry Vivek Goyal
2009-06-22  7:44   ` Gui Jianfeng [this message]
2009-06-22 17:21     ` [PATCH] io-controller: Preempt a non-rt queue if a rt ioq is present in ancestor or sibling groups Vivek Goyal
2009-06-23  6:44       ` Gui Jianfeng
2009-06-23 14:02         ` Vivek Goyal
2009-06-24  9:20           ` Gui Jianfeng
2009-06-26  8:13             ` [PATCH 1/2] io-controller: Prepare a rt ioq list in efqd to keep track of busy rt ioqs Gui Jianfeng
2009-06-26  8:13             ` [PATCH 2/2] io-controller: make rt preemption happen in the whole hierarchy Gui Jianfeng
2009-06-26 12:39               ` Vivek Goyal
2009-06-21 15:21 ` [RFC] IO scheduler based io controller (V5) Balbir Singh
2009-06-22 15:30   ` Vivek Goyal
2009-06-22 15:40     ` Jeff Moyer
2009-06-22 16:02       ` Vivek Goyal
2009-06-22 16:06         ` Jeff Moyer
2009-06-22 17:08           ` Vivek Goyal
2009-06-23  6:52             ` Balbir Singh
2009-06-29 16:04 ` Vladislav Bolkhovitin
2009-06-29 17:23   ` Vivek Goyal

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=4A3F3648.7080007@cn.fujitsu.com \
    --to=guijianfeng@cn.fujitsu.com \
    --cc=agk@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=dhaval@linux.vnet.ibm.com \
    --cc=dm-devel@redhat.com \
    --cc=dpshah@google.com \
    --cc=fchecconi@gmail.com \
    --cc=fernando@oss.ntt.co.jp \
    --cc=jbaron@redhat.com \
    --cc=jens.axboe@oracle.com \
    --cc=jmoyer@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=m-ikeda@ds.jp.nec.com \
    --cc=mikew@google.com \
    --cc=nauman@google.com \
    --cc=paolo.valente@unimore.it \
    --cc=peterz@infradead.org \
    --cc=righi.andrea@gmail.com \
    --cc=ryov@valinux.co.jp \
    --cc=s-uchida@ap.jp.nec.com \
    --cc=snitzer@redhat.com \
    --cc=taka@valinux.co.jp \
    --cc=vgoyal@redhat.com \
    /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