Skip to contentSkip to conversation

row: Adding support for urgent requests handling

PATCH Superseded Tatyana Brokhman 1 participant 3 messages Sep 16, 2012

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover row: Adding support for urgent requests handling

This patch set add support for handling urgent requests by the ROW algorith. It depends on 2 previosly uploaded patch sets:
1.[RFC/PATCH/RESEND 0/2] ROW scheduling Algorithm 2.[RFC/PATCH 0/2] Adding support for urgent requests handling

Tatyana Brokhman (2):
row: Adding support for reinsert already dispatched req
row: Add support for urgent request handling

 block/row-iosched.c |   78 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 77 insertions(+), 1 deletions(-)
Signature · 4 lines
1.7.6
--
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. 
Is a member of Code Aurora Forum, hosted by the Linux Foundation
#1 lore raw

PATCH 1/2 row: Adding support for reinsert already dispatched req

Add support for reinserting already dispatched request back to the schedulers internal data structures.
The request will be reinserted back to the queue (head) it was dispatched from as if it was never dispatched.

---
 block/row-iosched.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
block/row-iosched.c +28 -0
index c99863a..9135416 100644
@@ -273,6 +273,33 @@ static void row_add_request(struct request_queue *q,
 }
 
 /*
+ * row_reinsert_req() - Reinsert request back to the scheduler
+ * @q:	dispatch queue
+ * @rq:	request to add
+ *
+ * Reinsert the given request back to the queue it was
+ * dispatched from as if it was never dispatched.
+ *
+ * Returns 0 on success, error code otherwise
+ */
+static int row_reinsert_req(struct request_queue *q,
+			    struct request *rq)
+{
+	struct row_data    *rd = q->elevator->elevator_data;
+	struct row_queue   *rqueue = RQ_ROWQ(rq);
+
+	/* Verify rqueue is legitimate */
+	BUG_ON(rqueue != &rd->row_queues[rqueue->prio].rqueue);
+
+	list_add(&rq->queuelist, &rqueue->fifo);
+	rd->nr_reqs[rq_data_dir(rq)]++;
+
+	row_log_rowq(rd, rqueue->prio, "request reinserted");
+
+	return 0;
+}
+
+/**
  * row_remove_request() -  Remove given request from scheduler
  * @q:	requests queue
  * @rq:	request to remove
@@ -650,6 +677,7 @@ static struct elevator_type iosched_row = {
 		.elevator_merge_req_fn		= row_merged_requests,
 		.elevator_dispatch_fn		= row_dispatch_requests,
 		.elevator_add_req_fn		= row_add_request,
+		.elevator_reinsert_req_fn	= row_reinsert_req,
 		.elevator_former_req_fn		= elv_rb_former_request,
 		.elevator_latter_req_fn		= elv_rb_latter_request,
 		.elevator_set_req_fn		= row_set_request,
Signature · 4 lines
1.7.6
--
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. 
Is a member of Code Aurora Forum, hosted by the Linux Foundation
#2 lore raw

PATCH 2/2 row: Add support for urgent request handling

In reply to Tatyana Brokhman

This patch add support for handling urgent requests. ROW queue can be marked as "urgent" so if it was un-served and a request was added to it - it will trigger issuing urgent request to the driver.

---
 block/row-iosched.c |   52 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 50 insertions(+), 2 deletions(-)
block/row-iosched.c +50 -2
index 9135416..dd2bbfb 100644
@@ -27,6 +27,8 @@
 #include <linux/blktrace_api.h>
 #include <linux/jiffies.h>
 
+#include "blk.h"
+
 /*
  * enum row_queue_prio - Priorities of the ROW queues
  *
@@ -58,6 +60,17 @@ static const bool queue_idling_enabled[] = {
 	false,	/* ROWQ_PRIO_LOW_SWRITE */
 };
 
+/* Flags indicating whether the queue can notify on urgent requests */
+static const bool urgent_queues[] = {
+	true,	/* ROWQ_PRIO_HIGH_READ */
+	true,	/* ROWQ_PRIO_REG_READ */
+	false,	/* ROWQ_PRIO_HIGH_SWRITE */
+	false,	/* ROWQ_PRIO_REG_SWRITE */
+	false,	/* ROWQ_PRIO_REG_WRITE */
+	false,	/* ROWQ_PRIO_LOW_READ */
+	false,	/* ROWQ_PRIO_LOW_SWRITE */
+};
+
 /* Default values for row queues quantums in each dispatch cycle */
 static const int queue_quantum[] = {
 	100,	/* ROWQ_PRIO_HIGH_READ */
@@ -269,7 +282,13 @@ static void row_add_request(struct request_queue *q,
 		rqueue->idle_data.idle_trigger_time =
 			jiffies + msecs_to_jiffies(rd->read_idle.freq);
 	}
-	row_log_rowq(rd, rqueue->prio, "added request");
+	if (urgent_queues[rqueue->prio] &&
+	    row_rowq_unserved(rd, rqueue->prio)) {
+		row_log_rowq(rd, rqueue->prio,
+			     "added urgent req curr_queue = %d",
+			     rd->curr_queue);
+	} else
+		row_log_rowq(rd, rqueue->prio, "added request");
 }
 
 /*
@@ -289,7 +308,12 @@ static int row_reinsert_req(struct request_queue *q,
 	struct row_queue   *rqueue = RQ_ROWQ(rq);
 
 	/* Verify rqueue is legitimate */
-	BUG_ON(rqueue != &rd->row_queues[rqueue->prio].rqueue);
+	if (rqueue->prio >= ROWQ_MAX_PRIO) {
+		pr_err("\n\nROW BUG: row_reinsert_req() rqueue->prio = %d\n",
+			   rqueue->prio);
+		blk_dump_rq_flags(rq, "");
+		return -EIO;
+	}
 
 	list_add(&rq->queuelist, &rqueue->fifo);
 	rd->nr_reqs[rq_data_dir(rq)]++;
@@ -299,6 +323,29 @@ static int row_reinsert_req(struct request_queue *q,
 	return 0;
 }
 
+/*
+ * row_urgent_pending() - Return TRUE if there is an urgent
+ *			  request on scheduler
+ * @q:	dispatch queue
+ *
+ */
+static bool row_urgent_pending(struct request_queue *q)
+{
+	struct row_data *rd = q->elevator->elevator_data;
+	int i;
+
+	for (i = 0; i < ROWQ_MAX_PRIO; i++)
+		if (urgent_queues[i] && row_rowq_unserved(rd, i) &&
+		    !list_empty(&rd->row_queues[i].rqueue.fifo)) {
+			row_log_rowq(rd, i,
+				     "Urgent request pending (curr=%i)",
+				     rd->curr_queue);
+			return true;
+		}
+
+	return false;
+}
+
 /**
  * row_remove_request() -  Remove given request from scheduler
  * @q:	requests queue
@@ -678,6 +725,7 @@ static struct elevator_type iosched_row = {
 		.elevator_dispatch_fn		= row_dispatch_requests,
 		.elevator_add_req_fn		= row_add_request,
 		.elevator_reinsert_req_fn	= row_reinsert_req,
+		.elevator_is_urgent_fn		= row_urgent_pending,
 		.elevator_former_req_fn		= elv_rb_former_request,
 		.elevator_latter_req_fn		= elv_rb_latter_request,
 		.elevator_set_req_fn		= row_set_request,
Signature · 4 lines
1.7.6
--
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. 
Is a member of Code Aurora Forum, hosted by the Linux Foundation