From 7f7424329eafab755381bc638c2cdddc152a909b Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 31 Oct 2016 08:22:02 +0100 Subject: score: Delete Thread_Scheduler_control::own_node Update #2556. --- cpukit/score/include/rtems/score/coremuteximpl.h | 6 +++--- cpukit/score/include/rtems/score/mrspimpl.h | 9 ++++++--- cpukit/score/include/rtems/score/schedulerimpl.h | 5 ++--- cpukit/score/include/rtems/score/schedulersmpimpl.h | 2 +- cpukit/score/include/rtems/score/thread.h | 8 -------- cpukit/score/include/rtems/score/threadimpl.h | 13 +------------ cpukit/score/src/threadchangepriority.c | 16 ++++++++++------ cpukit/score/src/threadinitialize.c | 3 +-- cpukit/score/src/threadmp.c | 3 --- cpukit/score/src/threadqflush.c | 2 +- cpukit/score/src/threadqops.c | 10 +++++----- cpukit/score/src/threadrestart.c | 2 +- 12 files changed, 31 insertions(+), 48 deletions(-) (limited to 'cpukit/score') diff --git a/cpukit/score/include/rtems/score/coremuteximpl.h b/cpukit/score/include/rtems/score/coremuteximpl.h index 2580606a9a..5078c26c0a 100644 --- a/cpukit/score/include/rtems/score/coremuteximpl.h +++ b/cpukit/score/include/rtems/score/coremuteximpl.h @@ -280,16 +280,16 @@ RTEMS_INLINE_ROUTINE Status_Control _CORE_ceiling_mutex_Set_owner( ) { ISR_lock_Context lock_context; - Scheduler_Node *own_node; + Scheduler_Node *scheduler_node; Per_CPU_Control *cpu_self; _Thread_queue_Context_clear_priority_updates( queue_context ); _Thread_Wait_acquire_default_critical( owner, &lock_context ); - own_node = _Thread_Scheduler_get_own_node( owner ); + scheduler_node = _Thread_Scheduler_get_home_node( owner ); if ( - own_node->Wait.Priority.Node.priority + _Priority_Get_priority( &scheduler_node->Wait.Priority ) < the_mutex->Priority_ceiling.priority ) { _Thread_Wait_release_default_critical( owner, &lock_context ); diff --git a/cpukit/score/include/rtems/score/mrspimpl.h b/cpukit/score/include/rtems/score/mrspimpl.h index 4b4e8c3c67..9555197672 100644 --- a/cpukit/score/include/rtems/score/mrspimpl.h +++ b/cpukit/score/include/rtems/score/mrspimpl.h @@ -100,16 +100,19 @@ RTEMS_INLINE_ROUTINE Status_Control _MRSP_Raise_priority( ISR_lock_Context lock_context; const Scheduler_Control *scheduler; Priority_Control ceiling_priority; - Scheduler_Node *own_node; + Scheduler_Node *scheduler_node; _Thread_queue_Context_clear_priority_updates( queue_context ); _Thread_Wait_acquire_default_critical( thread, &lock_context ); scheduler = _Scheduler_Get_own( thread ); - own_node = _Thread_Scheduler_get_own_node( thread ); + scheduler_node = _Thread_Scheduler_get_home_node( thread ); ceiling_priority = _MRSP_Get_priority( mrsp, scheduler ); - if ( ceiling_priority <= own_node->Wait.Priority.Node.priority ) { + if ( + ceiling_priority + <= _Priority_Get_priority( &scheduler_node->Wait.Priority ) + ) { _Priority_Node_initialize( priority_node, ceiling_priority ); _Thread_Priority_add( thread, priority_node, queue_context ); status = STATUS_SUCCESSFUL; diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h index aaa28e0129..acd5ba28f5 100644 --- a/cpukit/score/include/rtems/score/schedulerimpl.h +++ b/cpukit/score/include/rtems/score/schedulerimpl.h @@ -893,7 +893,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Thread_set_priority( { Scheduler_Node *scheduler_node; - scheduler_node = _Thread_Scheduler_get_own_node( the_thread ); + scheduler_node = _Thread_Scheduler_get_home_node( the_thread ); _Scheduler_Node_set_priority( scheduler_node, new_priority, prepend_it ); } @@ -1247,7 +1247,7 @@ RTEMS_INLINE_ROUTINE Status_Control _Scheduler_Set( return STATUS_RESOURCE_IN_USE; } - old_scheduler_node = _Thread_Scheduler_get_own_node( the_thread ); + old_scheduler_node = _Thread_Scheduler_get_home_node( the_thread ); _Priority_Plain_extract( &old_scheduler_node->Wait.Priority, &the_thread->Real_priority @@ -1314,7 +1314,6 @@ RTEMS_INLINE_ROUTINE Status_Control _Scheduler_Set( the_thread->Scheduler.own_control = new_scheduler; the_thread->Scheduler.control = new_scheduler; - the_thread->Scheduler.own_node = new_scheduler_node; _Scheduler_Node_set_priority( new_scheduler_node, priority, false ); if ( _States_Is_ready( current_state ) ) { diff --git a/cpukit/score/include/rtems/score/schedulersmpimpl.h b/cpukit/score/include/rtems/score/schedulersmpimpl.h index bfd7650bea..992668403d 100644 --- a/cpukit/score/include/rtems/score/schedulersmpimpl.h +++ b/cpukit/score/include/rtems/score/schedulersmpimpl.h @@ -383,7 +383,7 @@ static inline Scheduler_SMP_Node *_Scheduler_SMP_Thread_get_own_node( Thread_Control *thread ) { - return (Scheduler_SMP_Node *) _Thread_Scheduler_get_own_node( thread ); + return (Scheduler_SMP_Node *) _Thread_Scheduler_get_home_node( thread ); } static inline Scheduler_SMP_Node *_Scheduler_SMP_Node_downcast( diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h index 76cc333782..37b978818e 100644 --- a/cpukit/score/include/rtems/score/thread.h +++ b/cpukit/score/include/rtems/score/thread.h @@ -268,14 +268,6 @@ typedef struct { */ const struct Scheduler_Control *control; - /** - * @brief The own scheduler node of this thread. - * - * This field is constant after initialization. It is used by change - * priority and ask for help operations. - */ - Scheduler_Node *own_node; - /** * @brief The processor assigned by the current scheduler. */ diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h index 00402b642b..5bf45067c1 100644 --- a/cpukit/score/include/rtems/score/threadimpl.h +++ b/cpukit/score/include/rtems/score/threadimpl.h @@ -1005,17 +1005,6 @@ RTEMS_INLINE_ROUTINE void _Thread_Scheduler_cancel_need_for_help( } #endif -RTEMS_INLINE_ROUTINE Scheduler_Node *_Thread_Scheduler_get_own_node( - const Thread_Control *the_thread -) -{ -#if defined(RTEMS_SMP) - return the_thread->Scheduler.own_node; -#else - return the_thread->Scheduler.nodes; -#endif -} - RTEMS_INLINE_ROUTINE Scheduler_Node *_Thread_Scheduler_get_home_node( const Thread_Control *the_thread ) @@ -1150,7 +1139,7 @@ RTEMS_INLINE_ROUTINE Priority_Control _Thread_Get_priority( { Scheduler_Node *scheduler_node; - scheduler_node = _Thread_Scheduler_get_own_node( the_thread ); + scheduler_node = _Thread_Scheduler_get_home_node( the_thread ); return _Priority_Get_priority( &scheduler_node->Wait.Priority ); } diff --git a/cpukit/score/src/threadchangepriority.c b/cpukit/score/src/threadchangepriority.c index 4fd4c02f01..102c9d1fa2 100644 --- a/cpukit/score/src/threadchangepriority.c +++ b/cpukit/score/src/threadchangepriority.c @@ -244,13 +244,13 @@ static void _Thread_Priority_apply( Priority_Action_type priority_action_type ) { - Scheduler_Node *own_node; + Scheduler_Node *scheduler_node; Thread_queue_Queue *queue; - own_node = _Thread_Scheduler_get_own_node( the_thread ); + scheduler_node = _Thread_Scheduler_get_home_node( the_thread ); _Priority_Actions_initialize_one( &queue_context->Priority.Actions, - &own_node->Wait.Priority, + &scheduler_node->Wait.Priority, priority_action_node, priority_action_type ); @@ -326,10 +326,14 @@ void _Thread_Priority_replace( Priority_Node *replacement_node ) { - Scheduler_Node *own_node; + Scheduler_Node *scheduler_node; - own_node = _Thread_Scheduler_get_own_node( the_thread ); - _Priority_Replace( &own_node->Wait.Priority, victim_node, replacement_node ); + scheduler_node = _Thread_Scheduler_get_home_node( the_thread ); + _Priority_Replace( + &scheduler_node->Wait.Priority, + victim_node, + replacement_node + ); } void _Thread_Priority_update( Thread_queue_Context *queue_context ) diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c index 37feb372ff..d34cb34313 100644 --- a/cpukit/score/src/threadinitialize.c +++ b/cpukit/score/src/threadinitialize.c @@ -214,7 +214,7 @@ bool _Thread_Initialize( &scheduler_node->Thread.Scheduler_node.Chain ); #else - scheduler_node = _Thread_Scheduler_get_own_node( the_thread ); + scheduler_node = _Thread_Scheduler_get_home_node( the_thread ); _Scheduler_Node_initialize( scheduler, scheduler_node, @@ -234,7 +234,6 @@ bool _Thread_Initialize( RTEMS_STATIC_ASSERT( THREAD_SCHEDULER_BLOCKED == 0, Scheduler_state ); the_thread->Scheduler.own_control = scheduler; the_thread->Scheduler.control = scheduler; - the_thread->Scheduler.own_node = scheduler_node; _ISR_lock_Initialize( &the_thread->Scheduler.Lock, "Thread Scheduler" ); _ISR_lock_Initialize( &the_thread->Wait.Lock.Default, "Thread Wait Default" ); _Thread_queue_Gate_open( &the_thread->Wait.Lock.Tranquilizer ); diff --git a/cpukit/score/src/threadmp.c b/cpukit/score/src/threadmp.c index 6ff5065e1d..9b3a47710d 100644 --- a/cpukit/score/src/threadmp.c +++ b/cpukit/score/src/threadmp.c @@ -75,9 +75,6 @@ void _Thread_MP_Handler_initialization ( _Thread_Timer_initialize( &proxy->Timer, _Per_CPU_Get_by_index( 0 ) ); _RBTree_Initialize_node( &proxy->Active ); -#if defined(RTEMS_SMP) - proxy->Scheduler.own_node = &proxy->Scheduler_node; -#endif proxy->Scheduler.nodes = &proxy->Scheduler_node; _Scheduler_Node_do_initialize( _Scheduler_Get_by_CPU_index( 0 ), diff --git a/cpukit/score/src/threadqflush.c b/cpukit/score/src/threadqflush.c index 9ea82af24a..6c9ca9801b 100644 --- a/cpukit/score/src/threadqflush.c +++ b/cpukit/score/src/threadqflush.c @@ -99,7 +99,7 @@ size_t _Thread_queue_Flush_critical( if ( do_unblock ) { Scheduler_Node *scheduler_node; - scheduler_node = _Thread_Scheduler_get_own_node( first ); + scheduler_node = _Thread_Scheduler_get_home_node( first ); _Chain_Append_unprotected( &unblock, &scheduler_node->Wait.Priority.Node.Node.Chain diff --git a/cpukit/score/src/threadqops.c b/cpukit/score/src/threadqops.c index db22efdbd7..445fc4c835 100644 --- a/cpukit/score/src/threadqops.c +++ b/cpukit/score/src/threadqops.c @@ -142,7 +142,7 @@ static void _Thread_queue_FIFO_do_initialize( { Scheduler_Node *scheduler_node; - scheduler_node = _Thread_Scheduler_get_own_node( the_thread ); + scheduler_node = _Thread_Scheduler_get_home_node( the_thread ); _Chain_Initialize_node( &scheduler_node->Wait.Priority.Node.Node.Chain ); _Chain_Initialize_one( @@ -160,7 +160,7 @@ static void _Thread_queue_FIFO_do_enqueue( { Scheduler_Node *scheduler_node; - scheduler_node = _Thread_Scheduler_get_own_node( the_thread ); + scheduler_node = _Thread_Scheduler_get_home_node( the_thread ); _Chain_Initialize_node( &scheduler_node->Wait.Priority.Node.Node.Chain ); _Chain_Append_unprotected( @@ -182,7 +182,7 @@ static void _Thread_queue_FIFO_do_extract( (void) current_or_previous_owner; (void) queue_context; - scheduler_node = _Thread_Scheduler_get_own_node( the_thread ); + scheduler_node = _Thread_Scheduler_get_home_node( the_thread ); _Chain_Extract_unprotected( &scheduler_node->Wait.Priority.Node.Node.Chain ); } @@ -891,7 +891,7 @@ static void _Thread_queue_Priority_inherit_do_enqueue_change( queue = arg; owner = queue->owner; - scheduler_node_of_owner = _Thread_Scheduler_get_own_node( owner ); + scheduler_node_of_owner = _Thread_Scheduler_get_home_node( owner ); queue_context = THREAD_QUEUE_CONTEXT_OF_PRIORITY_ACTIONS( priority_actions ); _Priority_Actions_initialize_one( @@ -1385,7 +1385,7 @@ static void _Thread_queue_Priority_inherit_do_surrender( fifo_node = _Chain_Next( fifo_node ); } #else - scheduler_node = _Thread_Scheduler_get_own_node( the_thread ); + scheduler_node = _Thread_Scheduler_get_home_node( the_thread ); priority_queue = _Thread_queue_Priority_queue( heads, scheduler_node ); scheduler_node_of_owner = priority_queue->scheduler_node; diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c index 5cd9d43c57..08e3c804b6 100644 --- a/cpukit/score/src/threadrestart.c +++ b/cpukit/score/src/threadrestart.c @@ -170,7 +170,7 @@ static void _Thread_Free( Thread_Control *the_thread ) _ISR_lock_Destroy( &the_thread->Keys.Lock ); _Scheduler_Node_destroy( _Scheduler_Get( the_thread ), - _Thread_Scheduler_get_own_node( the_thread ) + _Thread_Scheduler_get_home_node( the_thread ) ); _ISR_lock_Destroy( &the_thread->Timer.Lock ); -- cgit v1.2.3