[rtems commit] score: Delete Thread_Scheduler_control::own_node

Sebastian Huber sebh at rtems.org
Wed Nov 2 09:10:43 UTC 2016


Module:    rtems
Branch:    master
Commit:    7f7424329eafab755381bc638c2cdddc152a909b
Changeset: http://git.rtems.org/rtems/commit/?id=7f7424329eafab755381bc638c2cdddc152a909b

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Oct 31 08:22:02 2016 +0100

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(-)

diff --git a/cpukit/score/include/rtems/score/coremuteximpl.h b/cpukit/score/include/rtems/score/coremuteximpl.h
index 2580606..5078c26 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 4b4e8c3..9555197 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 aaa28e0..acd5ba2 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 bfd7650..9926684 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 76cc333..37b9788 100644
--- a/cpukit/score/include/rtems/score/thread.h
+++ b/cpukit/score/include/rtems/score/thread.h
@@ -269,14 +269,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.
    */
   struct Per_CPU_Control *cpu;
diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index 00402b6..5bf4506 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 4fd4c02..102c9d1 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 37feb37..d34cb34 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 6ff5065..9b3a477 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 9ea82af..6c9ca98 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 db22efd..445fc4c 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 5cd9d43..08e3c80 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 );
 



More information about the vc mailing list