From 5e7a1c25aecde56d96236749a09fd073bd620038 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 7 May 2008 09:51:23 +0200 Subject: [PATCH] --- yaml --- r: 96162 b: refs/heads/master c: 6d63c275572d1e6f00d4fa154f16fbb0d8c2d2bf h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/block/cfq-iosched.c | 4 ++-- trunk/include/linux/ioprio.h | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index ff476edc9dc9..51d61ef22484 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: dbaf2c003e151ad9231778819b0977f95e20e06f +refs/heads/master: 6d63c275572d1e6f00d4fa154f16fbb0d8c2d2bf diff --git a/trunk/block/cfq-iosched.c b/trunk/block/cfq-iosched.c index 7f909d2f4886..b399c62936e0 100644 --- a/trunk/block/cfq-iosched.c +++ b/trunk/block/cfq-iosched.c @@ -1303,10 +1303,10 @@ static void cfq_init_prio_data(struct cfq_queue *cfqq, struct io_context *ioc) printk(KERN_ERR "cfq: bad prio %x\n", ioprio_class); case IOPRIO_CLASS_NONE: /* - * no prio set, place us in the middle of the BE classes + * no prio set, inherit CPU scheduling settings */ cfqq->ioprio = task_nice_ioprio(tsk); - cfqq->ioprio_class = IOPRIO_CLASS_BE; + cfqq->ioprio_class = task_nice_ioclass(tsk); break; case IOPRIO_CLASS_RT: cfqq->ioprio = task_ioprio(ioc); diff --git a/trunk/include/linux/ioprio.h b/trunk/include/linux/ioprio.h index 2a3bb1bb7433..f98a656b17e5 100644 --- a/trunk/include/linux/ioprio.h +++ b/trunk/include/linux/ioprio.h @@ -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 */