summaryrefslogtreecommitdiff
path: root/kern
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2013-03-05 00:47:33 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2013-03-05 00:48:43 +0100
commit6fe36b76f7983ec9a2e8a70420e431d54252442e (patch)
tree82ca424ee093a0884ec3389d2f30ca91b4afedde /kern
parentf34cc6d5a8bad7a6c34f30917c3f137c886d29bf (diff)
Do not hardcode maximum priority value
* kern/sched_prim.c (do_priority_computation): Replace 31 with NRQS - 1. idle_thread: Likewise.
Diffstat (limited to 'kern')
-rw-r--r--kern/sched_prim.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/kern/sched_prim.c b/kern/sched_prim.c
index ba2dc8a..46b5df4 100644
--- a/kern/sched_prim.c
+++ b/kern/sched_prim.c
@@ -1020,7 +1020,7 @@ shift_data_t wait_shift[32] = {
(pri) = (th)->priority /* start with base priority */ \
+ ((th)->sched_usage >> (PRI_SHIFT + SCHED_SHIFT)) \
+ ((th)->sched_usage >> (PRI_SHIFT_2 + SCHED_SHIFT)); \
- if ((pri) > 31) (pri) = 31; \
+ if ((pri) > NRQS - 1) (pri) = NRQS - 1; \
MACRO_END
#else /* PRI_SHIFT_2 */
#define do_priority_computation(th, pri) \
@@ -1028,7 +1028,7 @@ shift_data_t wait_shift[32] = {
(pri) = (th)->priority /* start with base priority */ \
+ ((th)->sched_usage >> (PRI_SHIFT + SCHED_SHIFT)) \
- ((th)->sched_usage >> (SCHED_SHIFT - PRI_SHIFT_2)); \
- if ((pri) > 31) (pri) = 31; \
+ if ((pri) > NRQS - 1) (pri) = NRQS - 1; \
MACRO_END
#endif /* PRI_SHIFT_2 */
#else /* defined(PRI_SHIFT_2) */
@@ -1036,7 +1036,7 @@ shift_data_t wait_shift[32] = {
MACRO_BEGIN \
(pri) = (th)->priority /* start with base priority */ \
+ ((th)->sched_usage >> (PRI_SHIFT + SCHED_SHIFT)); \
- if ((pri) > 31) (pri) = 31; \
+ if ((pri) > NRQS - 1) (pri) = NRQS - 1; \
MACRO_END
#endif /* defined(PRI_SHIFT_2) */
@@ -1803,8 +1803,8 @@ void idle_thread(void)
stack_privilege(self);
s = splsched();
- self->priority = 31;
- self->sched_pri = 31;
+ self->priority = NRQS-1;
+ self->sched_pri = NRQS-1;
/*
* Set the idle flag to indicate that this is an idle thread,