diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-26 10:43:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-26 10:43:31 -0500 |
commit | 37c00b84d0c1b5c4c65ae837e2235160c03e84c2 (patch) | |
tree | 9c1437e98d4ea05dcb368fe7f1288f979bf701a1 /kernel | |
parent | cf3680b90c7842cf91ed857ac4528f4e057da366 (diff) | |
parent | 13d77c37cab2bb906022309e1e7182c327e49916 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/mingo/linux-2.6-sched
* git://git.kernel.org/pub/scm/linux/kernel/git/mingo/linux-2.6-sched:
latencytop: change /proc task_struct access method
latencytop: fix memory leak on latency proc file
latencytop: fix kernel panic while reading latency proc file
sched: add declaration of sched_tail to sched.h
sched: fix signedness warnings in sched.c
sched: clean up __pick_last_entity() a bit
sched: remove duplicate code from sched_fair.c
sched: make early bootup sched_clock() use safer
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched.c | 16 | ||||
-rw-r--r-- | kernel/sched_fair.c | 13 |
2 files changed, 15 insertions, 14 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index b387a8de26a5..f06950c8a6ce 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -668,6 +668,8 @@ const_debug unsigned int sysctl_sched_nr_migrate = 32; | |||
668 | */ | 668 | */ |
669 | unsigned int sysctl_sched_rt_period = 1000000; | 669 | unsigned int sysctl_sched_rt_period = 1000000; |
670 | 670 | ||
671 | static __read_mostly int scheduler_running; | ||
672 | |||
671 | /* | 673 | /* |
672 | * part of the period that we allow rt tasks to run in us. | 674 | * part of the period that we allow rt tasks to run in us. |
673 | * default: 0.95s | 675 | * default: 0.95s |
@@ -689,14 +691,16 @@ unsigned long long cpu_clock(int cpu) | |||
689 | unsigned long flags; | 691 | unsigned long flags; |
690 | struct rq *rq; | 692 | struct rq *rq; |
691 | 693 | ||
692 | local_irq_save(flags); | ||
693 | rq = cpu_rq(cpu); | ||
694 | /* | 694 | /* |
695 | * Only call sched_clock() if the scheduler has already been | 695 | * Only call sched_clock() if the scheduler has already been |
696 | * initialized (some code might call cpu_clock() very early): | 696 | * initialized (some code might call cpu_clock() very early): |
697 | */ | 697 | */ |
698 | if (rq->idle) | 698 | if (unlikely(!scheduler_running)) |
699 | update_rq_clock(rq); | 699 | return 0; |
700 | |||
701 | local_irq_save(flags); | ||
702 | rq = cpu_rq(cpu); | ||
703 | update_rq_clock(rq); | ||
700 | now = rq->clock; | 704 | now = rq->clock; |
701 | local_irq_restore(flags); | 705 | local_irq_restore(flags); |
702 | 706 | ||
@@ -3885,7 +3889,7 @@ pick_next_task(struct rq *rq, struct task_struct *prev) | |||
3885 | asmlinkage void __sched schedule(void) | 3889 | asmlinkage void __sched schedule(void) |
3886 | { | 3890 | { |
3887 | struct task_struct *prev, *next; | 3891 | struct task_struct *prev, *next; |
3888 | long *switch_count; | 3892 | unsigned long *switch_count; |
3889 | struct rq *rq; | 3893 | struct rq *rq; |
3890 | int cpu; | 3894 | int cpu; |
3891 | 3895 | ||
@@ -7284,6 +7288,8 @@ void __init sched_init(void) | |||
7284 | * During early bootup we pretend to be a normal task: | 7288 | * During early bootup we pretend to be a normal task: |
7285 | */ | 7289 | */ |
7286 | current->sched_class = &fair_sched_class; | 7290 | current->sched_class = &fair_sched_class; |
7291 | |||
7292 | scheduler_running = 1; | ||
7287 | } | 7293 | } |
7288 | 7294 | ||
7289 | #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP | 7295 | #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP |
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index 6c091d6e159d..c8e6492c5925 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c | |||
@@ -202,17 +202,12 @@ static struct sched_entity *__pick_next_entity(struct cfs_rq *cfs_rq) | |||
202 | 202 | ||
203 | static inline struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq) | 203 | static inline struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq) |
204 | { | 204 | { |
205 | struct rb_node **link = &cfs_rq->tasks_timeline.rb_node; | 205 | struct rb_node *last = rb_last(&cfs_rq->tasks_timeline); |
206 | struct sched_entity *se = NULL; | ||
207 | struct rb_node *parent; | ||
208 | 206 | ||
209 | while (*link) { | 207 | if (!last) |
210 | parent = *link; | 208 | return NULL; |
211 | se = rb_entry(parent, struct sched_entity, run_node); | ||
212 | link = &parent->rb_right; | ||
213 | } | ||
214 | 209 | ||
215 | return se; | 210 | return rb_entry(last, struct sched_entity, run_node); |
216 | } | 211 | } |
217 | 212 | ||
218 | /************************************************************** | 213 | /************************************************************** |