summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-09-08 14:07:12 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-09-21 08:59:32 +0200
commit266d3835d883f908c0e4cbf547359d683f72dcc4 (patch)
treeab1cfe81a9574d984d39c1d27d88d3032c31a594
parentscore: Add scheduler node table for each thread (diff)
downloadrtems-266d3835d883f908c0e4cbf547359d683f72dcc4.tar.bz2
score: Manage scheduler nodes via thread queues
Update #2556.
-rw-r--r--cpukit/score/include/rtems/score/schedulerimpl.h7
-rw-r--r--cpukit/score/include/rtems/score/schedulernode.h12
-rw-r--r--cpukit/score/include/rtems/score/schedulernodeimpl.h1
-rw-r--r--cpukit/score/include/rtems/score/thread.h8
-rw-r--r--cpukit/score/src/threadinitialize.c5
5 files changed, 33 insertions, 0 deletions
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index 2fdc01a695..7ac8964909 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -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;
diff --git a/cpukit/score/include/rtems/score/schedulernode.h b/cpukit/score/include/rtems/score/schedulernode.h
index 2954db5350..8d00a43d31 100644
--- a/cpukit/score/include/rtems/score/schedulernode.h
+++ b/cpukit/score/include/rtems/score/schedulernode.h
@@ -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
/**
diff --git a/cpukit/score/include/rtems/score/schedulernodeimpl.h b/cpukit/score/include/rtems/score/schedulernodeimpl.h
index b0f7d77bbe..cf096aae13 100644
--- a/cpukit/score/include/rtems/score/schedulernodeimpl.h
+++ b/cpukit/score/include/rtems/score/schedulernodeimpl.h
@@ -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;
diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
index 17aeacde29..a86d81b4e2 100644
--- a/cpukit/score/include/rtems/score/thread.h
+++ b/cpukit/score/include/rtems/score/thread.h
@@ -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
/**
diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c
index 590d7be995..84d262756c 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -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(