Skip to contentSkip to conversation

Scheduler issue 1, RT tasks ...

RFC Dieter Nützel 3 participants 3 messages Dec 29, 2001 Block layer

lore
Share & tools
lore
#0 lore raw
Quoted 23 lines · Martin Knoblauch
Quoted 6 lines

Re: [RFC] Scheduler issue 1, RT tasks ...

Quoted 2 lines

Right, that was my question. George says, in your words, "for better

Quoted 8 lines
Quoted 1 line

standards compliancy ..." and I want to know why you guys think

that.

The thought was that if someone need RT tasks he probably need a very low latency and so the idea that by applying global preemption decisions would lead to a better compliancy. But i'll be happy to ear that this is false anyway ...

without wanting to start a RT flame-fest, what do people really want
when they talk about RT in this [Linux] context:

- very low latency
- deterministic latency ("never to exceed")
- both
- something completely different

Quoted 9 lines

All of the above from time to time and user to user. That is, some folks want one or more of the above, some folks want more, some less. What is really up? Well they have a job to do that requires certain things. Different jobs require different capabilities. It is hard to say that any given system will do a reasonably complex job with out testing. For example we may have the required latency but find the system fails because, to get the latency, we preempted another task that was (and so still is) in the middle of updating something we need to complete the job.

So George what direction should I try for some tests? 2.4.17 plus your and Robert's preempt plus lock-break? Add your high-res-timers, rtscheduler or both? Do they apply against 2.4.17/2.4.18-pre1?
A combination of the above plus Davide's BMQS?

I ask because my MP3/Ogg-Vorbis hiccup during dbench isn't solved anyway. Running 2.4.17 + preempt + lock-break + 10_vm-21 (AA).
Some wisdom?

Thank you for all your work and
Happy New Year

-Dieter

Signature · 6 lines
Dieter Nützel
Graduate Student, Computer Science

University of Hamburg
Department of Computer Science
@home: [email protected]
#1 lore raw
Quoted 4 lines · Dieter Nützel

I ask because my MP3/Ogg-Vorbis hiccup during dbench isn't solved anyway. Running 2.4.17 + preempt + lock-break + 10_vm-21 (AA).
Some wisdom?

Please test this elevator patch. I'll be putting it out more formally in a day or two. Much more testing is needed yet, but for me, the time to read a 16 megabyte file whilst running dbench 160 falls from three minutes thirty seconds to seven seconds. (This is a VM thing, not an elevator thing).

