summaryrefslogtreecommitdiff
path: root/include/linux/ioprio.h
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2008-05-07 09:51:23 +0200
committerJens Axboe <jens.axboe@oracle.com>2008-05-07 09:51:23 +0200
commit6d63c275572d1e6f00d4fa154f16fbb0d8c2d2bf (patch)
tree715f4bab902f117c958a929e44cd0b2257e3be29 /include/linux/ioprio.h
parentdbaf2c003e151ad9231778819b0977f95e20e06f (diff)
downloadlwn-6d63c275572d1e6f00d4fa154f16fbb0d8c2d2bf.tar.gz
lwn-6d63c275572d1e6f00d4fa154f16fbb0d8c2d2bf.zip
cfq-iosched: make io priorities inherit CPU scheduling class as well as nice
We currently set all processes to the best-effort scheduling class, regardless of what CPU scheduling class they belong to. Improve that so that we correctly track idle and rt scheduling classes as well. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'include/linux/ioprio.h')
-rw-r--r--include/linux/ioprio.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h
index 2a3bb1bb7433..f98a656b17e5 100644
--- a/include/linux/ioprio.h
+++ b/include/linux/ioprio.h
@@ -68,6 +68,20 @@ static inline int task_nice_ioprio(struct task_struct *task)
}
/*
+ * 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
*/
extern int ioprio_best(unsigned short aprio, unsigned short bprio);