summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/scheduleredfreleasejob.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-06-22 17:09:23 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-09-21 08:59:26 +0200
commit300f6a481aaf9e6d29811faca71bf7104a01492c (patch)
treeba8f18cedb93e3781a2f17aa989c5c805dd18d6a /cpukit/score/src/scheduleredfreleasejob.c
parentclassic networking: do not reference BSP_irq_enabled_at_i8259s which is no mo... (diff)
downloadrtems-300f6a481aaf9e6d29811faca71bf7104a01492c.tar.bz2
score: Rework thread priority management
Add priority nodes which contribute to the overall thread priority. The actual priority of a thread is now an aggregation of priority nodes. The thread priority aggregation for the home scheduler instance of a thread consists of at least one priority node, which is normally the real priority of the thread. The locking protocols (e.g. priority ceiling and priority inheritance), rate-monotonic period objects and the POSIX sporadic server add, change and remove priority nodes. A thread changes its priority now immediately, e.g. priority changes are not deferred until the thread releases its last resource. Replace the _Thread_Change_priority() function with * _Thread_Priority_perform_actions(), * _Thread_Priority_add(), * _Thread_Priority_remove(), * _Thread_Priority_change(), and * _Thread_Priority_update(). Update #2412. Update #2556.
Diffstat (limited to 'cpukit/score/src/scheduleredfreleasejob.c')
-rw-r--r--cpukit/score/src/scheduleredfreleasejob.c84
1 files changed, 28 insertions, 56 deletions
diff --git a/cpukit/score/src/scheduleredfreleasejob.c b/cpukit/score/src/scheduleredfreleasejob.c
index 4c74c48699..c19d9b9d24 100644
--- a/cpukit/score/src/scheduleredfreleasejob.c
+++ b/cpukit/score/src/scheduleredfreleasejob.c
@@ -20,75 +20,47 @@
#include <rtems/score/scheduleredfimpl.h>
-static bool _Scheduler_EDF_Release_job_filter(
- Thread_Control *the_thread,
- Priority_Control *new_priority_p,
- void *arg
+void _Scheduler_EDF_Release_job(
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ Priority_Node *priority_node,
+ uint64_t deadline,
+ Thread_queue_Context *queue_context
)
{
- Scheduler_EDF_Node *node;
- Priority_Control current_priority;
- Priority_Control new_priority;
+ (void) scheduler;
- node = _Scheduler_EDF_Thread_get_node( the_thread );
+ _Thread_Wait_acquire_critical( the_thread, queue_context );
- current_priority = _Thread_Get_priority( the_thread );
- new_priority = *new_priority_p;
+ _Priority_Node_set_priority( priority_node, deadline );
- node->current_priority = new_priority;
- the_thread->real_priority = new_priority;
+ if ( _Priority_Node_is_active( priority_node ) ) {
+ _Thread_Priority_changed(
+ the_thread,
+ priority_node,
+ false,
+ queue_context
+ );
+ } else {
+ _Thread_Priority_add( the_thread, priority_node, queue_context );
+ }
- return _Thread_Priority_less_than( current_priority, new_priority )
- || !_Thread_Owns_resources( the_thread );
+ _Thread_Wait_release_critical( the_thread, queue_context );
}
-Thread_Control *_Scheduler_EDF_Release_job(
+void _Scheduler_EDF_Cancel_job(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
- uint64_t deadline
-)
-{
- return _Thread_Apply_priority(
- the_thread,
- deadline,
- NULL,
- _Scheduler_EDF_Release_job_filter,
- true
- );
-}
-
-static bool _Scheduler_EDF_Cancel_job_filter(
- Thread_Control *the_thread,
- Priority_Control *new_priority_p,
- void *arg
+ Priority_Node *priority_node,
+ Thread_queue_Context *queue_context
)
{
- Scheduler_EDF_Node *node;
- Priority_Control current_priority;
- Priority_Control new_priority;
+ (void) scheduler;
- node = _Scheduler_EDF_Thread_get_node( the_thread );
+ _Thread_Wait_acquire_critical( the_thread, queue_context );
- current_priority = _Thread_Get_priority( the_thread );
- new_priority = node->background_priority;
+ _Thread_Priority_remove( the_thread, priority_node, queue_context );
+ _Priority_Node_set_inactive( priority_node );
- node->current_priority = new_priority;
- the_thread->real_priority = new_priority;
-
- return _Thread_Priority_less_than( current_priority, new_priority )
- || !_Thread_Owns_resources( the_thread );
-}
-
-Thread_Control *_Scheduler_EDF_Cancel_job(
- const Scheduler_Control *scheduler,
- Thread_Control *the_thread
-)
-{
- return _Thread_Apply_priority(
- the_thread,
- 0,
- NULL,
- _Scheduler_EDF_Cancel_job_filter,
- true
- );
+ _Thread_Wait_release_critical( the_thread, queue_context );
}