From be11249b01c0de8df6ecf95b284dc7646d469636 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Wed, 13 Feb 2008 14:02:36 +0100 Subject: [PATCH] --- yaml --- r: 86321 b: refs/heads/master c: 6892b75e60557a48c01d57ba320419a9e2ce9846 h: refs/heads/master i: 86319: c3039fb20d6e5360271d342d41ce23bb71225cc1 v: v3 --- [refs] | 2 +- trunk/kernel/printk.c | 2 +- trunk/kernel/sched.c | 14 ++++++++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index b985ad855875..fbab32043b49 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: cf3680b90c7842cf91ed857ac4528f4e057da366 +refs/heads/master: 6892b75e60557a48c01d57ba320419a9e2ce9846 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 b387a8de26a5..7286ccb01082 100644 --- a/trunk/kernel/sched.c +++ b/trunk/kernel/sched.c @@ -668,6 +668,8 @@ 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 @@ -689,14 +691,16 @@ 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 (rq->idle) - update_rq_clock(rq); + if (unlikely(!scheduler_running)) + return 0; + + local_irq_save(flags); + rq = cpu_rq(cpu); + update_rq_clock(rq); now = rq->clock; local_irq_restore(flags); @@ -7284,6 +7288,8 @@ 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