summaryrefslogtreecommitdiff
path: root/kern/thread.c
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2014-01-03 23:54:33 +0100
committerRichard Braun <rbraun@sceen.net>2014-01-03 23:54:33 +0100
commita07fad83320e5c1f8c1efe8a716a74731a852e99 (patch)
treec990091fec942245bb2ca0cd717617462805a5a0 /kern/thread.c
parentb5a657f59cfc9ed0d892ec6f7b9d7e7e63cdea76 (diff)
kern/thread: increase the number of real-time priorities
Diffstat (limited to 'kern/thread.c')
-rw-r--r--kern/thread.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/kern/thread.c b/kern/thread.c
index c52be951..1d679bb6 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -125,7 +125,7 @@
* Run queue properties for real-time threads.
*/
struct thread_rt_runq {
- unsigned int bitmap;
+ unsigned long long bitmap;
struct list threads[THREAD_SCHED_RT_PRIO_MAX + 1];
};
@@ -549,7 +549,7 @@ thread_sched_rt_add(struct thread_runq *runq, struct thread *thread)
list_insert_tail(threads, &thread->rt_data.node);
if (list_singular(threads))
- rt_runq->bitmap |= (1U << thread->rt_data.priority);
+ rt_runq->bitmap |= (1ULL << thread->rt_data.priority);
if ((thread->sched_class == runq->current->sched_class)
&& (thread->rt_data.priority > runq->current->rt_data.priority))
@@ -567,7 +567,7 @@ thread_sched_rt_remove(struct thread_runq *runq, struct thread *thread)
list_remove(&thread->rt_data.node);
if (list_empty(threads))
- rt_runq->bitmap &= ~(1U << thread->rt_data.priority);
+ rt_runq->bitmap &= ~(1ULL << thread->rt_data.priority);
}
static void
@@ -589,7 +589,7 @@ thread_sched_rt_get_next(struct thread_runq *runq)
if (rt_runq->bitmap == 0)
return NULL;
- priority = THREAD_SCHED_RT_PRIO_MAX - __builtin_clz(rt_runq->bitmap);
+ priority = THREAD_SCHED_RT_PRIO_MAX - __builtin_clzll(rt_runq->bitmap);
threads = &rt_runq->threads[priority];
assert(!list_empty(threads));
thread = list_first_entry(threads, struct thread, rt_data.node);
@@ -1616,6 +1616,7 @@ thread_setup_balancer(struct thread_runq *runq)
attr.task = NULL;
attr.policy = THREAD_SCHED_POLICY_RR;
attr.priority = THREAD_SCHED_RT_PRIO_MIN;
+ attr.priority = THREAD_SCHED_RT_PRIO_MAX;
error = thread_create(&balancer, &attr, thread_balance, runq);
cpumap_destroy(cpumap);