drivers/block/elevator.c +55 -1
@@ -82,6 +82,7 @@ int elevator_linus_merge(request_queue_t
 {
 	struct list_head *entry = &q->queue_head;
 	unsigned int count = bh->b_size >> 9, ret = ELEVATOR_NO_MERGE;
+	const int max_bomb_segments = q->elevator.max_bomb_segments;
 
 	while ((entry = entry->prev) != head) {
 		struct request *__rq = blkdev_entry_to_request(entry);
@@ -116,6 +117,56 @@ int elevator_linus_merge(request_queue_t
 		}
 	}
 
+	/*
+	 * If we failed to merge a read anywhere in the request
+	 * queue, we really don't want to place it at the end
+	 * of the list, behind lots of writes.  So place it near
+	 * the front.
+	 *
+	 * We don't want to place it in front of _all_ writes: that
+	 * would create lots of seeking, and isn't tunable.
+	 * We try to avoid promoting this read in front of existing
+	 * reads.
+	 *
+	 * max_bomb_sectors becomes the maximum number of write
+	 * requests which we allow to remain in place in front of
+	 * a newly introduced read.  We weight things a little bit,
+	 * so large writes are more expensive than small ones, but it's
+	 * requests which count, not sectors.
+	 */
+	if (max_bomb_segments && rw == READ && ret == ELEVATOR_NO_MERGE) {
+		int cur_latency = 0;
+		struct request * const cur_request = *req;
+
+		entry = head->next;
+		while (entry != &q->queue_head) {
+			struct request *__rq;
+
+			if (entry == &q->queue_head)
+				BUG();
+			if (entry == q->queue_head.next &&
+					q->head_active && !q->plugged)
+				BUG();
+			__rq = blkdev_entry_to_request(entry);
+
+			if (__rq == cur_request) {
+				/*
+				 * This is where the old algorithm placed it.
+				 * There's no point pushing it further back,
+				 * so leave it here, in sorted order.
+				 */
+				break;
+			}
+			if (__rq->cmd == WRITE) {
+				cur_latency += 1 + __rq->nr_sectors / 64;
+				if (cur_latency >= max_bomb_segments) {
+					*req = __rq;
+					break;
+				}
+			}
+			entry = entry->next;
+		}
+	}
 	return ret;
 }
 
@@ -188,7 +239,7 @@ int blkelvget_ioctl(elevator_t * elevato
 	output.queue_ID			= elevator->queue_ID;
 	output.read_latency		= elevator->read_latency;
 	output.write_latency		= elevator->write_latency;
-	output.max_bomb_segments	= 0;
+	output.max_bomb_segments	= elevator->max_bomb_segments;
 
 	if (copy_to_user(arg, &output, sizeof(blkelv_ioctl_arg_t)))
 		return -EFAULT;
@@ -207,9 +258,12 @@ int blkelvset_ioctl(elevator_t * elevato
 		return -EINVAL;
 	if (input.write_latency < 0)
 		return -EINVAL;
+	if (input.max_bomb_segments < 0)
+		return -EINVAL;
 
 	elevator->read_latency		= input.read_latency;
 	elevator->write_latency		= input.write_latency;
+	elevator->max_bomb_segments	= input.max_bomb_segments;
 	return 0;
 }
 
include/linux/elevator.h +14 -28

79 lines not on this page · raw message

#2 lore raw
In reply to Dieter Nützel
Quoted 40 lines · On Sat, 29 Dec 2001, Dieter [iso-8859-15] N�tzel wrote:
Quoted 23 lines · Martin Knoblauch
Quoted 6 lines

Re: [RFC] Scheduler issue 1, RT tasks ...

Quoted 2 lines

Right, that was my question. George says, in your words, "for better

Quoted 8 lines
Quoted 1 line

standards compliancy ..." and I want to know why you guys think

that.

The thought was that if someone need RT tasks he probably need a very low latency and so the idea that by applying global preemption decisions would lead to a better compliancy. But i'll be happy to ear that this is false anyway ...

without wanting to start a RT flame-fest, what do people really want
when they talk about RT in this [Linux] context:

- very low latency
- deterministic latency ("never to exceed")
- both
- something completely different

Quoted 9 lines

All of the above from time to time and user to user. That is, some folks want one or more of the above, some folks want more, some less. What is really up? Well they have a job to do that requires certain things. Different jobs require different capabilities. It is hard to say that any given system will do a reasonably complex job with out testing. For example we may have the required latency but find the system fails because, to get the latency, we preempted another task that was (and so still is) in the middle of updating something we need to complete the job.

So George what direction should I try for some tests? 2.4.17 plus your and Robert's preempt plus lock-break? Add your high-res-timers, rtscheduler or both? Do they apply against 2.4.17/2.4.18-pre1?
A combination of the above plus Davide's BMQS?

Quoted 3 lines

I ask because my MP3/Ogg-Vorbis hiccup during dbench isn't solved anyway. Running 2.4.17 + preempt + lock-break + 10_vm-21 (AA).
Some wisdom?

A bad scheduler can make the latency to increase but in your case i don't think that it could increase that much ( in percent ). By copying a huge file arund you can experience spots of 1-2 secs of machine freeze and this is definitely not the scheduler. The demage the a bad scheduler can do is directly proportional to the cs anyway.

- Davide