score: Manage scheduler nodes via thread queues

Update #2556.
This commit is contained in:
Sebastian Huber
2016-09-21 08:59:32 +02:00
parent 5d6b211981
commit 266d3835d8
5 changed files with 33 additions and 0 deletions
@@ -1423,6 +1423,13 @@ RTEMS_INLINE_ROUTINE Status_Control _Scheduler_Set(
);
#if defined(RTEMS_SMP)
_Chain_Extract_unprotected( &old_scheduler_node->Thread.Wait_node );
_Assert( _Chain_Is_empty( &the_thread->Scheduler.Wait_nodes ) );
_Chain_Initialize_one(
&the_thread->Scheduler.Wait_nodes,
&new_scheduler_node->Thread.Wait_node
);
{
const Scheduler_Control *old_scheduler;
@@ -138,6 +138,18 @@ typedef struct Scheduler_Node {
* not SCHEDULER_HELP_YOURSELF.
*/
struct _Thread_Control *accepts_help;
/**
* @brief Block to register and manage this scheduler node in the thread
* control block of the owner of this scheduler node.
*/
struct {
/**
* @brief Node to add this scheduler node to
* Thread_Control::Scheduler::Wait_nodes.
*/
Chain_Node Wait_node;
} Thread;
#endif
/**
@@ -42,6 +42,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Node_do_initialize(
node->Priority.prepend_it = false;
#if defined(RTEMS_SMP)
_Chain_Initialize_node( &node->Thread.Wait_node );
node->Wait.Priority.scheduler = scheduler;
node->user = the_thread;
node->help_state = SCHEDULER_HELP_YOURSELF;
@@ -287,6 +287,14 @@ typedef struct {
* @brief The processor assigned by the current scheduler.
*/
struct Per_CPU_Control *cpu;
/**
* @brief Scheduler nodes immediately available to the thread by its home
* scheduler instance and due to thread queue ownerships.
*
* This chain is protected by the thread wait lock.
*/
Chain_Control Wait_nodes;
#endif
/**
+5
View File
@@ -205,6 +205,11 @@ bool _Thread_Initialize(
++scheduler_for_index;
++scheduler_index;
}
_Chain_Initialize_one(
&the_thread->Scheduler.Wait_nodes,
&scheduler_node->Thread.Wait_node
);
#else
scheduler_node = _Thread_Scheduler_get_own_node( the_thread );
_Scheduler_Node_initialize(