- Previous thread: [PATCH] net: Keep interface binding when sending packets with ipi_ifindex = 0
- Next thread: [PATCH][RFT] cfq-iosched: drain device before switching to a sync queue
- Threads sorted by date: kernel 200907
Make cfq hierarhical.
Signed-off-by: Nauman Rafique
Signed-off-by: Fabio Checconi
Signed-off-by: Paolo Valente
Signed-off-by: Aristeu Rozanski
Signed-off-by: Vivek Goyal
---
block/Kconfig.iosched | 8 ++++++
block/cfq-iosched.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++-
init/Kconfig | 2 +-
3 files changed, 69 insertions(+), 3 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 6ddc882..02b5cd5 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1222,6 +1222,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)
@@ -1232,7 +1286,7 @@ cfq_find_alloc_queue(struct cfq_data *cfqd, int is_sync,
struct io_queue *ioq = NULL, *new_ioq = NULL;
struct io_group *iog = NULL;
retry:
- iog = io_get_io_group(q);
+ iog = io_get_io_group(q, 1);
cic = cfq_cic_lookup(cfqd, ioc);
/* cic always exists here */
@@ -1334,7 +1388,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_get_io_group(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,
@@ -1493,6 +1547,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 a380f46..eaa44db 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -613,7 +613,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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signed-off-by: Nauman Rafique
Signed-off-by: Fabio Checconi
Signed-off-by: Paolo Valente
Signed-off-by: Aristeu Rozanski
Signed-off-by: Vivek Goyal
---
block/Kconfig.iosched | 8 ++++++
block/cfq-iosched.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++-
init/Kconfig | 2 +-
3 files changed, 69 insertions(+), 3 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 6ddc882..02b5cd5 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1222,6 +1222,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)
@@ -1232,7 +1286,7 @@ cfq_find_alloc_queue(struct cfq_data *cfqd, int is_sync,
struct io_queue *ioq = NULL, *new_ioq = NULL;
struct io_group *iog = NULL;
retry:
- iog = io_get_io_group(q);
+ iog = io_get_io_group(q, 1);
cic = cfq_cic_lookup(cfqd, ioc);
/* cic always exists here */
@@ -1334,7 +1388,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_get_io_group(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,
@@ -1493,6 +1547,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 a380f46..eaa44db 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -613,7 +613,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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Conversations: [RFC] IO scheduler based IO controller V6
- [RFC] IO scheduler based IO controller V6 by Vivek Goyal on 2009-07-02T20:04:34+00:00
- [PATCH 01/25] io-controller: Documentation by Vivek Goyal on 2009-07-02T20:05:04+00:00
- [PATCH 05/25] io-controller: Charge for time slice based on average disk rate by Vivek Goyal on 2009-07-02T20:05:04+00:00
- [PATCH 14/25] io-controller: Separate out queue and data by Vivek Goyal on 2009-07-02T20:05:05+00:00
- [PATCH 23/25] io-controller: Support per cgroup per device weights and io class by Vivek Goyal on 2009-07-02T20:05:37+00:00
- [PATCH 03/25] io-controller: bfq support of in-class preemption by Vivek Goyal on 2009-07-02T20:05:54+00:00
- [PATCH 22/25] io-controller: Per io group bdi congestion interface by Vivek Goyal on 2009-07-02T20:06:19+00:00
- [PATCH 10/25] io-controller: cfq changes to use hierarchical fair queuing code in elevaotor layer by Vivek Goyal on 2009-07-02T20:06:19+00:00
- [PATCH 16/25] io-controller: noop changes for hierarchical fair queuing by Vivek Goyal on 2009-07-02T20:06:51+00:00
- [PATCH 21/25] io-controller: Per cgroup request descriptor support by Vivek Goyal on 2009-07-02T20:06:51+00:00
- [PATCH 18/25] io-controller: anticipatory changes for hierarchical fair queuing by Vivek Goyal on 2009-07-02T20:07:22+00:00
- [PATCH 19/25] blkio_cgroup patches from Ryo to track async bios. by Vivek Goyal on 2009-07-02T20:07:22+00:00
- [PATCH 15/25] io-conroller: Prepare elevator layer for single queue schedulers by Vivek Goyal on 2009-07-02T20:07:55+00:00
- [PATCH 06/25] io-controller: Modify cfq to make use of flat elevator fair queuing by Vivek Goyal on 2009-07-02T20:08:20+00:00
- [PATCH 02/25] io-controller: Core of the B-WF2Q+ scheduler by Vivek Goyal on 2009-07-02T20:08:39+00:00
- [PATCH 13/25] io-controller: Wait for requests to complete from last queue before new queue is scheduled by Vivek Goyal on 2009-07-02T20:08:39+00:00
- [PATCH 24/25] io-controller: Debug hierarchical IO scheduling by Vivek Goyal on 2009-07-02T20:09:19+00:00
- [PATCH 08/25] io-controller: cgroup related changes for hierarchical group support by Vivek Goyal on 2009-07-02T20:09:19+00:00
- [PATCH 17/25] io-controller: deadline changes for hierarchical fair queuing by Vivek Goyal on 2009-07-02T20:09:45+00:00
- [PATCH 09/25] io-controller: Common hierarchical fair queuing code in elevaotor layer by Vivek Goyal on 2009-07-02T20:11:01+00:00
- [PATCH 11/25] io-controller: Export disk time used and nr sectors dipatched through cgroups by Vivek Goyal on 2009-07-02T20:11:08+00:00
- [PATCH 20/25] io-controller: map async requests to appropriate cgroup by Vivek Goyal on 2009-07-02T20:11:50+00:00
- Re: [PATCH 13/25] io-controller: Wait for requests to complete from last queue before new queue is scheduled by Nauman Rafique on 2009-07-02T20:12:01+00:00
- [PATCH 12/25] io-controller: idle for sometime on sync queue before expiring it by Vivek Goyal on 2009-07-02T20:12:18+00:00
- Re: [PATCH 09/25] io-controller: Common hierarchical fair queuing code in elevaotor layer by Gui Jianfeng on 2009-07-06T02:47:16+00:00
- Re: [PATCH 11/25] io-controller: Export disk time used and nr sectors dipatched through cgroups by Gui Jianfeng on 2009-07-08T02:17:54+00:00
- Re: [PATCH 21/25] io-controller: Per cgroup request descriptor support by Gui Jianfeng on 2009-07-08T03:28:26+00:00
- Re: [RFC] IO scheduler based IO controller V6 by Balbir Singh on 2009-07-08T03:56:43+00:00
- [PATCH] io-controller: implement per group request allocation limitation by Gui Jianfeng on 2009-07-10T01:57:27+00:00
- Re: [PATCH 21/25] io-controller: Per cgroup request descriptor support by Gui Jianfeng on 2009-07-21T05:39:05+00:00
- Re: [PATCH 21/25] io-controller: Per cgroup request descriptor support by Nauman Rafique on 2009-07-21T05:55:51+00:00
- Re: [RFC] IO scheduler based IO controller V6 by Gui Jianfeng on 2009-07-27T02:12:20+00:00
Related Threads
- Bounce replies are not coming back through relay - postfix
- grails-user - Setting up eclipse launch configuration for debugging a grails generated project - grails
- jscript - Update Dutch translation - wine
- DHCP and router configuration - ubuntu
- CentOS - RHEL 6 beta manuals online - centos
- CMS - cakephp
- mmdevapi: Add stub for IAudioEndpointVolume - wine
- installing gnome - freebsd
- osol-help - /usr/bin/mail problem in snv_134 - opensolaris
- GENERAL - Indexing queries with bit masks - pgsql