[PATCH v2 10/15] score: Add scheduler node to set affinity op

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Jul 7 13:54:47 UTC 2017


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 5f3fb01206..a2a72b037c 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 49aaf029e1..cb9fd7e841 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 d53f76b090..e5eb916133 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 940d0939dc..bd8fc95099 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 6cc480d5c4..99938cdc56 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 93ed851b9e..3d354800b2 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
-- 
2.12.3




More information about the devel mailing list