All of lore.kernel.org
 help / color / mirror / Atom feed
From: Charles Baylis <cb-lkml@fish.zetnet.co.uk>
To: linux-kernel@vger.kernel.org
Subject: [RFC] [PATCH] use nice values in deadline IO scheduler
Date: Wed, 11 Dec 2002 15:44:16 +0000	[thread overview]
Message-ID: <200212111544.17336.cb-lkml@fish.zetnet.co.uk> (raw)


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);
 	}
 }


                 reply	other threads:[~2002-12-11 15:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200212111544.17336.cb-lkml@fish.zetnet.co.uk \
    --to=cb-lkml@fish.zetnet.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.