Linux Container Development
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	dm-devel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	jens.axboe-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org,
	nauman-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	dpshah-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org
Cc: akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org,
	snitzer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	agk-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Subject: [PATCH 06/20] io-controller: cfq changes to use hierarchical fair queuing code in elevaotor layer
Date: Tue, 26 May 2009 18:41:55 -0400	[thread overview]
Message-ID: <1243377729-2176-7-git-send-email-vgoyal@redhat.com> (raw)
In-Reply-To: <1243377729-2176-1-git-send-email-vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

Make cfq hierarhical.

Signed-off-by: Nauman Rafique <nauman-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Fabio Checconi <fabio-f9ZlEuEWxVeACYmtYXMKmw@public.gmane.org>
Signed-off-by: Paolo Valente <paolo.valente-rcYM44yAMweonA0d6jMUrA@public.gmane.org>
Signed-off-by: Aristeu Rozanski <aris-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Vivek Goyal <vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 block/Kconfig.iosched |    8 ++++++
 block/cfq-iosched.c   |   58 ++++++++++++++++++++++++++++++++++++++++++++++--
 init/Kconfig          |    2 +-
 3 files changed, 64 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 f90c534..f00110e 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1229,6 +1229,50 @@ 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) {
+			cic_set_cfqq(cic, NULL, 0);
+			cfq_put_queue(async_cfqq);
+		}
+	}
+
+	if (sync_cfqq != NULL) {
+		__iog = cfqq_to_io_group(sync_cfqq);
+		if (iog != __iog)
+			io_ioq_move(q->elevator, sync_cfqq->ioq, iog);
+	}
+
+	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 +1281,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 +1351,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))
@@ -1335,7 +1383,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,
@@ -1494,6 +1542,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.1

  parent reply	other threads:[~2009-05-26 22:41 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1243377729-2176-1-git-send-email-vgoyal@redhat.com>
     [not found] ` <1243377729-2176-1-git-send-email-vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-05-26 22:41   ` [PATCH 01/20] io-controller: Documentation Vivek Goyal
2009-05-26 22:41   ` [PATCH 02/20] io-controller: Common flat fair queuing code in elevaotor layer Vivek Goyal
     [not found]     ` <e98e18940905271353kc6890dbxa1ea63026c8faec1@mail.gmail.com>
     [not found]       ` <e98e18940905271353kc6890dbxa1ea63026c8faec1-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-05-28  8:52         ` Fabio Checconi
2009-05-28 16:00         ` Vivek Goyal
     [not found]       ` <20090528160003.GA4335@redhat.com>
     [not found]         ` <20090528160003.GA4335-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-05-28 19:41           ` Nauman Rafique
     [not found]         ` <e98e18940905281241v4aa24716j91f351a828af604a@mail.gmail.com>
     [not found]           ` <e98e18940905281241v4aa24716j91f351a828af604a-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-05-29 16:06             ` Vivek Goyal
     [not found]           ` <20090529160610.GC26962@redhat.com>
     [not found]             ` <20090529160610.GC26962-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-05-29 16:57               ` Fabio Checconi
     [not found]             ` <20090529165716.GB18141@gandalf.sssup.it>
     [not found]               ` <20090529165716.GB18141-f9ZlEuEWxVeACYmtYXMKmw@public.gmane.org>
2009-05-29 19:06                 ` Nauman Rafique
     [not found]               ` <e98e18940905291206p2e05bc5cxf499479270e34074@mail.gmail.com>
     [not found]                 ` <e98e18940905291206p2e05bc5cxf499479270e34074-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-05-29 19:16                   ` Vivek Goyal
     [not found]     ` <1243377729-2176-3-git-send-email-vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-05-27 20:53       ` Nauman Rafique
2009-06-08  1:08       ` Gui Jianfeng
2009-06-08  7:44       ` Gui Jianfeng
     [not found]         ` <4A2CC15F.2010708-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2009-06-08 13:56           ` Vivek Goyal
     [not found]     ` <4A2C649C.8070806@cn.fujitsu.com>
     [not found]       ` <4A2C649C.8070806-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2009-06-08 12:58         ` Vivek Goyal
2009-05-26 22:41   ` [PATCH 03/20] io-controller: Charge for time slice based on average disk rate Vivek Goyal
2009-05-26 22:41   ` [PATCH 04/20] io-controller: Modify cfq to make use of flat elevator fair queuing Vivek Goyal
2009-05-26 22:41   ` [PATCH 05/20] io-controller: Common hierarchical fair queuing code in elevaotor layer Vivek Goyal
2009-05-26 22:41   ` Vivek Goyal [this message]
2009-05-26 22:41   ` [PATCH 07/20] io-controller: Export disk time used and nr sectors dipatched through cgroups Vivek Goyal
2009-05-26 22:41   ` [PATCH 08/20] io-controller: idle for sometime on sync queue before expiring it Vivek Goyal
2009-05-26 22:41   ` [PATCH 09/20] io-controller: Separate out queue and data Vivek Goyal
2009-05-26 22:41   ` [PATCH 10/20] io-conroller: Prepare elevator layer for single queue schedulers Vivek Goyal
2009-05-26 22:42   ` [PATCH 11/20] io-controller: noop changes for hierarchical fair queuing Vivek Goyal
2009-05-26 22:42   ` [PATCH 12/20] io-controller: deadline " Vivek Goyal
2009-05-26 22:42   ` [PATCH 13/20] io-controller: anticipatory " Vivek Goyal
2009-05-26 22:42   ` [PATCH 14/20] blkio_cgroup patches from Ryo to track async bios Vivek Goyal
2009-05-26 22:42   ` [PATCH 15/20] io-controller: map async requests to appropriate cgroup Vivek Goyal
2009-05-26 22:42   ` [PATCH 16/20] io-controller: IO group refcounting support Vivek Goyal
2009-05-26 22:42   ` [PATCH 17/20] io-controller: Per cgroup request descriptor support Vivek Goyal
2009-05-26 22:42   ` [PATCH 18/20] io-controller: Support per cgroup per device weights and io class Vivek Goyal
2009-05-26 22:42   ` [PATCH 19/20] io-controller: Debug hierarchical IO scheduling Vivek Goyal
2009-05-26 22:42   ` [PATCH 20/20] io-controller: experimental debug patch for async queue wait before expiry Vivek Goyal
     [not found] ` <1243377729-2176-16-git-send-email-vgoyal@redhat.com>
     [not found]   ` <1243377729-2176-16-git-send-email-vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-05-28  9:27     ` [PATCH 15/20] io-controller: map async requests to appropriate cgroup Ryo Tsuruta
     [not found]   ` <20090528.182740.193697101.ryov@valinux.co.jp>
     [not found]     ` <20090528.182740.193697101.ryov-jCdQPDEk3idL9jVzuh4AOg@public.gmane.org>
2009-05-28 16:57       ` Vivek Goyal
     [not found]     ` <20090528165710.GB4335@redhat.com>
     [not found]       ` <20090528165710.GB4335-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-05-29  3:17         ` Ryo Tsuruta
     [not found]       ` <20090529.121737.189708024.ryov@valinux.co.jp>
     [not found]         ` <20090529.121737.189708024.ryov-jCdQPDEk3idL9jVzuh4AOg@public.gmane.org>
2009-05-29 13:38           ` Vivek Goyal
     [not found]         ` <20090529133804.GA26962@redhat.com>
     [not found]           ` <20090529133804.GA26962-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-06-01 11:25             ` Ryo Tsuruta
     [not found] ` <1243377729-2176-2-git-send-email-vgoyal@redhat.com>
     [not found]   ` <1243377729-2176-2-git-send-email-vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-05-29 15:42     ` [PATCH 01/20] io-controller: Documentation Balbir Singh
     [not found]   ` <20090529154252.GD5587@balbir.in.ibm.com>
     [not found]     ` <20090529154252.GD5587-SINUvgVNF2CyUtPGxGje5AC/G2K4zDHf@public.gmane.org>
2009-05-29 15:53       ` Vivek Goyal
     [not found] ` <1243377729-2176-11-git-send-email-vgoyal@redhat.com>
     [not found]   ` <1243377729-2176-11-git-send-email-vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-06-05  9:17     ` [PATCH 10/20] io-conroller: Prepare elevator layer for single queue schedulers Gui Jianfeng
     [not found]   ` <4A28E293.90402@cn.fujitsu.com>
     [not found]     ` <4A28E293.90402-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2009-06-05 13:22       ` Vivek Goyal
     [not found] ` <1243377729-2176-6-git-send-email-vgoyal@redhat.com>
     [not found]   ` <1243377729-2176-6-git-send-email-vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-06-05  9:36     ` [PATCH 05/20] io-controller: Common hierarchical fair queuing code in elevaotor layer Gui Jianfeng
     [not found]   ` <4A28E710.5080307@cn.fujitsu.com>
     [not found]     ` <4A28E710.5080307-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2009-06-05 13:21       ` Vivek Goyal
     [not found] ` <1243377729-2176-17-git-send-email-vgoyal@redhat.com>
     [not found]   ` <1243377729-2176-17-git-send-email-vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-06-08  2:03     ` [PATCH 16/20] io-controller: IO group refcounting support Gui Jianfeng
     [not found]       ` <4A2C716C.8070808-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2009-06-08 13:53         ` Vivek Goyal
     [not found] <1245443858-8487-1-git-send-email-vgoyal@redhat.com>
     [not found] ` <1245443858-8487-1-git-send-email-vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-06-19 20:37   ` [PATCH 06/20] io-controller: cfq changes to use hierarchical fair queuing code in elevaotor layer 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=1243377729-2176-7-git-send-email-vgoyal@redhat.com \
    --to=vgoyal-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=agk-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=dm-devel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=dpshah-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=jens.axboe-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org \
    --cc=nauman-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=snitzer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    /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