[rtems commit] score: Add scheduler node to set affinity op

Sebastian Huber sebh at rtems.org
Mon Jul 10 07:38:58 UTC 2017


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Jul  5 15:14:26 2017 +0200

score: Add scheduler node to set affinity op

Update #3059.

---

 cpukit/score/include/rtems/score/scheduler.h             |  3 +++
 cpukit/score/include/rtems/score/schedulerimpl.h         |  2 ++
 .../include/rtems/score/schedulerpriorityaffinitysmp.h   |  1 +
 cpukit/score/src/schedulerdefaultsetaffinity.c           |  2 ++
 cpukit/score/src/schedulerpriorityaffinitysmp.c          | 16 ++--------------
 cpukit/score/src/schedulersetaffinity.c                  |  4 ++++
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
index 5f3fb01..a2a72b0 100644
--- a/cpukit/score/include/rtems/score/scheduler.h
+++ b/cpukit/score/include/rtems/score/scheduler.h
@@ -207,6 +207,7 @@ typedef struct {
   bool ( *set_affinity )(
     const Scheduler_Control *,
     Thread_Control *,
+    Scheduler_Node *,
     const Processor_mask *
   );
 #endif
@@ -510,6 +511,7 @@ void _Scheduler_default_Start_idle(
    *
    * @param[in] scheduler The scheduler instance.
    * @param[in] thread The associated thread.
+   * @param[in] node The home scheduler node of the associated thread.
    * @param[in] affinity The new processor affinity set for the thread.
    *
    * @retval true The processor set of the scheduler is a subset of the affinity set.
@@ -518,6 +520,7 @@ void _Scheduler_default_Start_idle(
   bool _Scheduler_default_Set_affinity(
     const Scheduler_Control *scheduler,
     Thread_Control          *thread,
+    Scheduler_Node          *node,
     const Processor_mask    *affinity
   );
 
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index 49aaf02..cb9fd7e 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -609,11 +609,13 @@ bool _Scheduler_Get_affinity(
 RTEMS_INLINE_ROUTINE bool _Scheduler_default_Set_affinity_body(
   const Scheduler_Control *scheduler,
   Thread_Control          *the_thread,
+  Scheduler_Node          *node,
   const Processor_mask    *affinity
 )
 {
   (void) scheduler;
   (void) the_thread;
+  (void) node;
   return _Processor_mask_Is_subset( affinity, _SMP_Get_online_processors() );
 }
 
diff --git a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
index d53f76b..e5eb916 100644
--- a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
@@ -149,6 +149,7 @@ Thread_Control *_Scheduler_priority_affinity_SMP_Remove_processor(
 bool _Scheduler_priority_affinity_SMP_Set_affinity(
   const Scheduler_Control *scheduler,
   Thread_Control          *thread,
+  Scheduler_Node          *node,
   const Processor_mask    *affinity
 );
 
diff --git a/cpukit/score/src/schedulerdefaultsetaffinity.c b/cpukit/score/src/schedulerdefaultsetaffinity.c
index 940d093..bd8fc95 100644
--- a/cpukit/score/src/schedulerdefaultsetaffinity.c
+++ b/cpukit/score/src/schedulerdefaultsetaffinity.c
@@ -24,12 +24,14 @@
 bool _Scheduler_default_Set_affinity(
   const Scheduler_Control *scheduler,
   Thread_Control          *thread,
+  Scheduler_Node          *node,
   const Processor_mask    *affinity
 )
 {
   return _Scheduler_default_Set_affinity_body(
     scheduler,
     thread,
+    node,
     affinity
   );
 }
diff --git a/cpukit/score/src/schedulerpriorityaffinitysmp.c b/cpukit/score/src/schedulerpriorityaffinitysmp.c
index 6cc480d..99938cd 100644
--- a/cpukit/score/src/schedulerpriorityaffinitysmp.c
+++ b/cpukit/score/src/schedulerpriorityaffinitysmp.c
@@ -60,19 +60,6 @@ static bool _Scheduler_priority_affinity_SMP_Insert_priority_fifo_order(
     && _Scheduler_SMP_Insert_priority_fifo_order( to_insert, next );
 }
 
-/*
- * This method returns the scheduler node for the specified thread
- * as a scheduler specific type.
- */
-static Scheduler_priority_affinity_SMP_Node *
-_Scheduler_priority_affinity_SMP_Thread_get_node(
-  Thread_Control *thread
-)
-{
-  return (Scheduler_priority_affinity_SMP_Node *)
-    _Thread_Scheduler_get_home_node( thread );
-}
-
 static Scheduler_priority_affinity_SMP_Node *
 _Scheduler_priority_affinity_SMP_Node_downcast(
   Scheduler_Node *node
@@ -614,6 +601,7 @@ Thread_Control *_Scheduler_priority_affinity_SMP_Remove_processor(
 bool _Scheduler_priority_affinity_SMP_Set_affinity(
   const Scheduler_Control *scheduler,
   Thread_Control          *thread,
+  Scheduler_Node          *node_base,
   const Processor_mask    *affinity
 )
 {
@@ -631,7 +619,7 @@ bool _Scheduler_priority_affinity_SMP_Set_affinity(
     return false;
   }
 
-  node = _Scheduler_priority_affinity_SMP_Thread_get_node( thread );
+  node = _Scheduler_priority_affinity_SMP_Node_downcast( node_base );
 
   /*
    * The old and new set are the same, there is no point in
diff --git a/cpukit/score/src/schedulersetaffinity.c b/cpukit/score/src/schedulersetaffinity.c
index 93ed851..3d35480 100644
--- a/cpukit/score/src/schedulersetaffinity.c
+++ b/cpukit/score/src/schedulersetaffinity.c
@@ -27,6 +27,7 @@ bool _Scheduler_Set_affinity(
   Processor_mask             affinity;
   Processor_mask_Copy_status status;
   const Scheduler_Control   *scheduler;
+  Scheduler_Node            *node;
   ISR_lock_Context           lock_context;
   bool                       ok;
 
@@ -38,10 +39,12 @@ bool _Scheduler_Set_affinity(
   scheduler = _Thread_Scheduler_get_home( the_thread );
   _Scheduler_Acquire_critical( scheduler, &lock_context );
 
+  node = _Thread_Scheduler_get_home_node( the_thread );
 #if defined(RTEMS_SMP)
   ok = ( *scheduler->Operations.set_affinity )(
     scheduler,
     the_thread,
+    node,
     &affinity
   );
 
@@ -52,6 +55,7 @@ bool _Scheduler_Set_affinity(
   ok = _Scheduler_default_Set_affinity_body(
     scheduler,
     the_thread,
+    node,
     &affinity
   );
 #endif




More information about the vc mailing list