Nick's scheduler policy v13
Subsystems (4)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 Nick's scheduler policy v13
A random priority / nice fixes noticed by Greg Wolledge. Due to bigger priority range. A few other random things.
I apologise for continually posting this patch. I have taken on a number of other scheduler improvements (mostly SMP/NUMA balancing), so the rollup is growing. I'll refrain from posting it again till I find some webspace to put it up.
linux-2.6-npiggin/fs/proc/array.c | 7 linux-2.6-npiggin/include/linux/init_task.h | 4 linux-2.6-npiggin/include/linux/sched.h | 10 linux-2.6-npiggin/kernel/fork.c | 30 - linux-2.6-npiggin/kernel/sched.c | 568 ++++++++++++++++------------ 5 files changed, 359 insertions(+), 260 deletions(-)
include/linux/sched.h renamed from include/linux/sched.h~rollup +8 -2
@@ -280,7 +280,7 @@ struct signal_struct {#define MAX_USER_RT_PRIO 100#define MAX_RT_PRIO MAX_USER_RT_PRIO -#define MAX_PRIO (MAX_RT_PRIO + 40) +#define MAX_PRIO (MAX_RT_PRIO + 60)/* * Some day this will be a full-fledged user tracking system..
@@ -339,12 +339,17 @@ struct task_struct {struct list_head run_list;prio_array_t *array; +/* Scheduler variables follow. kernel/sched.c */ +unsigned long array_sequence; +unsigned long timestamp; + +unsigned long total_time, sleep_time;unsigned long sleep_avg; -unsigned long last_run;unsigned long policy;cpumask_t cpus_allowed;unsigned int time_slice, first_time_slice; +unsigned int used_slice;struct list_head tasks;struct list_head ptrace_children;
@@ -552,6 +557,7 @@ extern int FASTCALL(wake_up_state(structextern int FASTCALL (wake_up_process (struct task_struct * tsk));extern int FASTCALL (wake_up_process_kick (struct task_struct * tsk));extern void FASTCALL (wake_up_forked_process (struct task_struct * tsk)); +extern void FASTCALL (sched_fork (task_t * p));extern void FASTCALL (sched_exit (task_t * p));asmlinkage long sys_wait4 (pid_t pid,unsigned int * stat_addr,int options,struct rusage * ru);
include/linux/init_task.h renamed from include/linux/init_task.h~rollup +2 -2
@@ -67,8 +67,8 @@ .usage = ATOMIC_INIT(2), \ .flags = 0, \ .lock_depth = -1, \ - .prio = MAX_PRIO-20, \ - .static_prio = MAX_PRIO-20, \ + .prio = MAX_PRIO-30, \ + .static_prio = MAX_PRIO-30, \ .policy = SCHED_NORMAL, \ .cpus_allowed = CPU_MASK_ALL, \ .mm = NULL, \
fs/proc/array.c renamed from fs/proc/array.c~rollup +6 -1
@@ -154,13 +154,18 @@ static inline char * task_state(struct tread_lock (&tasklist_lock); buffer += sprintf(buffer, "State:\t%s\n" + "sleep_avg:\t%lu\n" + "sleep_time:\t%lu\n" + "total_time:\t%lu\n" "Tgid:\t%d\n" "Pid:\t%d\n" "PPid:\t%d\n" "TracerPid:\t%d\n" "Uid:\t%d\t%d\t%d\t%d\n" "Gid:\t%d\t%d\t%d\t%d\n", - get_task_state(p), p->tgid, + get_task_state(p), + p->sleep_avg, p->sleep_time, p->total_time, + p->tgid, p->pid, p->pid ? p->real_parent->pid : 0, p->pid && p->ptrace ? p->parent->pid : 0, p->uid, p->euid, p->suid, p->fsuid,
kernel/fork.c renamed from kernel/fork.c~rollup +3 -27
@@ -911,33 +911,9 @@ struct task_struct *copy_process(unsigne p->exit_signal = (clone_flags &CLONE_THREAD ) ?-1 : (clone_flags &CSIGNAL ); p->pdeath_signal =0 ; -/* -* Share the timeslice between parent and child, thus the -* total amount of pending timeslices in the system doesn't change, -* resulting in more scheduling fairness. -*/ -local_irq_disable (); - p->time_slice = (current->time_slice +1 ) >>1 ; -/* -* The remainder of the first timeslice might be recovered by -* the parent if the child exits early enough. -*/ - p->first_time_slice =1 ; - current->time_slice >>=1 ; - p->last_run = jiffies; -if (!current->time_slice) { -/* -* This case is rare, it happens when the parent has only -* a single jiffy left from its timeslice. Taking the -* runqueue lock is not a problem. -*/ - current->time_slice =1 ; -preempt_disable (); -scheduler_tick (0 ,0 ); -local_irq_enable (); -preempt_enable (); - }else -local_irq_enable (); +/* Perform scheduler related accounting */ +sched_fork (p); +/* * Ok, add it to the run-queues and make it * visible to the rest of the system.
kernel/sched.c renamed from kernel/sched.c~rollup +340 -228
859 lines not on this page · raw message
_
Quoted 7 lines · Nick Piggin
A random priority / nice fixes noticed by Greg Wolledge. Due to bigger priority range. A few other random things.
I apologise for continually posting this patch. I have taken on a number of other scheduler improvements (mostly SMP/NUMA balancing), so the rollup is growing. I'll refrain from posting it again till I find some webspace to put it up.
David Nielsen has offered to host my stuff for a while. Its done in a similar way to Andrew Morton's patch sets.
Quoted 4 lines · Nick Piggin
I apologise for continually posting this patch. I have taken on a number of other scheduler improvements (mostly SMP/NUMA balancing), so the rollup is growing. I'll refrain from posting it again till I find some webspace to put it up.
Some folks may prefer links with their morning java, but I'd rather have a nice fresh patch ;-)
-Mike