]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/ioprio.h
cfq-iosched: make io priorities inherit CPU scheduling class as well as nice
[linux-2.6-omap-h63xx.git] / include / linux / ioprio.h
index 2a3bb1bb74336f27c27f6627153900d46d6c178a..f98a656b17e5b4b732e57e0e70e4eb5ec53bce84 100644 (file)
@@ -67,6 +67,20 @@ static inline int task_nice_ioprio(struct task_struct *task)
        return (task_nice(task) + 20) / 5;
 }
 
+/*
+ * This is for the case where the task hasn't asked for a specific IO class.
+ * Check for idle and rt task process, and return appropriate IO class.
+ */
+static inline int task_nice_ioclass(struct task_struct *task)
+{
+       if (task->policy == SCHED_IDLE)
+               return IOPRIO_CLASS_IDLE;
+       else if (task->policy == SCHED_FIFO || task->policy == SCHED_RR)
+               return IOPRIO_CLASS_RT;
+       else
+               return IOPRIO_CLASS_BE;
+}
+
 /*
  * For inheritance, return the highest of the two given priorities
  */