From: Vivek Goyal <vgoyal@redhat.com>
To: 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, guijianfeng@cn.fujitsu.com,
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
Cc: agk@redhat.com, snitzer@redhat.com, vgoyal@redhat.com,
akpm@linux-foundation.org, peterz@infradead.org
Subject: [PATCH 06/19] io-controller: cfq changes to use hierarchical fair queuing code in elevaotor layer
Date: Mon, 8 Jun 2009 22:08:49 -0400 [thread overview]
Message-ID: <1244513342-11758-7-git-send-email-vgoyal@redhat.com> (raw)
In-Reply-To: <1244513342-11758-1-git-send-email-vgoyal@redhat.com>
Make cfq hierarhical.
Signed-off-by: Nauman Rafique <nauman@google.com>
Signed-off-by: Fabio Checconi <fabio@gandalf.sssup.it>
Signed-off-by: Paolo Valente <paolo.valente@unimore.it>
Signed-off-by: Aristeu Rozanski <aris@redhat.com>
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
---
block/Kconfig.iosched | 8 ++++++
block/cfq-iosched.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++--
init/Kconfig | 2 +-
3 files changed, 74 insertions(+), 4 deletions(-)
diff --git a/block/Kconfig.iosched b/block/Kconfig.iosched
index dd5224d..a91a807 100644
--- a/block/Kconfig.iosched
+++ b/block/Kconfig.iosched
@@ -54,6 +54,14 @@ config IOSCHED_CFQ
working environment, suitable for desktop systems.
This is the default I/O scheduler.
+config IOSCHED_CFQ_HIER
+ bool "CFQ Hierarchical Scheduling support"
+ depends on IOSCHED_CFQ && CGROUPS
+ select GROUP_IOSCHED
+ default n
+ ---help---
+ Enable hierarhical scheduling in cfq.
+
choice
prompt "Default I/O scheduler"
default DEFAULT_CFQ
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 8888631..7a431b8 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1229,6 +1229,60 @@ static void cfq_ioc_set_ioprio(struct io_context *ioc)
ioc->ioprio_changed = 0;
}
+#ifdef CONFIG_IOSCHED_CFQ_HIER
+static void changed_cgroup(struct io_context *ioc, struct cfq_io_context *cic)
+{
+ struct cfq_queue *async_cfqq = cic_to_cfqq(cic, 0);
+ struct cfq_queue *sync_cfqq = cic_to_cfqq(cic, 1);
+ struct cfq_data *cfqd = cic->key;
+ struct io_group *iog, *__iog;
+ unsigned long flags;
+ struct request_queue *q;
+
+ if (unlikely(!cfqd))
+ return;
+
+ q = cfqd->queue;
+
+ spin_lock_irqsave(q->queue_lock, flags);
+
+ iog = io_get_io_group(q, 0);
+
+ if (async_cfqq != NULL) {
+ __iog = cfqq_to_io_group(async_cfqq);
+ if (iog != __iog) {
+ /* cgroup changed, drop the reference to async queue */
+ cic_set_cfqq(cic, NULL, 0);
+ cfq_put_queue(async_cfqq);
+ }
+ }
+
+ if (sync_cfqq != NULL) {
+ __iog = cfqq_to_io_group(sync_cfqq);
+
+ /*
+ * Drop reference to sync queue. A new sync queue will
+ * be assigned in new group upon arrival of a fresh request.
+ * If old queue has got requests, those reuests will be
+ * dispatched over a period of time and queue will be freed
+ * automatically.
+ */
+ if (iog != __iog) {
+ cic_set_cfqq(cic, NULL, 1);
+ cfq_put_queue(sync_cfqq);
+ }
+ }
+
+ spin_unlock_irqrestore(q->queue_lock, flags);
+}
+
+static void cfq_ioc_set_cgroup(struct io_context *ioc)
+{
+ call_for_each_cic(ioc, changed_cgroup);
+ ioc->cgroup_changed = 0;
+}
+#endif /* CONFIG_IOSCHED_CFQ_HIER */
+
static struct cfq_queue *
cfq_find_alloc_queue(struct cfq_data *cfqd, int is_sync,
struct io_context *ioc, gfp_t gfp_mask)
@@ -1237,7 +1291,10 @@ cfq_find_alloc_queue(struct cfq_data *cfqd, int is_sync,
struct cfq_io_context *cic;
struct request_queue *q = cfqd->queue;
struct io_queue *ioq = NULL, *new_ioq = NULL;
+ struct io_group *iog = NULL;
retry:
+ iog = io_get_io_group(q, 1);
+
cic = cfq_cic_lookup(cfqd, ioc);
/* cic always exists here */
cfqq = cic_to_cfqq(cic, is_sync);
@@ -1304,8 +1361,9 @@ alloc_ioq:
cfqq->ioq = ioq;
cfq_init_prio_data(cfqq, ioc);
- elv_init_ioq(q->elevator, ioq, cfqq, cfqq->org_ioprio_class,
- cfqq->org_ioprio, is_sync);
+ elv_init_ioq(q->elevator, ioq, iog, cfqq,
+ cfqq->org_ioprio_class, cfqq->org_ioprio,
+ is_sync);
if (is_sync) {
if (!cfq_class_idle(cfqq))
@@ -1337,7 +1395,7 @@ cfq_get_queue(struct cfq_data *cfqd, int is_sync, struct io_context *ioc,
const int ioprio_class = task_ioprio_class(ioc);
struct cfq_queue *async_cfqq = NULL;
struct cfq_queue *cfqq = NULL;
- struct io_group *iog = io_lookup_io_group_current(cfqd->queue);
+ struct io_group *iog = io_get_io_group(cfqd->queue, 1);
if (!is_sync) {
async_cfqq = io_group_async_queue_prio(iog, ioprio_class,
@@ -1496,6 +1554,10 @@ out:
smp_read_barrier_depends();
if (unlikely(ioc->ioprio_changed))
cfq_ioc_set_ioprio(ioc);
+#ifdef CONFIG_IOSCHED_CFQ_HIER
+ if (unlikely(ioc->cgroup_changed))
+ cfq_ioc_set_cgroup(ioc);
+#endif
return cic;
err_free:
cfq_cic_free(cic);
diff --git a/init/Kconfig b/init/Kconfig
index ab76477..1a4686d 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -607,7 +607,7 @@ config CGROUP_MEM_RES_CTLR_SWAP
size is 4096bytes, 512k per 1Gbytes of swap.
config GROUP_IOSCHED
- bool "Group IO Scheduler"
+ bool
depends on CGROUPS && ELV_FAIR_QUEUING
default n
---help---
--
1.6.0.6
next prev parent reply other threads:[~2009-06-09 2:10 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-09 2:08 [RFC] IO scheduler based IO controller V4 Vivek Goyal
2009-06-09 2:08 ` [PATCH 01/19] io-controller: Documentation Vivek Goyal
2009-06-09 2:08 ` [PATCH 02/19] io-controller: Common flat fair queuing code in elevaotor layer Vivek Goyal
2009-06-09 8:45 ` Gui Jianfeng
2009-06-16 3:54 ` Gui Jianfeng
2009-06-16 13:02 ` Vivek Goyal
2009-06-16 19:44 ` Divyesh Shah
2009-06-17 12:59 ` Vivek Goyal
2009-06-09 2:08 ` [PATCH 03/19] io-controller: Charge for time slice based on average disk rate Vivek Goyal
2009-06-09 2:08 ` [PATCH 04/19] io-controller: Modify cfq to make use of flat elevator fair queuing Vivek Goyal
2009-06-11 6:12 ` Gui Jianfeng
2009-06-11 14:21 ` Vivek Goyal
2009-06-15 8:56 ` Gui Jianfeng
2009-06-15 13:02 ` Vivek Goyal
2009-06-17 2:22 ` Gui Jianfeng
2009-06-17 13:00 ` Vivek Goyal
2009-06-09 2:08 ` [PATCH 05/19] io-controller: Common hierarchical fair queuing code in elevaotor layer Vivek Goyal
2009-06-09 2:08 ` Vivek Goyal [this message]
2009-06-09 2:08 ` [PATCH 07/19] io-controller: Export disk time used and nr sectors dipatched through cgroups Vivek Goyal
2009-06-09 2:08 ` [PATCH 08/19] io-controller: idle for sometime on sync queue before expiring it Vivek Goyal
2009-06-09 2:08 ` [PATCH 09/19] io-controller: Separate out queue and data Vivek Goyal
2009-06-09 2:08 ` [PATCH 10/19] io-conroller: Prepare elevator layer for single queue schedulers Vivek Goyal
2009-06-11 8:10 ` Gui Jianfeng
2009-06-11 14:41 ` Vivek Goyal
2009-06-12 0:37 ` Gui Jianfeng
2009-06-15 13:00 ` Vivek Goyal
2009-06-09 2:08 ` [PATCH 11/19] io-controller: noop changes for hierarchical fair queuing Vivek Goyal
2009-06-09 2:08 ` [PATCH 12/19] io-controller: deadline " Vivek Goyal
2009-06-09 2:08 ` [PATCH 13/19] io-controller: anticipatory " Vivek Goyal
2009-06-09 2:08 ` [PATCH 14/19] blkio_cgroup patches from Ryo to track async bios Vivek Goyal
2009-06-09 2:08 ` [PATCH 15/19] io-controller: map async requests to appropriate cgroup Vivek Goyal
2009-06-17 9:17 ` Gui Jianfeng
2009-06-17 13:00 ` Vivek Goyal
2009-06-09 2:08 ` [PATCH 16/19] io-controller: Per cgroup request descriptor support Vivek Goyal
2009-06-09 2:09 ` [PATCH 17/19] io-controller: Support per cgroup per device weights and io class Vivek Goyal
2009-06-10 7:44 ` Gui Jianfeng
2009-06-10 13:22 ` Vivek Goyal
2009-06-09 2:09 ` [PATCH 18/19] io-controller: Debug hierarchical IO scheduling Vivek Goyal
2009-06-19 1:40 ` Gui Jianfeng
2009-06-19 14:05 ` Vivek Goyal
2009-06-19 6:26 ` Gui Jianfeng
2009-06-19 14:08 ` Vivek Goyal
2009-06-09 2:09 ` [PATCH 19/19] io-controller: experimental debug patch for async queue wait before expiry Vivek Goyal
2009-06-09 4:22 ` [RFC] IO scheduler based IO controller V4 Gui Jianfeng
2009-06-09 13:52 ` Vivek Goyal
2009-06-10 1:05 ` Gui Jianfeng
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=1244513342-11758-7-git-send-email-vgoyal@redhat.com \
--to=vgoyal@redhat.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=guijianfeng@cn.fujitsu.com \
--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 \
/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