Rev 107 | Rev 115 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 107 | Rev 111 | ||
---|---|---|---|
Line 47... | Line 47... | ||
47 | #include <list.h> |
47 | #include <list.h> |
48 | #include <config.h> |
48 | #include <config.h> |
49 | #include <arch/interrupt.h> |
49 | #include <arch/interrupt.h> |
50 | #include <smp/ipi.h> |
50 | #include <smp/ipi.h> |
51 | #include <arch/faddr.h> |
51 | #include <arch/faddr.h> |
- | 52 | #include <arch/atomic.h> |
|
52 | 53 | ||
53 | char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"}; /**< Thread states */ |
54 | char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"}; /**< Thread states */ |
54 | 55 | ||
55 | spinlock_t threads_lock; |
56 | spinlock_t threads_lock; |
56 | link_t threads_head; |
57 | link_t threads_head; |
Line 132... | Line 133... | ||
132 | spinlock_lock(&r->lock); |
133 | spinlock_lock(&r->lock); |
133 | list_append(&t->rq_link, &r->rq_head); |
134 | list_append(&t->rq_link, &r->rq_head); |
134 | r->n++; |
135 | r->n++; |
135 | spinlock_unlock(&r->lock); |
136 | spinlock_unlock(&r->lock); |
136 | 137 | ||
137 | spinlock_lock(&nrdylock); |
138 | atomic_inc(&nrdy); |
138 | avg = ++nrdy / config.cpu_active; |
139 | avg = nrdy / config.cpu_active; |
139 | spinlock_unlock(&nrdylock); |
- | |
140 | 140 | ||
141 | spinlock_lock(&cpu->lock); |
141 | spinlock_lock(&cpu->lock); |
142 | if ((++cpu->nrdy) > avg) { |
142 | if ((++cpu->nrdy) > avg) { |
143 | /* |
143 | /* |
144 | * If there are idle halted CPU's, this will wake them up. |
144 | * If there are idle halted CPU's, this will wake them up. |