[RFC] [PATCH] use nice values in deadline IO scheduler

Charles Baylis (cb-lkml@fish.zetnet.co.uk)
Wed, 11 Dec 2002 15:44:16 +0000


This untested patch uses the nice value of the current task to scale the
deadline for new read requests.

Does current contain a pointer to the task which caused the IO request at
this point? Is there any other reason why this might be a daft thing to do?

--- drivers/block/deadline-iosched.c~std 2002-12-11 14:33:48.000000000 +0000
+++ drivers/block/deadline-iosched.c 2002-12-11 15:17:58.000000000 +0000
@@ -17,6 +17,7 @@
#include <linux/init.h>
#include <linux/compiler.h>
#include <linux/hash.h>
+#include <linux/sched.h>

/*
* feel free to try other values :-). read_expire value is the timeout for
@@ -81,6 +82,19 @@ static kmem_cache_t *drq_pool;
#define RQ_DATA(rq) ((struct deadline_rq *) (rq)->elevator_private)

/*
+ * scale_deadline
+ */
+static int scale_deadline(int default_deadline)
+{
+ int prio = current->static_prio - MAX_RT_PRIO;
+ /* make priorities higher than nice -10 equal to nice -10 */
+ if (prio < 10)
+ prio = 10;
+ /* scale the deadline according to priority */
+ return default_deadline * prio/20;
+}
+
+/*
* rq hash
*/
static inline void __deadline_del_rq_hash(struct deadline_rq *drq)
@@ -440,7 +454,7 @@ deadline_add_request(request_queue_t *q,
/*
* set expire time and add to fifo list
*/
- drq->expires = jiffies + dd->read_expire;
+ drq->expires = jiffies + scale_deadline(dd->read_expire);
list_add_tail(&drq->fifo, &dd->read_fifo);
}
}

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