diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-10-10 14:33:17 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-11-02 10:05:41 +0100 |
commit | e382a1bfccdecf1dcf01c452ee0edb5afa0660b3 (patch) | |
tree | 901e36ea6fcacc997210cb13d19fd997ed15251d /cpukit | |
parent | score: Pass scheduler node to yield operation (diff) | |
download | rtems-e382a1bfccdecf1dcf01c452ee0edb5afa0660b3.tar.bz2 |
score: Pass scheduler node to block operation
Changed for consistency with other scheduler operations.
Update #2556.
Diffstat (limited to 'cpukit')
21 files changed, 83 insertions, 83 deletions
diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h index 745fbec621..eb8db7cbb3 100644 --- a/cpukit/score/include/rtems/score/scheduler.h +++ b/cpukit/score/include/rtems/score/scheduler.h @@ -72,7 +72,8 @@ typedef struct { /** @see _Scheduler_Block() */ void ( *block )( const Scheduler_Control *, - Thread_Control * + Thread_Control *, + Scheduler_Node * ); /** @see _Scheduler_Unblock() */ diff --git a/cpukit/score/include/rtems/score/scheduleredf.h b/cpukit/score/include/rtems/score/scheduleredf.h index 005f2da5f0..2ecf1a4eb2 100644 --- a/cpukit/score/include/rtems/score/scheduleredf.h +++ b/cpukit/score/include/rtems/score/scheduleredf.h @@ -108,20 +108,10 @@ typedef struct { */ void _Scheduler_EDF_Initialize( const Scheduler_Control *scheduler ); -/** - * @brief Removes thread from ready queue. - * - * This routine removes @a the_thread from the scheduling decision, - * that is, removes it from the ready queue. It performs - * any necessary scheduling operations including the selection of - * a new heir thread. - * - * @param[in] scheduler The scheduler instance. - * @param[in] the_thread is the thread to be blocked. - */ void _Scheduler_EDF_Block( const Scheduler_Control *scheduler, - Thread_Control *the_thread + Thread_Control *the_thread, + Scheduler_Node *node ); /** diff --git a/cpukit/score/include/rtems/score/scheduleredfimpl.h b/cpukit/score/include/rtems/score/scheduleredfimpl.h index 61aceddf19..bfb5b45875 100644 --- a/cpukit/score/include/rtems/score/scheduleredfimpl.h +++ b/cpukit/score/include/rtems/score/scheduleredfimpl.h @@ -136,16 +136,17 @@ RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Extract( RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Extract_body( const Scheduler_Control *scheduler, - Thread_Control *the_thread + Thread_Control *the_thread, + Scheduler_Node *node ) { Scheduler_EDF_Context *context; - Scheduler_EDF_Node *node; + Scheduler_EDF_Node *the_node; context = _Scheduler_EDF_Get_context( scheduler ); - node = _Scheduler_EDF_Thread_get_node( the_thread ); + the_node = _Scheduler_EDF_Node_downcast( node ); - _Scheduler_EDF_Extract( context, node ); + _Scheduler_EDF_Extract( context, the_node ); } RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Schedule_body( diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h index a431a3af08..e630cc2e53 100644 --- a/cpukit/score/include/rtems/score/schedulerimpl.h +++ b/cpukit/score/include/rtems/score/schedulerimpl.h @@ -330,7 +330,11 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Block( Thread_Control *the_thread ) scheduler = _Scheduler_Get( the_thread ); _Scheduler_Acquire_critical( scheduler, &lock_context ); - ( *scheduler->Operations.block )( scheduler, the_thread ); + ( *scheduler->Operations.block )( + scheduler, + the_thread, + _Thread_Scheduler_get_home_node( the_thread ) + ); _Scheduler_Release_critical( scheduler, &lock_context ); } @@ -708,16 +712,20 @@ bool _Scheduler_Set_affinity( RTEMS_INLINE_ROUTINE void _Scheduler_Generic_block( const Scheduler_Control *scheduler, Thread_Control *the_thread, + Scheduler_Node *node, void ( *extract )( const Scheduler_Control *, - Thread_Control * ), + Thread_Control *, + Scheduler_Node * + ), void ( *schedule )( const Scheduler_Control *, Thread_Control *, - bool ) + bool + ) ) { - ( *extract )( scheduler, the_thread ); + ( *extract )( scheduler, the_thread, node ); /* TODO: flash critical section? */ diff --git a/cpukit/score/include/rtems/score/schedulerpriority.h b/cpukit/score/include/rtems/score/schedulerpriority.h index 175def49a3..89912aac55 100644 --- a/cpukit/score/include/rtems/score/schedulerpriority.h +++ b/cpukit/score/include/rtems/score/schedulerpriority.h @@ -111,20 +111,10 @@ typedef struct { */ void _Scheduler_priority_Initialize( const Scheduler_Control *scheduler ); -/** - * @brief Removes @a the_thread from the scheduling decision. - * - * This routine removes @a the_thread from the scheduling decision, - * that is, removes it from the ready queue. It performs - * any necessary scheduling operations including the selection of - * a new heir thread. - * - * @param[in] scheduler The scheduler instance. - * @param[in] the_thread is the thread to be blocked - */ void _Scheduler_priority_Block( const Scheduler_Control *scheduler, - Thread_Control *the_thread + Thread_Control *the_thread, + Scheduler_Node *node ); /** diff --git a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h index be28deca28..bc3ea49d69 100644 --- a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h +++ b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h @@ -86,17 +86,10 @@ void _Scheduler_priority_affinity_SMP_Node_initialize( Priority_Control priority ); -/** - * @brief SMP Priority Affinity Scheduler Block Operation - * - * This method is the block operation for this scheduler. - * - * @param[in] scheduler is the scheduler instance information - * @param[in] thread is the thread to block - */ void _Scheduler_priority_affinity_SMP_Block( const Scheduler_Control *scheduler, - Thread_Control *thread + Thread_Control *thread, + Scheduler_Node *node ); /** diff --git a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h index 38f9f5b53a..e9e987318c 100644 --- a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h +++ b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h @@ -140,16 +140,19 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_extract( RTEMS_INLINE_ROUTINE void _Scheduler_priority_Extract_body( const Scheduler_Control *scheduler, - Thread_Control *the_thread + Thread_Control *the_thread, + Scheduler_Node *node ) { - Scheduler_priority_Context *context = - _Scheduler_priority_Get_context( scheduler ); - Scheduler_priority_Node *node = _Scheduler_priority_Thread_get_node( the_thread ); + Scheduler_priority_Context *context; + Scheduler_priority_Node *the_node; + + context = _Scheduler_priority_Get_context( scheduler ); + the_node = _Scheduler_priority_Node_downcast( node ); _Scheduler_priority_Ready_queue_extract( &the_thread->Object.Node, - &node->Ready_queue, + &the_node->Ready_queue, &context->Bit_map ); } diff --git a/cpukit/score/include/rtems/score/schedulerprioritysmp.h b/cpukit/score/include/rtems/score/schedulerprioritysmp.h index 8350038d1c..de37d34d0e 100644 --- a/cpukit/score/include/rtems/score/schedulerprioritysmp.h +++ b/cpukit/score/include/rtems/score/schedulerprioritysmp.h @@ -107,7 +107,8 @@ void _Scheduler_priority_SMP_Node_initialize( void _Scheduler_priority_SMP_Block( const Scheduler_Control *scheduler, - Thread_Control *thread + Thread_Control *thread, + Scheduler_Node *node ); Thread_Control *_Scheduler_priority_SMP_Unblock( diff --git a/cpukit/score/include/rtems/score/schedulersimple.h b/cpukit/score/include/rtems/score/schedulersimple.h index d8bc02ed0d..4ef0db8d6f 100644 --- a/cpukit/score/include/rtems/score/schedulersimple.h +++ b/cpukit/score/include/rtems/score/schedulersimple.h @@ -98,20 +98,10 @@ Scheduler_Void_or_thread _Scheduler_simple_Yield( Scheduler_Node *node ); -/** - * @brief Remove a simple-priority-based thread from the queue. - * - * This routine removes @a the_thread from the scheduling decision, - * that is, removes it from the ready queue. It performs - * any necessary scheduling operations including the selection of - * a new heir thread. - * - * @param[in] scheduler The scheduler instance. - * @param[in] the_thread is the thread that is to be blocked - */ void _Scheduler_simple_Block( const Scheduler_Control *scheduler, - Thread_Control *the_thread + Thread_Control *the_thread, + Scheduler_Node *node ); /** diff --git a/cpukit/score/include/rtems/score/schedulersimpleimpl.h b/cpukit/score/include/rtems/score/schedulersimpleimpl.h index 85951fa631..c94f9b3bdb 100644 --- a/cpukit/score/include/rtems/score/schedulersimpleimpl.h +++ b/cpukit/score/include/rtems/score/schedulersimpleimpl.h @@ -88,10 +88,12 @@ RTEMS_INLINE_ROUTINE void _Scheduler_simple_Insert_priority_fifo( RTEMS_INLINE_ROUTINE void _Scheduler_simple_Extract( const Scheduler_Control *scheduler, - Thread_Control *the_thread + Thread_Control *the_thread, + Scheduler_Node *node ) { (void) scheduler; + (void) node; _Chain_Extract_unprotected( &the_thread->Object.Node ); } diff --git a/cpukit/score/include/rtems/score/schedulersimplesmp.h b/cpukit/score/include/rtems/score/schedulersimplesmp.h index 36f5fb38c7..db36b84857 100644 --- a/cpukit/score/include/rtems/score/schedulersimplesmp.h +++ b/cpukit/score/include/rtems/score/schedulersimplesmp.h @@ -90,7 +90,8 @@ void _Scheduler_simple_SMP_Node_initialize( void _Scheduler_simple_SMP_Block( const Scheduler_Control *scheduler, - Thread_Control *thread + Thread_Control *thread, + Scheduler_Node *node ); Thread_Control *_Scheduler_simple_SMP_Unblock( diff --git a/cpukit/score/include/rtems/score/schedulersmpimpl.h b/cpukit/score/include/rtems/score/schedulersmpimpl.h index 6deb160405..f797735c76 100644 --- a/cpukit/score/include/rtems/score/schedulersmpimpl.h +++ b/cpukit/score/include/rtems/score/schedulersmpimpl.h @@ -868,6 +868,7 @@ static inline void _Scheduler_SMP_Schedule_highest_ready( * * @param[in] context The scheduler instance context. * @param[in] thread The thread of the scheduling operation. + * @param[in] node The scheduler node of the thread to block. * @param[in] extract_from_ready Function to extract a node from the set of * ready nodes. * @param[in] get_highest_ready Function to get the highest ready node. @@ -877,41 +878,45 @@ static inline void _Scheduler_SMP_Schedule_highest_ready( static inline void _Scheduler_SMP_Block( Scheduler_Context *context, Thread_Control *thread, + Scheduler_Node *node, Scheduler_SMP_Extract extract_from_ready, Scheduler_SMP_Get_highest_ready get_highest_ready, Scheduler_SMP_Move move_from_ready_to_scheduled, Scheduler_SMP_Allocate_processor allocate_processor ) { - Scheduler_SMP_Node *node = _Scheduler_SMP_Thread_get_node( thread ); - bool is_scheduled = node->state == SCHEDULER_SMP_NODE_SCHEDULED; - bool block; + Scheduler_SMP_Node_state node_state; + bool block; - _Assert( is_scheduled || node->state == SCHEDULER_SMP_NODE_READY ); + node_state = _Scheduler_SMP_Node_state( node ); + _Assert( node_state != SCHEDULER_SMP_NODE_BLOCKED ); block = _Scheduler_Block_node( context, thread, - &node->Base, - is_scheduled, + node, + node_state == SCHEDULER_SMP_NODE_SCHEDULED, _Scheduler_SMP_Get_idle_thread ); if ( block ) { - _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_BLOCKED ); + _Scheduler_SMP_Node_change_state( + _Scheduler_SMP_Node_downcast( node ), + SCHEDULER_SMP_NODE_BLOCKED + ); - if ( is_scheduled ) { - _Scheduler_SMP_Extract_from_scheduled( &node->Base ); + if ( node_state == SCHEDULER_SMP_NODE_SCHEDULED ) { + _Scheduler_SMP_Extract_from_scheduled( node ); _Scheduler_SMP_Schedule_highest_ready( context, - &node->Base, + node, extract_from_ready, get_highest_ready, move_from_ready_to_scheduled, allocate_processor ); } else { - ( *extract_from_ready )( context, &node->Base ); + ( *extract_from_ready )( context, node ); } } } diff --git a/cpukit/score/include/rtems/score/schedulerstrongapa.h b/cpukit/score/include/rtems/score/schedulerstrongapa.h index aa352e2964..a83616cdfc 100644 --- a/cpukit/score/include/rtems/score/schedulerstrongapa.h +++ b/cpukit/score/include/rtems/score/schedulerstrongapa.h @@ -107,7 +107,8 @@ void _Scheduler_strong_APA_Node_initialize( void _Scheduler_strong_APA_Block( const Scheduler_Control *scheduler, - Thread_Control *the_thread + Thread_Control *the_thread, + Scheduler_Node *node ); Thread_Control *_Scheduler_strong_APA_Unblock( diff --git a/cpukit/score/src/scheduleredfblock.c b/cpukit/score/src/scheduleredfblock.c index 80cb83d70b..1269e8e5bc 100644 --- a/cpukit/score/src/scheduleredfblock.c +++ b/cpukit/score/src/scheduleredfblock.c @@ -23,12 +23,14 @@ void _Scheduler_EDF_Block( const Scheduler_Control *scheduler, - Thread_Control *the_thread + Thread_Control *the_thread, + Scheduler_Node *node ) { _Scheduler_Generic_block( scheduler, the_thread, + node, _Scheduler_EDF_Extract_body, _Scheduler_EDF_Schedule_body ); diff --git a/cpukit/score/src/schedulerpriorityaffinitysmp.c b/cpukit/score/src/schedulerpriorityaffinitysmp.c index 9282b1a845..451df88d83 100644 --- a/cpukit/score/src/schedulerpriorityaffinitysmp.c +++ b/cpukit/score/src/schedulerpriorityaffinitysmp.c @@ -190,7 +190,8 @@ static Scheduler_Node *_Scheduler_priority_affinity_SMP_Get_highest_ready( */ void _Scheduler_priority_affinity_SMP_Block( const Scheduler_Control *scheduler, - Thread_Control *thread + Thread_Control *thread, + Scheduler_Node *node ) { Scheduler_Context *context = _Scheduler_Get_context( scheduler ); @@ -198,6 +199,7 @@ void _Scheduler_priority_affinity_SMP_Block( _Scheduler_SMP_Block( context, thread, + node, _Scheduler_priority_SMP_Extract_from_ready, _Scheduler_priority_affinity_SMP_Get_highest_ready, _Scheduler_priority_SMP_Move_from_ready_to_scheduled, @@ -599,7 +601,7 @@ bool _Scheduler_priority_affinity_SMP_Set_affinity( current_state = thread->current_state; if ( _States_Is_ready( current_state ) ) { - _Scheduler_priority_affinity_SMP_Block( scheduler, thread ); + _Scheduler_priority_affinity_SMP_Block( scheduler, thread, &node->Base.Base.Base ); } CPU_COPY( node->Affinity.set, cpuset ); diff --git a/cpukit/score/src/schedulerpriorityblock.c b/cpukit/score/src/schedulerpriorityblock.c index ba3c825322..611c4cd343 100644 --- a/cpukit/score/src/schedulerpriorityblock.c +++ b/cpukit/score/src/schedulerpriorityblock.c @@ -24,12 +24,14 @@ void _Scheduler_priority_Block( const Scheduler_Control *scheduler, - Thread_Control *the_thread + Thread_Control *the_thread, + Scheduler_Node *node ) { _Scheduler_Generic_block( scheduler, the_thread, + node, _Scheduler_priority_Extract_body, _Scheduler_priority_Schedule_body ); diff --git a/cpukit/score/src/schedulerprioritysmp.c b/cpukit/score/src/schedulerprioritysmp.c index 3c88161767..ab3e663a81 100644 --- a/cpukit/score/src/schedulerprioritysmp.c +++ b/cpukit/score/src/schedulerprioritysmp.c @@ -92,7 +92,8 @@ static Scheduler_Node *_Scheduler_priority_SMP_Get_highest_ready( void _Scheduler_priority_SMP_Block( const Scheduler_Control *scheduler, - Thread_Control *thread + Thread_Control *thread, + Scheduler_Node *node ) { Scheduler_Context *context = _Scheduler_Get_context( scheduler ); @@ -100,6 +101,7 @@ void _Scheduler_priority_SMP_Block( _Scheduler_SMP_Block( context, thread, + node, _Scheduler_priority_SMP_Extract_from_ready, _Scheduler_priority_SMP_Get_highest_ready, _Scheduler_priority_SMP_Move_from_ready_to_scheduled, diff --git a/cpukit/score/src/schedulersimpleblock.c b/cpukit/score/src/schedulersimpleblock.c index ad409bbf61..2fd50b74cb 100644 --- a/cpukit/score/src/schedulersimpleblock.c +++ b/cpukit/score/src/schedulersimpleblock.c @@ -23,12 +23,14 @@ void _Scheduler_simple_Block( const Scheduler_Control *scheduler, - Thread_Control *the_thread + Thread_Control *the_thread, + Scheduler_Node *node ) { _Scheduler_Generic_block( scheduler, the_thread, + node, _Scheduler_simple_Extract, _Scheduler_simple_Schedule_body ); diff --git a/cpukit/score/src/schedulersimplechangepriority.c b/cpukit/score/src/schedulersimplechangepriority.c index e430c75e08..cad75f8d6e 100644 --- a/cpukit/score/src/schedulersimplechangepriority.c +++ b/cpukit/score/src/schedulersimplechangepriority.c @@ -38,7 +38,7 @@ Scheduler_Void_or_thread _Scheduler_simple_Update_priority( context = _Scheduler_simple_Get_context( scheduler ); _Scheduler_Node_get_priority( node, &prepend_it ); - _Scheduler_simple_Extract( scheduler, the_thread ); + _Scheduler_simple_Extract( scheduler, the_thread, node ); if ( prepend_it ) { _Scheduler_simple_Insert_priority_lifo( &context->Ready, the_thread ); diff --git a/cpukit/score/src/schedulersimplesmp.c b/cpukit/score/src/schedulersimplesmp.c index b476c08edb..3d4efeade0 100644 --- a/cpukit/score/src/schedulersimplesmp.c +++ b/cpukit/score/src/schedulersimplesmp.c @@ -159,7 +159,8 @@ static void _Scheduler_simple_SMP_Extract_from_ready( void _Scheduler_simple_SMP_Block( const Scheduler_Control *scheduler, - Thread_Control *thread + Thread_Control *thread, + Scheduler_Node *node ) { Scheduler_Context *context = _Scheduler_Get_context( scheduler ); @@ -167,6 +168,7 @@ void _Scheduler_simple_SMP_Block( _Scheduler_SMP_Block( context, thread, + node, _Scheduler_simple_SMP_Extract_from_ready, _Scheduler_simple_SMP_Get_highest_ready, _Scheduler_simple_SMP_Move_from_ready_to_scheduled, diff --git a/cpukit/score/src/schedulerstrongapa.c b/cpukit/score/src/schedulerstrongapa.c index 2b2f4e4839..b5a5545a5f 100644 --- a/cpukit/score/src/schedulerstrongapa.c +++ b/cpukit/score/src/schedulerstrongapa.c @@ -218,7 +218,8 @@ static Scheduler_Node *_Scheduler_strong_APA_Get_highest_ready( void _Scheduler_strong_APA_Block( const Scheduler_Control *scheduler, - Thread_Control *the_thread + Thread_Control *the_thread, + Scheduler_Node *node ) { Scheduler_Context *context = _Scheduler_Get_context( scheduler ); @@ -226,6 +227,7 @@ void _Scheduler_strong_APA_Block( _Scheduler_SMP_Block( context, the_thread, + node, _Scheduler_strong_APA_Extract_from_ready, _Scheduler_strong_APA_Get_highest_ready, _Scheduler_strong_APA_Move_from_ready_to_scheduled, |