diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-07-04 14:34:23 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-07-09 10:05:17 +0200 |
commit | 5c3d2509593476869e791111cd3d93cc1e840b3a (patch) | |
tree | 2f642fcce66748460f0f823fbeb6f292267b8cd0 /cpukit/score/include/rtems/score/mrspimpl.h | |
parent | schedulerpriorityaffinitysmp.c: Add period at end of sentence (diff) | |
download | rtems-5c3d2509593476869e791111cd3d93cc1e840b3a.tar.bz2 |
score: Implement scheduler helping protocol
The following scheduler operations return a thread in need for help
- unblock,
- change priority, and
- yield.
A thread in need for help is a thread that encounters a scheduler state
change from scheduled to ready or a thread that cannot be scheduled in
an unblock operation. Such a thread can ask threads which depend on
resources owned by this thread for help.
Add a new ask for help scheduler operation. This operation is used by
_Scheduler_Ask_for_help() to help threads in need for help returned by
the operations mentioned above. This operation is also used by
_Scheduler_Thread_change_resource_root() in case the root of a resource
sub-tree changes. A use case is the ownership change of a resource.
In case it is not possible to schedule a thread in need for help, then
the corresponding scheduler node will be placed into the set of ready
scheduler nodes of the scheduler instance. Once a state change from
ready to scheduled happens for this scheduler node it may be used to
schedule the thread in need for help.
Diffstat (limited to 'cpukit/score/include/rtems/score/mrspimpl.h')
-rw-r--r-- | cpukit/score/include/rtems/score/mrspimpl.h | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/cpukit/score/include/rtems/score/mrspimpl.h b/cpukit/score/include/rtems/score/mrspimpl.h index 6aa45a8c4f..4aaa50bc01 100644 --- a/cpukit/score/include/rtems/score/mrspimpl.h +++ b/cpukit/score/include/rtems/score/mrspimpl.h @@ -42,25 +42,6 @@ extern "C" { #define MRSP_RIVAL_STATE_TIMEOUT 0x2U -RTEMS_INLINE_ROUTINE bool _MRSP_Set_root_visitor( - Resource_Node *node, - void *arg -) -{ - _Resource_Node_set_root( node, arg ); - - return false; -} - -RTEMS_INLINE_ROUTINE void _MRSP_Set_root( - Resource_Node *top, - Resource_Node *root -) -{ - _Resource_Node_set_root( top, root ); - _Resource_Iterate( top, _MRSP_Set_root_visitor, root ); -} - RTEMS_INLINE_ROUTINE void _MRSP_Elevate_priority( MRSP_Control *mrsp, Thread_Control *new_owner, @@ -197,9 +178,10 @@ RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Wait_for_ownership( _Resource_Node_set_dependency( &executing->Resource_node, &mrsp->Resource ); previous_help_state = _Scheduler_Thread_change_help_state( executing, SCHEDULER_HELP_ACTIVE_RIVAL ); - _MRSP_Set_root( - &executing->Resource_node, - _Resource_Node_get_root( owner ) + + _Scheduler_Thread_change_resource_root( + executing, + _Thread_Resource_node_to_thread( _Resource_Node_get_root( owner ) ) ); if ( timeout > 0 ) { @@ -241,7 +223,7 @@ RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Wait_for_ownership( _Resource_Node_extract( &executing->Resource_node ); _Resource_Node_set_dependency( &executing->Resource_node, NULL ); _Scheduler_Thread_change_help_state( executing, previous_help_state ); - _MRSP_Set_root( &executing->Resource_node, &executing->Resource_node ); + _Scheduler_Thread_change_resource_root( executing, executing ); _MRSP_Restore_priority( mrsp, executing, initial_priority ); status = MRSP_TIMEOUT; @@ -334,7 +316,7 @@ RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Release( _Resource_Node_add_resource( &new_owner->Resource_node, &mrsp->Resource ); _Resource_Set_owner( &mrsp->Resource, &new_owner->Resource_node ); _Scheduler_Thread_change_help_state( new_owner, SCHEDULER_HELP_ACTIVE_OWNER ); - _MRSP_Set_root( &new_owner->Resource_node, &new_owner->Resource_node ); + _Scheduler_Thread_change_resource_root( new_owner, new_owner ); _MRSP_Add_state( rival, MRSP_RIVAL_STATE_NEW_OWNER ); } |