Index: linux-2.6.9-rc2-mm1/include/linux/sched.h
===================================================================
--- linux-2.6.9-rc2-mm1.orig/include/linux/sched.h	2004-09-19 19:29:53.998252632 +1000
+++ linux-2.6.9-rc2-mm1/include/linux/sched.h	2004-09-19 19:29:58.052636272 +1000
@@ -128,9 +128,10 @@ extern unsigned long nr_iowait(void);
 #define SCHED_FIFO		1
 #define SCHED_RR		2
 #define SCHED_BATCH		3
+#define SCHED_ISO		4
 
 #define SCHED_MIN		0
-#define SCHED_MAX		3
+#define SCHED_MAX		4
 
 #define SCHED_RANGE(policy)	((policy) >= SCHED_MIN && \
 					(policy) <= SCHED_MAX)
@@ -343,6 +344,7 @@ struct signal_struct {
 
 #define rt_task(p)		((p)->prio < MAX_RT_PRIO)
 #define batch_task(p)		((p)->policy == SCHED_BATCH)
+#define iso_task(p)		((p)->policy == SCHED_ISO)
 
 /*
  * Some day this will be a full-fledged user tracking system..
Index: linux-2.6.9-rc2-mm1/kernel/sched.c
===================================================================
--- linux-2.6.9-rc2-mm1.orig/kernel/sched.c	2004-09-19 19:29:54.064242600 +1000
+++ linux-2.6.9-rc2-mm1/kernel/sched.c	2004-09-19 19:29:58.054635968 +1000
@@ -503,6 +503,8 @@ static unsigned int burst(task_t *p)
 {
 	if (likely(!rt_task(p))) {
 		unsigned int task_user_prio = TASK_USER_PRIO(p);
+		if (iso_task(p))
+			task_user_prio /= 2;
 		return 39 - task_user_prio;
 	} else
 		return p->burst;
@@ -541,6 +543,18 @@ static unsigned long slice(task_t *p)
  */
 int sched_interactive = 1;
 
+static unsigned long rr_interval(task_t * p)
+{
+	unsigned long rr_interval = RR_INTERVAL();
+	if (batch_task(p))
+		rr_interval *= 10;
+	else if (iso_task(p))
+		rr_interval /= 2;
+	if (!rr_interval)
+		rr_interval = 1;
+	return rr_interval;
+}
+
 /*
  * effective_prio - dynamic priority dependent on burst.
  * The priority normally decreases by one each RR_INTERVAL.
@@ -550,7 +564,7 @@ int sched_interactive = 1;
 static int effective_prio(task_t *p)
 {
 	int prio;
-	unsigned long full_slice, used_slice, first_slice;
+	unsigned long rr, full_slice, used_slice, first_slice;
 	unsigned int best_burst;
 	if (rt_task(p))
 		return p->prio;
@@ -568,17 +582,18 @@ static int effective_prio(task_t *p)
 
 	best_burst = burst(p);
 	full_slice = slice(p);
+	rr = rr_interval(p);
 	used_slice = full_slice - p->slice;
 	if (p->burst > best_burst)
 		p->burst = best_burst;
-	first_slice = RR_INTERVAL();
-	if (sched_interactive && !sched_compute && p->mm)
+	first_slice = rr;
+	if (sched_interactive && !sched_compute && p->mm && !iso_task(p))
 		first_slice *= (p->burst + 1);
 	prio = MAX_PRIO - 2 - best_burst;
 
 	if (used_slice < first_slice)
 		return prio;
-	prio += 1 + (used_slice - first_slice) / RR_INTERVAL();
+	prio += 1 + (used_slice - first_slice) / rr;
 	if (prio > MAX_PRIO - 2)
 		prio = MAX_PRIO - 2;
 	return prio;
@@ -593,7 +608,7 @@ static void recalc_task_prio(task_t *p, 
 {
 	unsigned long long _sleep_time = now - p->timestamp;
 	unsigned long sleep_time = NS_TO_US(_sleep_time);
-	unsigned long rr = RR_INTERVAL();
+	unsigned long rr = rr_interval(p);
 	unsigned int best_burst = burst(p);
 	unsigned long minrun = rr * (p->burst + 1) / (best_burst + 1) ? : 1;
 
@@ -648,7 +663,7 @@ static void activate_task(task_t *p, run
 	}
 #endif
 	p->slice = slice(p);
-	p->time_slice = RR_INTERVAL();
+	p->time_slice = rr_interval(p);
 	recalc_task_prio(p, now);
 	p->prio = effective_prio(p);
 	p->flags &= ~PF_UISLEEP;
@@ -2019,7 +2034,7 @@ static void time_slice_expired(task_t *p
 	set_tsk_need_resched(p);
 	dequeue_task(p, rq);
 	p->prio = effective_prio(p);
-	p->time_slice = RR_INTERVAL();
+	p->time_slice = rr_interval(p);
 	enqueue_task(p, rq);
 }
 
@@ -2834,7 +2849,11 @@ static int setscheduler(pid_t pid, int p
 
 	retval = -EPERM;
 	if (SCHED_RT(policy) && !capable(CAP_SYS_NICE))
-		goto out_unlock;
+		/*
+		 * If the caller requested an RT policy without having the
+		 * necessary rights, we downgrade the policy to SCHED_ISO.
+		 */
+		policy = SCHED_ISO;
 	if ((current->euid != p->euid) && (current->euid != p->uid) &&
 	    !capable(CAP_SYS_NICE))
 		goto out_unlock;
@@ -3115,7 +3134,7 @@ asmlinkage long sys_sched_yield(void)
 	 */
 	dequeue_task(current, rq);
 	current->slice = slice(current);
-	current->time_slice = RR_INTERVAL();
+	current->time_slice = rr_interval(current);
 	if (likely(!rt_task(current) && !batch_task(current))) {
 		current->flags |= PF_YIELDED;
 		current->prio = MAX_PRIO - 2;
@@ -3262,6 +3281,7 @@ asmlinkage long sys_sched_get_priority_m
 		break;
 	case SCHED_NORMAL:
 	case SCHED_BATCH:
+	case SCHED_ISO:
 		ret = 0;
 		break;
 	}
@@ -3286,6 +3306,7 @@ asmlinkage long sys_sched_get_priority_m
 		break;
 	case SCHED_NORMAL:
 	case SCHED_BATCH:
+	case SCHED_ISO:
 		ret = 0;
 	}
 	return ret;

