Skip to contentSkip to conversation

I/O scheduler starvation

PATCH New Jens Axboe 1 participant 1 message May 29, 2001 Block layer

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

PATCH 1/1 I/O scheduler starvation

Hi,

Going over this a bit, an deviant from the original design of elevator_linus seems to have snuck in. Well, almost, I've been aware of this for some time...

The idea was _not_ to account request merges, since they will (in by far the most cases) incur the cost of a seek. Instead we just account seeks, any seek (and please don't start a debate on short vs long seeks again, I'm not listening). The attached patch corrects this, and also corrects the initial sequence numbers (typically this would be sequence / 8 number of seeks allowed to pass a request now).

I'll do some formal timing on this later.

Signature · 1 line
Jens Axboe
block/ll_rw_blk.c renamed from block/ll_rw_blk.c~ +3 -3
@@ -742,7 +742,6 @@
 		case ELEVATOR_BACK_MERGE:
 			if (!q->back_merge_fn(q, req, bh, max_segments))
 				break;
-			elevator->elevator_merge_cleanup_fn(q, req, count);
 			req->bhtail->b_reqnext = bh;
 			req->bhtail = bh;
 			req->nr_sectors = req->hard_nr_sectors += count;
@@ -754,7 +753,6 @@
 		case ELEVATOR_FRONT_MERGE:
 			if (!q->front_merge_fn(q, req, bh, max_segments))
 				break;
-			elevator->elevator_merge_cleanup_fn(q, req, count);
 			bh->b_reqnext = req->bh;
 			req->bh = bh;
 			req->buffer = bh->b_data;
@@ -775,8 +773,10 @@
 			 * request. if no hints, just add it to the back
 			 * of the queue
 			 */
-			if (req)
+			if (req) {
 				insert_here = &req->queue;
+				elevator->elevator_merge_cleanup_fn(q, req, count);
+			}
 			break;
 
 		default:
block/elevator.c renamed from block/elevator.c~ +2 -3
@@ -110,7 +110,6 @@
 			break;
 		} else if (__rq->sector - count == bh->b_rsector) {
 			ret = ELEVATOR_FRONT_MERGE;
-			__rq->elevator_sequence -= count;
 			*req = __rq;
 			break;
 		}
@@ -126,10 +125,10 @@
 	/*
 	 * second pass scan of requests that got passed over, if any
 	 */
-	while ((entry = entry->next) != head) {
+	do {
 		struct request *tmp = blkdev_entry_to_request(entry);
 		tmp->elevator_sequence -= count;
-	}
+	} while ((entry = entry->next) != head);
 }
 
 void elevator_linus_merge_req(struct request *req, struct request *next)
linux/elevator.h renamed from linux/elevator.h~ +2 -2
@@ -93,8 +93,8 @@
 
 #define ELEVATOR_LINUS							\
 ((elevator_t) {								\
-	8192,				/* read passovers */		\
-	16384,				/* write passovers */		\
+	1024,				/* read passovers */		\
+	4096,				/* write passovers */		\
 									\
 	elevator_linus_merge,		/* elevator_merge_fn */		\
 	elevator_linus_merge_cleanup,	/* elevator_merge_cleanup_fn */	\