From 0b760605164c0f2a934d36c1843fcda47181e025 Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Wed, 13 Feb 2008 13:14:35 -0800 Subject: [PATCH] --- yaml --- r: 86330 b: refs/heads/master c: cbc34973709eb41b369c304c075cf2069f847012 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/um/kernel/process.c | 2 ++ trunk/arch/x86/lguest/boot.c | 10 +--------- trunk/fs/proc/base.c | 27 ++++++++++++++++----------- trunk/include/asm-x86/lguest.h | 11 +++++++++++ trunk/include/linux/sched.h | 1 - trunk/kernel/printk.c | 2 +- trunk/kernel/sched.c | 16 +++++----------- trunk/kernel/sched_fair.c | 13 +++++++++---- 9 files changed, 46 insertions(+), 38 deletions(-) diff --git a/[refs] b/[refs] index f44bd543f577..5af8159cb6a4 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 37c00b84d0c1b5c4c65ae837e2235160c03e84c2 +refs/heads/master: cbc34973709eb41b369c304c075cf2069f847012 diff --git a/trunk/arch/um/kernel/process.c b/trunk/arch/um/kernel/process.c index e8cb9ff183e9..fc50d2f959d1 100644 --- a/trunk/arch/um/kernel/process.c +++ b/trunk/arch/um/kernel/process.c @@ -128,6 +128,8 @@ void *get_current(void) return current; } +extern void schedule_tail(struct task_struct *prev); + /* * This is called magically, by its address being stuffed in a jmp_buf * and being longjmp-d to. diff --git a/trunk/arch/x86/lguest/boot.c b/trunk/arch/x86/lguest/boot.c index 5afdde4895dc..1e613fb03e32 100644 --- a/trunk/arch/x86/lguest/boot.c +++ b/trunk/arch/x86/lguest/boot.c @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -75,15 +76,6 @@ * behaving in simplified but equivalent ways. In particular, the Guest is the * same kernel as the Host (or at least, built from the same source code). :*/ -/* Declarations for definitions in lguest_guest.S */ -extern char lguest_noirq_start[], lguest_noirq_end[]; -extern const char lgstart_cli[], lgend_cli[]; -extern const char lgstart_sti[], lgend_sti[]; -extern const char lgstart_popf[], lgend_popf[]; -extern const char lgstart_pushf[], lgend_pushf[]; -extern const char lgstart_iret[], lgend_iret[]; -extern void lguest_iret(void); - struct lguest_data lguest_data = { .hcall_status = { [0 ... LHCALL_RING_SIZE-1] = 0xFF }, .noirq_start = (u32)lguest_noirq_start, diff --git a/trunk/fs/proc/base.c b/trunk/fs/proc/base.c index 91a1bd67ac1d..96ee899d6502 100644 --- a/trunk/fs/proc/base.c +++ b/trunk/fs/proc/base.c @@ -314,12 +314,9 @@ static int proc_pid_schedstat(struct task_struct *task, char *buffer) static int lstats_show_proc(struct seq_file *m, void *v) { int i; - struct inode *inode = m->private; - struct task_struct *task = get_proc_task(inode); - - if (!task) - return -ESRCH; + struct task_struct *task = m->private; seq_puts(m, "Latency Top version : v0.1\n"); + for (i = 0; i < 32; i++) { if (task->latency_record[i].backtrace[0]) { int q; @@ -344,24 +341,32 @@ static int lstats_show_proc(struct seq_file *m, void *v) } } - put_task_struct(task); return 0; } static int lstats_open(struct inode *inode, struct file *file) { - return single_open(file, lstats_show_proc, inode); + int ret; + struct seq_file *m; + struct task_struct *task = get_proc_task(inode); + + ret = single_open(file, lstats_show_proc, NULL); + if (!ret) { + m = file->private_data; + m->private = task; + } + return ret; } static ssize_t lstats_write(struct file *file, const char __user *buf, size_t count, loff_t *offs) { - struct task_struct *task = get_proc_task(file->f_dentry->d_inode); + struct seq_file *m; + struct task_struct *task; - if (!task) - return -ESRCH; + m = file->private_data; + task = m->private; clear_all_latency_tracing(task); - put_task_struct(task); return count; } diff --git a/trunk/include/asm-x86/lguest.h b/trunk/include/asm-x86/lguest.h index 4d9367b72976..9b17571e9bc3 100644 --- a/trunk/include/asm-x86/lguest.h +++ b/trunk/include/asm-x86/lguest.h @@ -23,6 +23,17 @@ /* Found in switcher.S */ extern unsigned long default_idt_entries[]; +/* Declarations for definitions in lguest_guest.S */ +extern char lguest_noirq_start[], lguest_noirq_end[]; +extern const char lgstart_cli[], lgend_cli[]; +extern const char lgstart_sti[], lgend_sti[]; +extern const char lgstart_popf[], lgend_popf[]; +extern const char lgstart_pushf[], lgend_pushf[]; +extern const char lgstart_iret[], lgend_iret[]; + +extern void lguest_iret(void); +extern void lguest_init(void); + struct lguest_regs { /* Manually saved part. */ diff --git a/trunk/include/linux/sched.h b/trunk/include/linux/sched.h index 9c17e828d6d4..e217d188a102 100644 --- a/trunk/include/linux/sched.h +++ b/trunk/include/linux/sched.h @@ -242,7 +242,6 @@ struct task_struct; extern void sched_init(void); extern void sched_init_smp(void); -extern asmlinkage void schedule_tail(struct task_struct *prev); extern void init_idle(struct task_struct *idle, int cpu); extern void init_idle_bootup_task(struct task_struct *idle); diff --git a/trunk/kernel/printk.c b/trunk/kernel/printk.c index 9adc2a473e6e..bee36100f110 100644 --- a/trunk/kernel/printk.c +++ b/trunk/kernel/printk.c @@ -666,7 +666,7 @@ asmlinkage int vprintk(const char *fmt, va_list args) } /* Emit the output into the temporary buffer */ printed_len += vscnprintf(printk_buf + printed_len, - sizeof(printk_buf) - printed_len, fmt, args); + sizeof(printk_buf), fmt, args); /* * Copy the output into log_buf. If the caller didn't provide diff --git a/trunk/kernel/sched.c b/trunk/kernel/sched.c index f06950c8a6ce..b387a8de26a5 100644 --- a/trunk/kernel/sched.c +++ b/trunk/kernel/sched.c @@ -668,8 +668,6 @@ const_debug unsigned int sysctl_sched_nr_migrate = 32; */ unsigned int sysctl_sched_rt_period = 1000000; -static __read_mostly int scheduler_running; - /* * part of the period that we allow rt tasks to run in us. * default: 0.95s @@ -691,16 +689,14 @@ unsigned long long cpu_clock(int cpu) unsigned long flags; struct rq *rq; + local_irq_save(flags); + rq = cpu_rq(cpu); /* * Only call sched_clock() if the scheduler has already been * initialized (some code might call cpu_clock() very early): */ - if (unlikely(!scheduler_running)) - return 0; - - local_irq_save(flags); - rq = cpu_rq(cpu); - update_rq_clock(rq); + if (rq->idle) + update_rq_clock(rq); now = rq->clock; local_irq_restore(flags); @@ -3889,7 +3885,7 @@ pick_next_task(struct rq *rq, struct task_struct *prev) asmlinkage void __sched schedule(void) { struct task_struct *prev, *next; - unsigned long *switch_count; + long *switch_count; struct rq *rq; int cpu; @@ -7288,8 +7284,6 @@ void __init sched_init(void) * During early bootup we pretend to be a normal task: */ current->sched_class = &fair_sched_class; - - scheduler_running = 1; } #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP diff --git a/trunk/kernel/sched_fair.c b/trunk/kernel/sched_fair.c index c8e6492c5925..6c091d6e159d 100644 --- a/trunk/kernel/sched_fair.c +++ b/trunk/kernel/sched_fair.c @@ -202,12 +202,17 @@ static struct sched_entity *__pick_next_entity(struct cfs_rq *cfs_rq) static inline struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq) { - struct rb_node *last = rb_last(&cfs_rq->tasks_timeline); + struct rb_node **link = &cfs_rq->tasks_timeline.rb_node; + struct sched_entity *se = NULL; + struct rb_node *parent; - if (!last) - return NULL; + while (*link) { + parent = *link; + se = rb_entry(parent, struct sched_entity, run_node); + link = &parent->rb_right; + } - return rb_entry(last, struct sched_entity, run_node); + return se; } /**************************************************************