linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] cfq: ioprio inherit rt class
@ 2006-05-27  1:50 Con Kolivas
  2006-05-27  2:08 ` Con Kolivas
  2006-06-02 17:12 ` [ck] " Jens Axboe
  0 siblings, 2 replies; 7+ messages in thread
From: Con Kolivas @ 2006-05-27  1:50 UTC (permalink / raw)
  To: Jens Axboe; +Cc: ck list, linux list

Jens, ml

I was wondering if cfq io priorities should be explicitly set to the realtime 
class when no io priority is specified from realtime tasks as in the 
following patch? (rt_task() will need to be modified to suit the PI changes in
-mm)

---
Set cfq io priority class to realtime and scale the priority according to the
rt priority when no io priority is explicitly set in realtime tasks.

Signed-off-by: Con Kolivas <kernel@kolivas.org>

---
 block/cfq-iosched.c    |    4 ++--
 include/linux/ioprio.h |   12 +++++++++++-
 2 files changed, 13 insertions(+), 3 deletions(-)

Index: linux-2.6.17-rc5-ck2/block/cfq-iosched.c
===================================================================
--- linux-2.6.17-rc5-ck2.orig/block/cfq-iosched.c	2006-05-25 21:32:45.000000000 +1000
+++ linux-2.6.17-rc5-ck2/block/cfq-iosched.c	2006-05-25 23:55:22.000000000 +1000
@@ -1334,10 +1334,10 @@ static void cfq_init_prio_data(struct cf
 			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
+			 * Select class and ioprio according to policy and nice
 			 */
+			cfqq->ioprio_class = task_policy_ioprio_class(tsk);
 			cfqq->ioprio = task_nice_ioprio(tsk);
-			cfqq->ioprio_class = IOPRIO_CLASS_BE;
 			break;
 		case IOPRIO_CLASS_RT:
 			cfqq->ioprio = task_ioprio(tsk);
Index: linux-2.6.17-rc5-ck2/include/linux/ioprio.h
===================================================================
--- linux-2.6.17-rc5-ck2.orig/include/linux/ioprio.h	2006-05-25 23:02:06.000000000 +1000
+++ linux-2.6.17-rc5-ck2/include/linux/ioprio.h	2006-05-25 23:55:22.000000000 +1000
@@ -22,7 +22,7 @@
  * class, the default for any process. IDLE is the idle scheduling class, it
  * is only served when no one else is using the disk.
  */
-enum {
+enum ioprio_class {
 	IOPRIO_CLASS_NONE,
 	IOPRIO_CLASS_RT,
 	IOPRIO_CLASS_BE,
@@ -51,8 +51,18 @@ static inline int task_ioprio(struct tas
 	return IOPRIO_PRIO_DATA(task->ioprio);
 }
 
+static inline enum ioprio_class
+	task_policy_ioprio_class(struct task_struct *task)
+{
+	if (rt_task(task))
+		return IOPRIO_CLASS_RT;
+	return IOPRIO_CLASS_BE;
+}
+
 static inline int task_nice_ioprio(struct task_struct *task)
 {
+	if (rt_task(task))
+		return (task->rt_priority * IOPRIO_BE_NR / MAX_RT_PRIO);
 	return (task_nice(task) + 20) / 5;
 }
 

-- 
-ck

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch] cfq: ioprio inherit rt class
  2006-05-27  1:50 [patch] cfq: ioprio inherit rt class Con Kolivas
@ 2006-05-27  2:08 ` Con Kolivas
  2006-06-02 17:12 ` [ck] " Jens Axboe
  1 sibling, 0 replies; 7+ messages in thread
From: Con Kolivas @ 2006-05-27  2:08 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jens Axboe, ck list

On Saturday 27 May 2006 11:50, Con Kolivas wrote:
> Jens, ml
>
> I was wondering if cfq io priorities should be explicitly set to the
> realtime class when no io priority is specified from realtime tasks as in
> the following patch? (rt_task() will need to be modified to suit the PI
> changes in -mm)
>
> ---
> Set cfq io priority class to realtime and scale the priority according to
> the rt priority when no io priority is explicitly set in realtime tasks.

sorry, rather than this:
> +		return (task->rt_priority * IOPRIO_BE_NR / MAX_RT_PRIO);

it should be:
return ((MAX_RT_PRIO - task->rt_priority) * IOPRIO_BE_NR / MAX_RT_PRIO);

-- 
-ck

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ck] [patch] cfq: ioprio inherit rt class
  2006-05-27  1:50 [patch] cfq: ioprio inherit rt class Con Kolivas
  2006-05-27  2:08 ` Con Kolivas
@ 2006-06-02 17:12 ` Jens Axboe
  2006-06-03  0:10   ` Con Kolivas
  1 sibling, 1 reply; 7+ messages in thread
From: Jens Axboe @ 2006-06-02 17:12 UTC (permalink / raw)
  To: Con Kolivas; +Cc: ck list, linux list

On Sat, May 27 2006, Con Kolivas wrote:
> Jens, ml
> 
> I was wondering if cfq io priorities should be explicitly set to the realtime 
> class when no io priority is specified from realtime tasks as in the 
> following patch? (rt_task() will need to be modified to suit the PI changes in
> -mm)

Not sure. RT io needs to be considered carefully, but I guess so does RT
CPU scheduling. For now I'd prefer to play it a little safer, and only
inheric the priority value and not the class.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch] cfq: ioprio inherit rt class
  2006-06-02 17:12 ` [ck] " Jens Axboe
@ 2006-06-03  0:10   ` Con Kolivas
  2006-06-03 17:40     ` Lee Revell
  0 siblings, 1 reply; 7+ messages in thread
From: Con Kolivas @ 2006-06-03  0:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jens Axboe, ck list

On Saturday 03 June 2006 03:12, Jens Axboe wrote:
> On Sat, May 27 2006, Con Kolivas wrote:
> > Jens, ml
> >
> > I was wondering if cfq io priorities should be explicitly set to the
> > realtime class when no io priority is specified from realtime tasks as in
> > the following patch? (rt_task() will need to be modified to suit the PI
> > changes in -mm)
>
> Not sure. RT io needs to be considered carefully, but I guess so does RT
> CPU scheduling. For now I'd prefer to play it a little safer, and only
> inheric the priority value and not the class.

The problem I envisioned with that was that realtime tasks, if they don't 
specify an io priority (as most current code doesn't), would basically get io 
priority 4 and have the same proportion as any nice 0 SCHED_NORMAL task 
whereas -nice tasks automatically are getting better io priority. How about 
givent them normal class but best priority so they are at least getting the 
same as nice -20?

-- 
-ck

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch] cfq: ioprio inherit rt class
  2006-06-03  0:10   ` Con Kolivas
@ 2006-06-03 17:40     ` Lee Revell
  2006-06-03 18:52       ` Horst von Brand
  2006-06-04  1:37       ` Con Kolivas
  0 siblings, 2 replies; 7+ messages in thread
From: Lee Revell @ 2006-06-03 17:40 UTC (permalink / raw)
  To: Con Kolivas; +Cc: linux-kernel, Jens Axboe, ck list

On Sat, 2006-06-03 at 10:10 +1000, Con Kolivas wrote:
> On Saturday 03 June 2006 03:12, Jens Axboe wrote:
> > Not sure. RT io needs to be considered carefully, but I guess so does RT
> > CPU scheduling. For now I'd prefer to play it a little safer, and only
> > inheric the priority value and not the class.
> 
> The problem I envisioned with that was that realtime tasks, if they don't 
> specify an io priority (as most current code doesn't), would basically get io 
> priority 4 and have the same proportion as any nice 0 SCHED_NORMAL task 
> whereas -nice tasks automatically are getting better io priority. How about 
> givent them normal class but best priority so they are at least getting the 
> same as nice -20?
> 

Con,

Have you seen RT threads trying to disk IO 'in the wild' or is this a
theoretical concern?  I don't know of any such apps.

Lee


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch] cfq: ioprio inherit rt class
  2006-06-03 17:40     ` Lee Revell
@ 2006-06-03 18:52       ` Horst von Brand
  2006-06-04  1:37       ` Con Kolivas
  1 sibling, 0 replies; 7+ messages in thread
From: Horst von Brand @ 2006-06-03 18:52 UTC (permalink / raw)
  To: Lee Revell; +Cc: Con Kolivas, linux-kernel, Jens Axboe, ck list

Lee Revell <rlrevell@joe-job.com> wrote:
> On Sat, 2006-06-03 at 10:10 +1000, Con Kolivas wrote:
> > On Saturday 03 June 2006 03:12, Jens Axboe wrote:
> > > Not sure. RT io needs to be considered carefully, but I guess so does RT
> > > CPU scheduling. For now I'd prefer to play it a little safer, and only
> > > inheric the priority value and not the class.

> > The problem I envisioned with that was that realtime tasks, if they
> > don't specify an io priority (as most current code doesn't), would
> > basically get io priority 4 and have the same proportion as any nice 0
> > SCHED_NORMAL task whereas -nice tasks automatically are getting better
> > io priority. How about givent them normal class but best priority so
> > they are at least getting the same as nice -20?

> Have you seen RT threads trying to disk IO 'in the wild'

I'd be surprised, to be sure.

>                                                          or is this a
> theoretical concern?  I don't know of any such apps.

Is it hard to do? If not, as this isn't forbidden as such, it makes sense
IMVHO.
-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch] cfq: ioprio inherit rt class
  2006-06-03 17:40     ` Lee Revell
  2006-06-03 18:52       ` Horst von Brand
@ 2006-06-04  1:37       ` Con Kolivas
  1 sibling, 0 replies; 7+ messages in thread
From: Con Kolivas @ 2006-06-04  1:37 UTC (permalink / raw)
  To: Lee Revell; +Cc: linux-kernel, Jens Axboe, ck list

On Sunday 04 June 2006 03:40, Lee Revell wrote:
> On Sat, 2006-06-03 at 10:10 +1000, Con Kolivas wrote:
> > On Saturday 03 June 2006 03:12, Jens Axboe wrote:
> > > Not sure. RT io needs to be considered carefully, but I guess so does
> > > RT CPU scheduling. For now I'd prefer to play it a little safer, and
> > > only inheric the priority value and not the class.
> >
> > The problem I envisioned with that was that realtime tasks, if they don't
> > specify an io priority (as most current code doesn't), would basically
> > get io priority 4 and have the same proportion as any nice 0 SCHED_NORMAL
> > task whereas -nice tasks automatically are getting better io priority.
> > How about givent them normal class but best priority so they are at least
> > getting the same as nice -20?
>
> Con,
>
> Have you seen RT threads trying to disk IO 'in the wild' or is this a
> theoretical concern?  I don't know of any such apps.
>

Yeah, cd burning software comes to mind.

-- 
-ck

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-06-04  1:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-27  1:50 [patch] cfq: ioprio inherit rt class Con Kolivas
2006-05-27  2:08 ` Con Kolivas
2006-06-02 17:12 ` [ck] " Jens Axboe
2006-06-03  0:10   ` Con Kolivas
2006-06-03 17:40     ` Lee Revell
2006-06-03 18:52       ` Horst von Brand
2006-06-04  1:37       ` Con Kolivas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).