SOURCES: kernel-desktop-ck.patch (NEW) - original Con Kolivas desk...

sparky sparky at pld-linux.org
Fri Jun 23 21:13:29 CEST 2006


Author: sparky                       Date: Fri Jun 23 19:13:29 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- original Con Kolivas desktop patch:
  http://www.kernel.org/pub/linux/kernel/people/ck/patches/2.6/2.6.17/2.6.17-ck1/patch-2.6.17-ck1.bz2

---- Files affected:
SOURCES:
   kernel-desktop-ck.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/kernel-desktop-ck.patch
diff -u /dev/null SOURCES/kernel-desktop-ck.patch:1.1
--- /dev/null	Fri Jun 23 21:13:29 2006
+++ SOURCES/kernel-desktop-ck.patch	Fri Jun 23 21:13:24 2006
@@ -0,0 +1,6989 @@
+Index: linux-2.6.17-ck1/include/linux/sched.h
+===================================================================
+--- linux-2.6.17-ck1.orig/include/linux/sched.h	2006-06-18 15:32:49.000000000 +1000
++++ linux-2.6.17-ck1/include/linux/sched.h	2006-06-18 15:34:37.000000000 +1000
+@@ -102,6 +102,7 @@ extern unsigned long nr_running(void);
+ extern unsigned long nr_uninterruptible(void);
+ extern unsigned long nr_active(void);
+ extern unsigned long nr_iowait(void);
++extern unsigned long weighted_cpuload(const int cpu);
+ 
+ #include <linux/time.h>
+ #include <linux/param.h>
+@@ -163,6 +164,15 @@ extern unsigned long nr_iowait(void);
+ #define SCHED_FIFO		1
+ #define SCHED_RR		2
+ #define SCHED_BATCH		3
++#define SCHED_ISO		4
++#define SCHED_IDLEPRIO		5
++
++#define SCHED_MIN		0
++#define SCHED_MAX		5
++
++#define SCHED_RANGE(policy)	((policy) <= SCHED_MAX)
++#define SCHED_RT(policy)	((policy) == SCHED_FIFO || \
++					(policy) == SCHED_RR)
+ 
+ struct sched_param {
+ 	int sched_priority;
+@@ -201,6 +211,7 @@ extern void show_stack(struct task_struc
+ 
+ void io_schedule(void);
+ long io_schedule_timeout(long timeout);
++extern int sched_interactive, sched_compute, sched_iso_cpu;
+ 
+ extern void cpu_init (void);
+ extern void trap_init(void);
+@@ -480,11 +491,16 @@ struct signal_struct {
+ 
+ #define MAX_USER_RT_PRIO	100
+ #define MAX_RT_PRIO		MAX_USER_RT_PRIO
++#define ISO_PRIO		(MAX_RT_PRIO - 1)
+ 
+-#define MAX_PRIO		(MAX_RT_PRIO + 40)
++#define MAX_PRIO		(MAX_RT_PRIO + 41)
++#define MIN_USER_PRIO		(MAX_PRIO - 2)
++#define IDLEPRIO_PRIO		(MAX_PRIO - 1)
+ 
+-#define rt_task(p)		(unlikely((p)->prio < MAX_RT_PRIO))
++#define rt_task(p)		(unlikely(SCHED_RT((p)->policy)))
+ #define batch_task(p)		(unlikely((p)->policy == SCHED_BATCH))
++#define iso_task(p)		(unlikely((p)->policy == SCHED_ISO))
++#define idleprio_task(p)	(unlikely((p)->policy == SCHED_IDLEPRIO))
+ 
+ /*
+  * Some day this will be a full-fledged user tracking system..
+@@ -517,7 +533,6 @@ extern struct user_struct *find_user(uid
+ extern struct user_struct root_user;
+ #define INIT_USER (&root_user)
+ 
+-typedef struct prio_array prio_array_t;
+ struct backing_dev_info;
+ struct reclaim_state;
+ 
+@@ -547,9 +562,9 @@ enum idle_type
+ /*
+  * sched-domains (multiprocessor balancing) declarations:
+  */
+-#ifdef CONFIG_SMP
+ #define SCHED_LOAD_SCALE	128UL	/* increase resolution of load */
+ 
++#ifdef CONFIG_SMP
+ #define SD_LOAD_BALANCE		1	/* Do load balancing on this domain. */
+ #define SD_BALANCE_NEWIDLE	2	/* Balance when about to become idle */
+ #define SD_BALANCE_EXEC		4	/* Balance on exec */
+@@ -638,6 +653,22 @@ extern unsigned int max_cache_size;
+ 
+ #endif	/* CONFIG_SMP */
+ 
++/*
++ * A runqueue laden with a single nice 0 task scores a weighted_cpuload of
++ * SCHED_LOAD_SCALE. This function returns 1 if any cpu is laden with a
++ * task of nice 0 or enough lower priority tasks to bring up the
++ * weighted_cpuload
++ */
++static inline int above_background_load(void)
++{
++	unsigned long cpu;
++
++	for_each_online_cpu(cpu) {
++		if (weighted_cpuload(cpu) >= SCHED_LOAD_SCALE)
++			return 1;
++	}
++	return 0;
++}
+ 
+ struct io_context;			/* See blkdev.h */
+ void exit_io_context(void);
+@@ -686,13 +717,6 @@ struct audit_context;		/* See audit.c */
+ struct mempolicy;
+ struct pipe_inode_info;
+ 
+-enum sleep_type {
+-	SLEEP_NORMAL,
+-	SLEEP_NONINTERACTIVE,
+-	SLEEP_INTERACTIVE,
+-	SLEEP_INTERRUPTED,
+-};
+-
+ struct task_struct {
+ 	volatile long state;	/* -1 unrunnable, 0 runnable, >0 stopped */
+ 	struct thread_info *thread_info;
+@@ -702,24 +726,26 @@ struct task_struct {
+ 
+ 	int lock_depth;		/* BKL lock depth */
+ 
+-#if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW)
++#ifdef CONFIG_SMP
++#ifdef __ARCH_WANT_UNLOCKED_CTXSW
+ 	int oncpu;
+ #endif
++#endif
++	int load_weight;	/* for niceness load balancing purposes */
+ 	int prio, static_prio;
+ 	struct list_head run_list;
+-	prio_array_t *array;
+ 
+ 	unsigned short ioprio;
+ 	unsigned int btrace_seq;
+ 
+-	unsigned long sleep_avg;
+-	unsigned long long timestamp, last_ran;
++	unsigned long long timestamp;
++	unsigned long runtime, totalrun, ns_debit, systime;
++	unsigned int bonus;
++	unsigned int slice, time_slice;
+ 	unsigned long long sched_time; /* sched_clock time spent running */
+-	enum sleep_type sleep_type;
+ 
+ 	unsigned long policy;
+ 	cpumask_t cpus_allowed;
+-	unsigned int time_slice, first_time_slice;
+ 
+ #ifdef CONFIG_SCHEDSTATS
+ 	struct sched_info sched_info;
+@@ -838,6 +864,7 @@ struct task_struct {
+ 	/* mutex deadlock detection */
+ 	struct mutex_waiter *blocked_on;
+ #endif
++	unsigned long mutexes_held;
+ 
+ /* journalling filesystem info */
+ 	void *journal_info;
+@@ -948,6 +975,9 @@ static inline void put_task_struct(struc
+ #define PF_SPREAD_PAGE	0x04000000	/* Spread page cache over cpuset */
+ #define PF_SPREAD_SLAB	0x08000000	/* Spread some slab caches over cpuset */
+ #define PF_MEMPOLICY	0x10000000	/* Non-default NUMA mempolicy */
++#define PF_NONSLEEP	0x20000000	/* Waiting on in kernel activity */
++#define PF_FORKED	0x40000000	/* Task just forked another process */
++#define PF_ISOREF	0x80000000	/* SCHED_ISO task has used up quota */
+ 
+ /*
+  * Only the _current_ task can read/write to tsk->flags, but other
+@@ -1069,7 +1099,6 @@ extern void FASTCALL(wake_up_new_task(st
+  static inline void kick_process(struct task_struct *tsk) { }
+ #endif
+ extern void FASTCALL(sched_fork(task_t * p, int clone_flags));
+-extern void FASTCALL(sched_exit(task_t * p));
+ 
+ extern int in_group_p(gid_t);
+ extern int in_egroup_p(gid_t);
+Index: linux-2.6.17-ck1/kernel/sched.c
+===================================================================
+--- linux-2.6.17-ck1.orig/kernel/sched.c	2006-06-18 15:32:49.000000000 +1000
++++ linux-2.6.17-ck1/kernel/sched.c	2006-06-18 15:34:34.000000000 +1000
+@@ -16,6 +16,9 @@
+  *		by Davide Libenzi, preemptible kernel bits by Robert Love.
+  *  2003-09-03	Interactivity tuning by Con Kolivas.
+  *  2004-04-02	Scheduler domains code by Nick Piggin
++ *  2006-06-18	Staircase scheduling policy by Con Kolivas with help
++ *		from William Lee Irwin III, Zwane Mwaikambo & Peter Williams.
++ *		Staircase v16
+  */
+ 
+ #include <linux/mm.h>
+@@ -55,6 +58,25 @@
+ #include <asm/unistd.h>
+ 
+ /*
++ * sched_interactive - sysctl which allows interactive tasks to have bonus
++ * raise its priority.
++ * sched_compute - sysctl which enables long timeslices and delayed preemption
++ * for compute server usage.
++ * sched_iso_cpu - sysctl which determines the cpu percentage SCHED_ISO tasks
++ * are allowed to run (over ISO_PERIOD seconds) as real time tasks.
++ */
++int sched_interactive __read_mostly = 1;
++int sched_compute __read_mostly;
++int sched_iso_cpu __read_mostly = 80;
++
++#define ISO_PERIOD		(5 * HZ)
++/*
++ * CACHE_DELAY is the time preemption is delayed in sched_compute mode
++ * and is set to a nominal 10ms.
++ */
++#define CACHE_DELAY	(10 * (HZ) / 1001 + 1)
++
++/*
+  * Convert user-nice values [ -20 ... 0 ... 19 ]
+  * to static priority [ MAX_RT_PRIO..MAX_PRIO-1 ],
+  * and back.
+@@ -75,125 +97,28 @@
+ /*
+  * Some helpers for converting nanosecond timing to jiffy resolution
+  */
+-#define NS_TO_JIFFIES(TIME)	((TIME) / (1000000000 / HZ))
+-#define JIFFIES_TO_NS(TIME)	((TIME) * (1000000000 / HZ))
+-
+-/*
+- * These are the 'tuning knobs' of the scheduler:
+- *
+- * Minimum timeslice is 5 msecs (or 1 jiffy, whichever is larger),
+- * default timeslice is 100 msecs, maximum timeslice is 800 msecs.
+- * Timeslices get refilled after they expire.
+- */
+-#define MIN_TIMESLICE		max(5 * HZ / 1000, 1)
+-#define DEF_TIMESLICE		(100 * HZ / 1000)
+-#define ON_RUNQUEUE_WEIGHT	 30
+-#define CHILD_PENALTY		 95
+-#define PARENT_PENALTY		100
+-#define EXIT_WEIGHT		  3
+-#define PRIO_BONUS_RATIO	 25
+-#define MAX_BONUS		(MAX_USER_PRIO * PRIO_BONUS_RATIO / 100)
+-#define INTERACTIVE_DELTA	  2
+-#define MAX_SLEEP_AVG		(DEF_TIMESLICE * MAX_BONUS)
+-#define STARVATION_LIMIT	(MAX_SLEEP_AVG)
+-#define NS_MAX_SLEEP_AVG	(JIFFIES_TO_NS(MAX_SLEEP_AVG))
+-
+-/*
+- * If a task is 'interactive' then we reinsert it in the active
+- * array after it has expired its current timeslice. (it will not
+- * continue to run immediately, it will still roundrobin with
+- * other interactive tasks.)
+- *
+- * This part scales the interactivity limit depending on niceness.
+- *
+- * We scale it linearly, offset by the INTERACTIVE_DELTA delta.
+- * Here are a few examples of different nice levels:
+- *
+- *  TASK_INTERACTIVE(-20): [1,1,1,1,1,1,1,1,1,0,0]
+- *  TASK_INTERACTIVE(-10): [1,1,1,1,1,1,1,0,0,0,0]
+- *  TASK_INTERACTIVE(  0): [1,1,1,1,0,0,0,0,0,0,0]
+- *  TASK_INTERACTIVE( 10): [1,1,0,0,0,0,0,0,0,0,0]
+- *  TASK_INTERACTIVE( 19): [0,0,0,0,0,0,0,0,0,0,0]
+- *
+- * (the X axis represents the possible -5 ... 0 ... +5 dynamic
+- *  priority range a task can explore, a value of '1' means the
+- *  task is rated interactive.)
+- *
+- * Ie. nice +19 tasks can never get 'interactive' enough to be
+- * reinserted into the active array. And only heavily CPU-hog nice -20
+- * tasks will be expired. Default nice 0 tasks are somewhere between,
+- * it takes some effort for them to get interactive, but it's not
+- * too hard.
+- */
+-
+-#define CURRENT_BONUS(p) \
+-	(NS_TO_JIFFIES((p)->sleep_avg) * MAX_BONUS / \
+-		MAX_SLEEP_AVG)
+-
+-#define GRANULARITY	(10 * HZ / 1000 ? : 1)
+-
+-#ifdef CONFIG_SMP
+-#define TIMESLICE_GRANULARITY(p)	(GRANULARITY * \
+-		(1 << (((MAX_BONUS - CURRENT_BONUS(p)) ? : 1) - 1)) * \
+-			num_online_cpus())
+-#else
+-#define TIMESLICE_GRANULARITY(p)	(GRANULARITY * \
+-		(1 << (((MAX_BONUS - CURRENT_BONUS(p)) ? : 1) - 1)))
+-#endif
+-
+-#define SCALE(v1,v1_max,v2_max) \
+-	(v1) * (v2_max) / (v1_max)
+-
+-#define DELTA(p) \
+-	(SCALE(TASK_NICE(p) + 20, 40, MAX_BONUS) - 20 * MAX_BONUS / 40 + \
+-		INTERACTIVE_DELTA)
+-
+-#define TASK_INTERACTIVE(p) \
+-	((p)->prio <= (p)->static_prio - DELTA(p))
+-
+-#define INTERACTIVE_SLEEP(p) \
+-	(JIFFIES_TO_NS(MAX_SLEEP_AVG * \
+-		(MAX_BONUS / 2 + DELTA((p)) + 1) / MAX_BONUS - 1))
+-
++#define NSJIFFY			(1000000000 / HZ)	/* One jiffy in ns */
++#define NS_TO_JIFFIES(TIME)	((TIME) / NSJIFFY)
++#define JIFFIES_TO_NS(TIME)	((TIME) * NSJIFFY)
+ #define TASK_PREEMPTS_CURR(p, rq) \
+ 	((p)->prio < (rq)->curr->prio)
+ 
+ /*
+- * task_timeslice() scales user-nice values [ -20 ... 0 ... 19 ]
+- * to time slice values: [800ms ... 100ms ... 5ms]
+- *
+- * The higher a thread's priority, the bigger timeslices
+- * it gets during one round of execution. But even the lowest
+- * priority thread gets MIN_TIMESLICE worth of execution time.
++ * This is the time all tasks within the same priority round robin.
++ * Set to a minimum of 6ms. It is 10 times longer in compute mode.
+  */
++#define _RR_INTERVAL		((6 * HZ / 1001) + 1)
++#define RR_INTERVAL		(_RR_INTERVAL * (1 + 9 * sched_compute))
++#define DEF_TIMESLICE		(RR_INTERVAL * 19)
+ 
+-#define SCALE_PRIO(x, prio) \
+-	max(x * (MAX_PRIO - prio) / (MAX_USER_PRIO/2), MIN_TIMESLICE)
+-
+-static unsigned int task_timeslice(task_t *p)
+-{
+-	if (p->static_prio < NICE_TO_PRIO(0))
+-		return SCALE_PRIO(DEF_TIMESLICE*4, p->static_prio);
+-	else
+-		return SCALE_PRIO(DEF_TIMESLICE, p->static_prio);
+-}
+-#define task_hot(p, now, sd) ((long long) ((now) - (p)->last_ran)	\
++#define task_hot(p, now, sd) ((long long) ((now) - (p)->timestamp)	\
+ 				< (long long) (sd)->cache_hot_time)
+ 
+ /*
+  * These are the runqueue data structures:
+  */
+-
+-#define BITMAP_SIZE ((((MAX_PRIO+1+7)/8)+sizeof(long)-1)/sizeof(long))
+-
+ typedef struct runqueue runqueue_t;
+ 
+-struct prio_array {
+-	unsigned int nr_active;
+-	unsigned long bitmap[BITMAP_SIZE];
+-	struct list_head queue[MAX_PRIO];
+-};
+-
+ /*
+  * This is the main, per-CPU runqueue data structure.
+  *
+@@ -209,6 +134,7 @@ struct runqueue {
+ 	 * remote CPUs use both these fields when doing load calculation.
+ 	 */
+ 	unsigned long nr_running;
++	unsigned long raw_weighted_load;
+ #ifdef CONFIG_SMP
+ 	unsigned long cpu_load[3];
+ #endif
+@@ -222,12 +148,15 @@ struct runqueue {
+ 	 */
+ 	unsigned long nr_uninterruptible;
+ 
+-	unsigned long expired_timestamp;
+ 	unsigned long long timestamp_last_tick;
++	unsigned short cache_ticks, preempted;
++	unsigned long iso_ticks;
++	unsigned short iso_refractory;
++
+ 	task_t *curr, *idle;
+ 	struct mm_struct *prev_mm;
+-	prio_array_t *active, *expired, arrays[2];
+-	int best_expired_prio;
++	unsigned long bitmap[BITS_TO_LONGS(MAX_PRIO + 1)];
++	struct list_head queue[MAX_PRIO];
+ 	atomic_t nr_iowait;
+ 
+ #ifdef CONFIG_SMP
+@@ -492,13 +421,7 @@ static inline runqueue_t *this_rq_lock(v
+ 
+ #ifdef CONFIG_SCHEDSTATS
+ /*
+- * Called when a process is dequeued from the active array and given
+- * the cpu.  We should note that with the exception of interactive
+- * tasks, the expired queue will become the active queue after the active
+- * queue is empty, without explicitly dequeuing and requeuing tasks in the
+- * expired queue.  (Interactive tasks may be requeued directly to the
+- * active queue, thus delaying tasks in the expired queue from running;
+- * see scheduler_tick()).
++ * Called when a process is dequeued and given the cpu.
+  *
+  * This function is only called from sched_info_arrive(), rather than
+  * dequeue_task(). Even though a task may be queued and dequeued multiple
+@@ -536,13 +459,11 @@ static void sched_info_arrive(task_t *t)
+ }
+ 
+ /*
+- * Called when a process is queued into either the active or expired
+- * array.  The time is noted and later used to determine how long we
+- * had to wait for us to reach the cpu.  Since the expired queue will
+- * become the active queue after active queue is empty, without dequeuing
+- * and requeuing any tasks, we are interested in queuing to either. It
+- * is unusual but not impossible for tasks to be dequeued and immediately
+- * requeued in the same or another array: this can happen in sched_yield(),
++ * Called when a process is queued
++ * The time is noted and later used to determine how long we had to wait for
++ * us to reach the cpu.
++ * It is unusual but not impossible for tasks to be dequeued and immediately
++ * requeued: this can happen in sched_yield(),
+  * set_user_nice(), and even load_balance() as it moves tasks from runqueue
+  * to runqueue.
+  *
+@@ -596,85 +517,155 @@ static inline void sched_info_switch(tas
+ #define sched_info_switch(t, next)	do { } while (0)
+ #endif /* CONFIG_SCHEDSTATS */
+ 
++#if BITS_PER_LONG < 64
++static inline void longlimit(unsigned long long *longlong)
++{
++	if (*longlong > (1 << 31))
++		*longlong = 1 << 31;
++}
++#else
++static inline void longlimit(unsigned long long *__unused)
++{
++}
++#endif
++
++/* Get nanosecond clock difference without overflowing unsigned long. */
++static unsigned long ns_diff(unsigned long long v1, unsigned long long v2)
++{
++	unsigned long long vdiff;
++	if (likely(v1 >= v2)) {
++		vdiff = v1 - v2;
++		longlimit(&vdiff);
++	} else {
++		/*
++		 * Rarely the clock appears to go backwards. There should
++		 * always be a positive difference so return 1.
++		 */
++		vdiff = 1;
++	}
++	return (unsigned long)vdiff;
++}
++
++static inline int task_queued(const task_t *task)
++{
++	return !list_empty(&task->run_list);
++}
++
+ /*
+- * Adding/removing a task to/from a priority array:
++ * Adding/removing a task to/from a runqueue:
+  */
+-static void dequeue_task(struct task_struct *p, prio_array_t *array)
++static void dequeue_task(task_t *p, runqueue_t *rq)
+ {
+-	array->nr_active--;
+-	list_del(&p->run_list);
+-	if (list_empty(array->queue + p->prio))
+-		__clear_bit(p->prio, array->bitmap);
++	list_del_init(&p->run_list);
++	if (list_empty(rq->queue + p->prio))
++		__clear_bit(p->prio, rq->bitmap);
++	p->ns_debit = 0;
+ }
+ 
+-static void enqueue_task(struct task_struct *p, prio_array_t *array)
++static void enqueue_task(task_t *p, runqueue_t *rq)
+ {
+-	sched_info_queued(p);
+-	list_add_tail(&p->run_list, array->queue + p->prio);
+-	__set_bit(p->prio, array->bitmap);
+-	array->nr_active++;
+-	p->array = array;
++	list_add_tail(&p->run_list, rq->queue + p->prio);
++	__set_bit(p->prio, rq->bitmap);
+ }
+ 
+ /*
+  * Put task to the end of the run list without the overhead of dequeue
+  * followed by enqueue.
+  */
+-static void requeue_task(struct task_struct *p, prio_array_t *array)
++static void requeue_task(task_t *p, runqueue_t *rq, const int prio)
+ {
+-	list_move_tail(&p->run_list, array->queue + p->prio);
++	list_move_tail(&p->run_list, rq->queue + prio);
++	if (p->prio != prio) {
++		if (list_empty(rq->queue + p->prio))
++			__clear_bit(p->prio, rq->bitmap);
++		p->prio = prio;
++		__set_bit(prio, rq->bitmap);
++	}
++	p->ns_debit = 0;
+ }
+ 
+-static inline void enqueue_task_head(struct task_struct *p, prio_array_t *array)
++static inline void enqueue_task_head(task_t *p, runqueue_t *rq)
+ {
+-	list_add(&p->run_list, array->queue + p->prio);
+-	__set_bit(p->prio, array->bitmap);
+-	array->nr_active++;
+-	p->array = array;
++	list_add(&p->run_list, rq->queue + p->prio);
++	__set_bit(p->prio, rq->bitmap);
+ }
+ 
++static unsigned int slice(const task_t *p);
++
+ /*
+- * effective_prio - return the priority that is based on the static
+- * priority but is modified by bonuses/penalties.
+- *
+- * We scale the actual sleep average [0 .... MAX_SLEEP_AVG]
+- * into the -5 ... 0 ... +5 bonus/penalty range.
+- *
+- * We use 25% of the full 0...39 priority range so that:
+- *
+- * 1) nice +19 interactive tasks do not preempt nice 0 CPU hogs.
+- * 2) nice -20 CPU hogs do not get preempted by nice 0 tasks.
+- *
+- * Both properties are important to certain workloads.
++ * To aid in avoiding the subversion of "niceness" due to uneven distribution
++ * of tasks with abnormal "nice" values across CPUs the contribution that
++ * each task makes to its run queue's load is weighted according to its
++ * scheduling class and "nice" value.  For SCHED_NORMAL tasks this is just a
++ * scaled version of the new time slice allocation that they receive on time
++ * slice expiry etc.
+  */
+-static int effective_prio(task_t *p)
++
++/*
++ * Assume: static_prio_timeslice(NICE_TO_PRIO(0)) == DEF_TIMESLICE
++ * If static_prio_timeslice() is ever changed to break this assumption then
++ * this code will need modification
++ */
++#define TIME_SLICE_NICE_ZERO DEF_TIMESLICE
++#define LOAD_WEIGHT(lp) \
++	(((lp) * SCHED_LOAD_SCALE) / TIME_SLICE_NICE_ZERO)
++#define TASK_LOAD_WEIGHT(p)	LOAD_WEIGHT(slice(p))
++#define RTPRIO_TO_LOAD_WEIGHT(rp)	\
++	(LOAD_WEIGHT((RR_INTERVAL + 20 + (rp))))
++
++static void set_load_weight(task_t *p)
+ {
+-	int bonus, prio;
++	if (rt_task(p)) {
++#ifdef CONFIG_SMP
++		if (p == task_rq(p)->migration_thread)
++			/*
++			 * The migration thread does the actual balancing.
++			 * Giving its load any weight will skew balancing
++			 * adversely.
++			 */
++			p->load_weight = 0;
++		else
++#endif
++			p->load_weight = RTPRIO_TO_LOAD_WEIGHT(p->rt_priority);
++	} else if (idleprio_task(p)) {
++		/*
++		 * We want idleprio_tasks to have a presence on weighting but
++		 * as small as possible
++		 */
++		p->load_weight = 1;
++	} else
++		p->load_weight = TASK_LOAD_WEIGHT(p);
++}
+ 
+-	if (rt_task(p))
+-		return p->prio;
++static inline void inc_raw_weighted_load(runqueue_t *rq, const task_t *p)
++{
++	rq->raw_weighted_load += p->load_weight;
++}
+ 
+-	bonus = CURRENT_BONUS(p) - MAX_BONUS / 2;
++static inline void dec_raw_weighted_load(runqueue_t *rq, const task_t *p)
++{
++	rq->raw_weighted_load -= p->load_weight;
++}
+ 
+-	prio = p->static_prio - bonus;
+-	if (prio < MAX_RT_PRIO)
+-		prio = MAX_RT_PRIO;
+-	if (prio > MAX_PRIO-1)
+-		prio = MAX_PRIO-1;
+-	return prio;
++static inline void inc_nr_running(task_t *p, runqueue_t *rq)
++{
++	rq->nr_running++;
++	inc_raw_weighted_load(rq, p);
++}
++
++static inline void dec_nr_running(task_t *p, runqueue_t *rq)
++{
++	rq->nr_running--;
<<Diff was trimmed, longer than 597 lines>>


More information about the pld-cvs-commit mailing list