[PATCH 1/2] io-controller: Prepare a rt ioq list in efqd to keeptrack of busy rt ioqs

From: Gui Jianfeng
Date: Fri Jun 26 2009 - 04:14:09 EST


Maintain a busy rt ioq list in efqd so that we can easily
keep track of all busy rt ioqs in system.

Signed-off-by: Gui Jianfeng <guijianfeng@xxxxxxxxxxxxxx>
---
block/elevator-fq.c | 8 ++++++++
block/elevator-fq.h | 6 ++++++
2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/block/elevator-fq.c b/block/elevator-fq.c
index d779282..1d4ec1f 100644
--- a/block/elevator-fq.c
+++ b/block/elevator-fq.c
@@ -3247,6 +3247,10 @@ void elv_add_ioq_busy(struct elv_fq_data *efqd, struct io_queue *ioq)
if (elv_ioq_class_rt(ioq)) {
struct io_group *iog = ioq_to_io_group(ioq);
iog->busy_rt_queues++;
+
+ /* queue lock has been already held by caller */
+ hlist_add_head_rcu(&ioq->rt_node,
+ &ioq->efqd->rt_ioq_list);
}

#ifdef CONFIG_DEBUG_GROUP_IOSCHED
@@ -3293,6 +3297,9 @@ void elv_del_ioq_busy(struct elevator_queue *e, struct io_queue *ioq,
if (elv_ioq_class_rt(ioq)) {
struct io_group *iog = ioq_to_io_group(ioq);
iog->busy_rt_queues--;
+
+ /* queue lock has been already held by caller */
+ hlist_del_rcu(&ioq->rt_node);
}

elv_deactivate_ioq(efqd, ioq, requeue);
@@ -4196,6 +4203,7 @@ int elv_init_fq_data(struct request_queue *q, struct elevator_queue *e)

INIT_WORK(&efqd->unplug_work, elv_kick_queue);
INIT_HLIST_HEAD(&efqd->group_list);
+ INIT_HLIST_HEAD(&efqd->rt_ioq_list);

efqd->elv_slice[0] = elv_slice_async;
efqd->elv_slice[1] = elv_slice_sync;
diff --git a/block/elevator-fq.h b/block/elevator-fq.h
index b3193f8..53a64b6 100644
--- a/block/elevator-fq.h
+++ b/block/elevator-fq.h
@@ -169,6 +169,9 @@ struct io_queue {
atomic_t ref;
unsigned int flags;

+ /* node to insert into efqd->rt_ioq_list */
+ struct hlist_node rt_node;
+
/* Pointer to generic elevator data structure */
struct elv_fq_data *efqd;
pid_t pid;
@@ -336,6 +339,9 @@ struct elv_fq_data {
/* List of io groups hanging on this elevator */
struct hlist_head group_list;

+ /* List of rt ioqs in hierarchy*/
+ struct hlist_head rt_ioq_list;
+
struct request_queue *queue;
unsigned int busy_queues;

--
1.5.4.rc3


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/