summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-07-01 14:47:07 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-07-01 14:47:07 +0200
commitdf2177ab5ea1c5b183513cdcac729af9c4040110 (patch)
treec313d341042ae07b605a08055e1cd447619f38d0 /cpukit/score/src
parentscore: Fix MPCI message layout (diff)
downloadrtems-df2177ab5ea1c5b183513cdcac729af9c4040110.tar.bz2
score: Change scheduler node init and destroy
Provide the scheduler node to initialize or destroy to the corresponding operations. This makes it possible to have more than one scheduler node per thread.
Diffstat (limited to 'cpukit/score/src')
-rw-r--r--cpukit/score/src/schedulercbsnodeinit.c9
-rw-r--r--cpukit/score/src/schedulerdefaultnodedestroy.c4
-rw-r--r--cpukit/score/src/schedulerdefaultnodeinit.c3
-rw-r--r--cpukit/score/src/scheduleredfnodeinit.c8
-rw-r--r--cpukit/score/src/schedulerpriority.c11
-rw-r--r--cpukit/score/src/schedulerpriorityaffinitysmp.c20
-rw-r--r--cpukit/score/src/schedulerprioritysmp.c13
-rw-r--r--cpukit/score/src/schedulersimplesmp.c13
-rw-r--r--cpukit/score/src/schedulerstrongapa.c13
-rw-r--r--cpukit/score/src/threadinitialize.c9
-rw-r--r--cpukit/score/src/threadrestart.c5
11 files changed, 55 insertions, 53 deletions
diff --git a/cpukit/score/src/schedulercbsnodeinit.c b/cpukit/score/src/schedulercbsnodeinit.c
index 3aa825bd12..53800693c0 100644
--- a/cpukit/score/src/schedulercbsnodeinit.c
+++ b/cpukit/score/src/schedulercbsnodeinit.c
@@ -22,14 +22,15 @@
void _Scheduler_CBS_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
)
{
- Scheduler_CBS_Node *node;
+ Scheduler_CBS_Node *the_node;
- _Scheduler_EDF_Node_initialize( scheduler, the_thread, priority );
+ _Scheduler_EDF_Node_initialize( scheduler, node, the_thread, priority );
- node = _Scheduler_CBS_Thread_get_node( the_thread );
- node->cbs_server = NULL;
+ the_node = _Scheduler_CBS_Node_downcast( node );
+ the_node->cbs_server = NULL;
}
diff --git a/cpukit/score/src/schedulerdefaultnodedestroy.c b/cpukit/score/src/schedulerdefaultnodedestroy.c
index d1d84f366a..537c824558 100644
--- a/cpukit/score/src/schedulerdefaultnodedestroy.c
+++ b/cpukit/score/src/schedulerdefaultnodedestroy.c
@@ -23,9 +23,9 @@
void _Scheduler_default_Node_destroy(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Scheduler_Node *node
)
{
(void) scheduler;
- (void) the_thread;
+ (void) node;
}
diff --git a/cpukit/score/src/schedulerdefaultnodeinit.c b/cpukit/score/src/schedulerdefaultnodeinit.c
index de2b6c8dd3..10e71f8a05 100644
--- a/cpukit/score/src/schedulerdefaultnodeinit.c
+++ b/cpukit/score/src/schedulerdefaultnodeinit.c
@@ -23,12 +23,11 @@
void _Scheduler_default_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
)
{
- Scheduler_Node *node = _Scheduler_Thread_get_own_node( the_thread );
-
(void) scheduler;
_Scheduler_Node_do_initialize( node, the_thread, priority );
diff --git a/cpukit/score/src/scheduleredfnodeinit.c b/cpukit/score/src/scheduleredfnodeinit.c
index 6005fa0538..bde25c18d7 100644
--- a/cpukit/score/src/scheduleredfnodeinit.c
+++ b/cpukit/score/src/scheduleredfnodeinit.c
@@ -22,15 +22,17 @@
void _Scheduler_EDF_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
)
{
- Scheduler_EDF_Node *node = _Scheduler_EDF_Thread_get_node( the_thread );
+ Scheduler_EDF_Node *the_node;
(void) scheduler;
- _Scheduler_Node_do_initialize( &node->Base, the_thread, priority );
+ _Scheduler_Node_do_initialize( node, the_thread, priority );
- node->thread = the_thread;
+ the_node = _Scheduler_EDF_Node_downcast( node );
+ the_node->thread = the_thread;
}
diff --git a/cpukit/score/src/schedulerpriority.c b/cpukit/score/src/schedulerpriority.c
index 2719697ba3..11cee92424 100644
--- a/cpukit/score/src/schedulerpriority.c
+++ b/cpukit/score/src/schedulerpriority.c
@@ -35,19 +35,20 @@ void _Scheduler_priority_Initialize( const Scheduler_Control *scheduler )
void _Scheduler_priority_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
)
{
Scheduler_priority_Context *context;
- Scheduler_priority_Node *node;
+ Scheduler_priority_Node *the_node;
- context = _Scheduler_priority_Get_context( scheduler );
- node = _Scheduler_priority_Thread_get_node( the_thread );
+ _Scheduler_Node_do_initialize( node, the_thread, priority );
- _Scheduler_Node_do_initialize( &node->Base, the_thread, priority );
+ context = _Scheduler_priority_Get_context( scheduler );
+ the_node = _Scheduler_priority_Node_downcast( node );
_Scheduler_priority_Ready_queue_update(
- &node->Ready_queue,
+ &the_node->Ready_queue,
priority,
&context->Bit_map,
&context->Ready[ 0 ]
diff --git a/cpukit/score/src/schedulerpriorityaffinitysmp.c b/cpukit/score/src/schedulerpriorityaffinitysmp.c
index cec09729fb..e171d5e5c7 100644
--- a/cpukit/score/src/schedulerpriorityaffinitysmp.c
+++ b/cpukit/score/src/schedulerpriorityaffinitysmp.c
@@ -60,15 +60,6 @@ static bool _Scheduler_priority_affinity_SMP_Insert_priority_fifo_order(
&& _Scheduler_SMP_Insert_priority_fifo_order( to_insert, next );
}
-static Scheduler_priority_affinity_SMP_Node *
-_Scheduler_priority_affinity_SMP_Thread_get_own_node(
- Thread_Control *thread
-)
-{
- return (Scheduler_priority_affinity_SMP_Node *)
- _Scheduler_Thread_get_own_node( thread );
-}
-
/*
* This method returns the scheduler node for the specified thread
* as a scheduler specific type.
@@ -96,20 +87,21 @@ _Scheduler_priority_affinity_SMP_Node_downcast(
*/
void _Scheduler_priority_affinity_SMP_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
)
{
- Scheduler_priority_affinity_SMP_Node *node =
- _Scheduler_priority_affinity_SMP_Thread_get_own_node( the_thread );
+ Scheduler_priority_affinity_SMP_Node *the_node;
- _Scheduler_priority_SMP_Node_initialize( scheduler, the_thread, priority );
+ _Scheduler_priority_SMP_Node_initialize( scheduler, node, the_thread, priority );
/*
* All we add is affinity information to the basic SMP node.
*/
- node->Affinity = *_CPU_set_Default();
- node->Affinity.set = &node->Affinity.preallocated;
+ the_node = _Scheduler_priority_affinity_SMP_Node_downcast( node );
+ the_node->Affinity = *_CPU_set_Default();
+ the_node->Affinity.set = &the_node->Affinity.preallocated;
}
/*
diff --git a/cpukit/score/src/schedulerprioritysmp.c b/cpukit/score/src/schedulerprioritysmp.c
index aba863e66a..07e7af4268 100644
--- a/cpukit/score/src/schedulerprioritysmp.c
+++ b/cpukit/score/src/schedulerprioritysmp.c
@@ -47,23 +47,22 @@ void _Scheduler_priority_SMP_Initialize( const Scheduler_Control *scheduler )
void _Scheduler_priority_SMP_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
)
{
Scheduler_Context *context;
Scheduler_priority_SMP_Context *self;
- Scheduler_priority_SMP_Node *node;
+ Scheduler_priority_SMP_Node *the_node;
+
+ the_node = _Scheduler_priority_SMP_Node_downcast( node );
+ _Scheduler_SMP_Node_initialize( &the_node->Base, the_thread, priority );
context = _Scheduler_Get_context( scheduler );
self = _Scheduler_priority_SMP_Get_self( context );
- node = _Scheduler_priority_SMP_Node_downcast(
- _Scheduler_Thread_get_own_node( the_thread )
- );
-
- _Scheduler_SMP_Node_initialize( &node->Base, the_thread, priority );
_Scheduler_priority_Ready_queue_update(
- &node->Ready_queue,
+ &the_node->Ready_queue,
priority,
&self->Bit_map,
&self->Ready[ 0 ]
diff --git a/cpukit/score/src/schedulersimplesmp.c b/cpukit/score/src/schedulersimplesmp.c
index f368ead556..8f86ea87da 100644
--- a/cpukit/score/src/schedulersimplesmp.c
+++ b/cpukit/score/src/schedulersimplesmp.c
@@ -44,26 +44,29 @@ void _Scheduler_simple_SMP_Initialize( const Scheduler_Control *scheduler )
void _Scheduler_simple_SMP_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
)
{
- Scheduler_SMP_Node *node = _Scheduler_SMP_Thread_get_own_node( the_thread );
+ Scheduler_SMP_Node *the_node;
- _Scheduler_SMP_Node_initialize( node, the_thread, priority );
+ the_node = _Scheduler_SMP_Node_downcast( node );
+ _Scheduler_SMP_Node_initialize( the_node, the_thread, priority );
}
static void _Scheduler_simple_SMP_Do_update(
Scheduler_Context *context,
- Scheduler_Node *node_to_update,
+ Scheduler_Node *node,
Priority_Control new_priority
)
{
- Scheduler_SMP_Node *node = _Scheduler_SMP_Node_downcast( node_to_update );
+ Scheduler_SMP_Node *the_node;
(void) context;
- _Scheduler_SMP_Node_update_priority( node, new_priority );
+ the_node = _Scheduler_SMP_Node_downcast( node );
+ _Scheduler_SMP_Node_update_priority( the_node, new_priority );
}
static Scheduler_Node *_Scheduler_simple_SMP_Get_highest_ready(
diff --git a/cpukit/score/src/schedulerstrongapa.c b/cpukit/score/src/schedulerstrongapa.c
index 14c238e550..5d7c7f7a1d 100644
--- a/cpukit/score/src/schedulerstrongapa.c
+++ b/cpukit/score/src/schedulerstrongapa.c
@@ -173,23 +173,22 @@ void _Scheduler_strong_APA_Initialize( const Scheduler_Control *scheduler )
void _Scheduler_strong_APA_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
)
{
Scheduler_Context *context;
Scheduler_strong_APA_Context *self;
- Scheduler_strong_APA_Node *node;
+ Scheduler_strong_APA_Node *the_node;
+
+ the_node = _Scheduler_strong_APA_Node_downcast( node );
+ _Scheduler_SMP_Node_initialize( &the_node->Base, the_thread, priority );
context = _Scheduler_Get_context( scheduler );
self = _Scheduler_strong_APA_Get_self( context );
- node = _Scheduler_strong_APA_Node_downcast(
- _Scheduler_Thread_get_own_node( the_thread )
- );
-
- _Scheduler_SMP_Node_initialize( &node->Base, the_thread, priority );
_Scheduler_priority_Ready_queue_update(
- &node->Ready_queue,
+ &the_node->Ready_queue,
priority,
&self->Bit_map,
&self->Ready[ 0 ]
diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c
index 7237cfeb75..940537f135 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -52,6 +52,7 @@ bool _Thread_Initialize(
#endif
bool extension_status;
size_t i;
+ Scheduler_Node *scheduler_node;
bool scheduler_node_initialized = false;
Per_CPU_Control *cpu = _Per_CPU_Get_by_index( 0 );
@@ -173,11 +174,13 @@ bool _Thread_Initialize(
#endif
}
+ scheduler_node = the_thread->Scheduler.node;
+
#if defined(RTEMS_SMP)
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 = the_thread->Scheduler.node;
+ the_thread->Scheduler.own_node = scheduler_node;
_Resource_Node_initialize( &the_thread->Resource_node );
_Atomic_Store_uintptr(
&the_thread->Lock.current.atomic,
@@ -204,7 +207,7 @@ bool _Thread_Initialize(
RTEMS_STATIC_ASSERT( THREAD_WAIT_FLAGS_INITIAL == 0, Wait_flags );
- _Scheduler_Node_initialize( scheduler, the_thread, priority );
+ _Scheduler_Node_initialize( scheduler, scheduler_node, the_thread, priority );
scheduler_node_initialized = true;
/* POSIX Keys */
@@ -232,7 +235,7 @@ bool _Thread_Initialize(
failed:
if ( scheduler_node_initialized ) {
- _Scheduler_Node_destroy( scheduler, the_thread );
+ _Scheduler_Node_destroy( scheduler, scheduler_node );
}
_Workspace_Free( the_thread->Start.tls_area );
diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c
index 32ecfba65d..b43c019b69 100644
--- a/cpukit/score/src/threadrestart.c
+++ b/cpukit/score/src/threadrestart.c
@@ -183,7 +183,10 @@ static void _Thread_Free( Thread_Control *the_thread )
_User_extensions_Thread_delete( the_thread );
_User_extensions_Destroy_iterators( the_thread );
_ISR_lock_Destroy( &the_thread->Keys.Lock );
- _Scheduler_Node_destroy( _Scheduler_Get( the_thread ), the_thread );
+ _Scheduler_Node_destroy(
+ _Scheduler_Get( the_thread ),
+ _Scheduler_Thread_get_own_node( the_thread )
+ );
_ISR_lock_Destroy( &the_thread->Timer.Lock );
/*