summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-10-10 14:33:17 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-02 10:05:41 +0100
commite382a1bfccdecf1dcf01c452ee0edb5afa0660b3 (patch)
tree901e36ea6fcacc997210cb13d19fd997ed15251d /cpukit/score/include
parentscore: Pass scheduler node to yield operation (diff)
downloadrtems-e382a1bfccdecf1dcf01c452ee0edb5afa0660b3.tar.bz2
score: Pass scheduler node to block operation
Changed for consistency with other scheduler operations. Update #2556.
Diffstat (limited to 'cpukit/score/include')
-rw-r--r--cpukit/score/include/rtems/score/scheduler.h3
-rw-r--r--cpukit/score/include/rtems/score/scheduleredf.h14
-rw-r--r--cpukit/score/include/rtems/score/scheduleredfimpl.h9
-rw-r--r--cpukit/score/include/rtems/score/schedulerimpl.h16
-rw-r--r--cpukit/score/include/rtems/score/schedulerpriority.h14
-rw-r--r--cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h11
-rw-r--r--cpukit/score/include/rtems/score/schedulerpriorityimpl.h13
-rw-r--r--cpukit/score/include/rtems/score/schedulerprioritysmp.h3
-rw-r--r--cpukit/score/include/rtems/score/schedulersimple.h14
-rw-r--r--cpukit/score/include/rtems/score/schedulersimpleimpl.h4
-rw-r--r--cpukit/score/include/rtems/score/schedulersimplesmp.h3
-rw-r--r--cpukit/score/include/rtems/score/schedulersmpimpl.h27
-rw-r--r--cpukit/score/include/rtems/score/schedulerstrongapa.h3
13 files changed, 60 insertions, 74 deletions
diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
index 745fbec621..eb8db7cbb3 100644
--- a/cpukit/score/include/rtems/score/scheduler.h
+++ b/cpukit/score/include/rtems/score/scheduler.h
@@ -72,7 +72,8 @@ typedef struct {
/** @see _Scheduler_Block() */
void ( *block )(
const Scheduler_Control *,
- Thread_Control *
+ Thread_Control *,
+ Scheduler_Node *
);
/** @see _Scheduler_Unblock() */
diff --git a/cpukit/score/include/rtems/score/scheduleredf.h b/cpukit/score/include/rtems/score/scheduleredf.h
index 005f2da5f0..2ecf1a4eb2 100644
--- a/cpukit/score/include/rtems/score/scheduleredf.h
+++ b/cpukit/score/include/rtems/score/scheduleredf.h
@@ -108,20 +108,10 @@ typedef struct {
*/
void _Scheduler_EDF_Initialize( const Scheduler_Control *scheduler );
-/**
- * @brief Removes thread from ready queue.
- *
- * This routine removes @a the_thread from the scheduling decision,
- * that is, removes it from the ready queue. It performs
- * any necessary scheduling operations including the selection of
- * a new heir thread.
- *
- * @param[in] scheduler The scheduler instance.
- * @param[in] the_thread is the thread to be blocked.
- */
void _Scheduler_EDF_Block(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Scheduler_Node *node
);
/**
diff --git a/cpukit/score/include/rtems/score/scheduleredfimpl.h b/cpukit/score/include/rtems/score/scheduleredfimpl.h
index 61aceddf19..bfb5b45875 100644
--- a/cpukit/score/include/rtems/score/scheduleredfimpl.h
+++ b/cpukit/score/include/rtems/score/scheduleredfimpl.h
@@ -136,16 +136,17 @@ RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Extract(
RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Extract_body(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Scheduler_Node *node
)
{
Scheduler_EDF_Context *context;
- Scheduler_EDF_Node *node;
+ Scheduler_EDF_Node *the_node;
context = _Scheduler_EDF_Get_context( scheduler );
- node = _Scheduler_EDF_Thread_get_node( the_thread );
+ the_node = _Scheduler_EDF_Node_downcast( node );
- _Scheduler_EDF_Extract( context, node );
+ _Scheduler_EDF_Extract( context, the_node );
}
RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Schedule_body(
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index a431a3af08..e630cc2e53 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -330,7 +330,11 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Block( Thread_Control *the_thread )
scheduler = _Scheduler_Get( the_thread );
_Scheduler_Acquire_critical( scheduler, &lock_context );
- ( *scheduler->Operations.block )( scheduler, the_thread );
+ ( *scheduler->Operations.block )(
+ scheduler,
+ the_thread,
+ _Thread_Scheduler_get_home_node( the_thread )
+ );
_Scheduler_Release_critical( scheduler, &lock_context );
}
@@ -708,16 +712,20 @@ bool _Scheduler_Set_affinity(
RTEMS_INLINE_ROUTINE void _Scheduler_Generic_block(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
+ Scheduler_Node *node,
void ( *extract )(
const Scheduler_Control *,
- Thread_Control * ),
+ Thread_Control *,
+ Scheduler_Node *
+ ),
void ( *schedule )(
const Scheduler_Control *,
Thread_Control *,
- bool )
+ bool
+ )
)
{
- ( *extract )( scheduler, the_thread );
+ ( *extract )( scheduler, the_thread, node );
/* TODO: flash critical section? */
diff --git a/cpukit/score/include/rtems/score/schedulerpriority.h b/cpukit/score/include/rtems/score/schedulerpriority.h
index 175def49a3..89912aac55 100644
--- a/cpukit/score/include/rtems/score/schedulerpriority.h
+++ b/cpukit/score/include/rtems/score/schedulerpriority.h
@@ -111,20 +111,10 @@ typedef struct {
*/
void _Scheduler_priority_Initialize( const Scheduler_Control *scheduler );
-/**
- * @brief Removes @a the_thread from the scheduling decision.
- *
- * This routine removes @a the_thread from the scheduling decision,
- * that is, removes it from the ready queue. It performs
- * any necessary scheduling operations including the selection of
- * a new heir thread.
- *
- * @param[in] scheduler The scheduler instance.
- * @param[in] the_thread is the thread to be blocked
- */
void _Scheduler_priority_Block(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Scheduler_Node *node
);
/**
diff --git a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
index be28deca28..bc3ea49d69 100644
--- a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
@@ -86,17 +86,10 @@ void _Scheduler_priority_affinity_SMP_Node_initialize(
Priority_Control priority
);
-/**
- * @brief SMP Priority Affinity Scheduler Block Operation
- *
- * This method is the block operation for this scheduler.
- *
- * @param[in] scheduler is the scheduler instance information
- * @param[in] thread is the thread to block
- */
void _Scheduler_priority_affinity_SMP_Block(
const Scheduler_Control *scheduler,
- Thread_Control *thread
+ Thread_Control *thread,
+ Scheduler_Node *node
);
/**
diff --git a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
index 38f9f5b53a..e9e987318c 100644
--- a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
@@ -140,16 +140,19 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_extract(
RTEMS_INLINE_ROUTINE void _Scheduler_priority_Extract_body(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Scheduler_Node *node
)
{
- Scheduler_priority_Context *context =
- _Scheduler_priority_Get_context( scheduler );
- Scheduler_priority_Node *node = _Scheduler_priority_Thread_get_node( the_thread );
+ Scheduler_priority_Context *context;
+ Scheduler_priority_Node *the_node;
+
+ context = _Scheduler_priority_Get_context( scheduler );
+ the_node = _Scheduler_priority_Node_downcast( node );
_Scheduler_priority_Ready_queue_extract(
&the_thread->Object.Node,
- &node->Ready_queue,
+ &the_node->Ready_queue,
&context->Bit_map
);
}
diff --git a/cpukit/score/include/rtems/score/schedulerprioritysmp.h b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
index 8350038d1c..de37d34d0e 100644
--- a/cpukit/score/include/rtems/score/schedulerprioritysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
@@ -107,7 +107,8 @@ void _Scheduler_priority_SMP_Node_initialize(
void _Scheduler_priority_SMP_Block(
const Scheduler_Control *scheduler,
- Thread_Control *thread
+ Thread_Control *thread,
+ Scheduler_Node *node
);
Thread_Control *_Scheduler_priority_SMP_Unblock(
diff --git a/cpukit/score/include/rtems/score/schedulersimple.h b/cpukit/score/include/rtems/score/schedulersimple.h
index d8bc02ed0d..4ef0db8d6f 100644
--- a/cpukit/score/include/rtems/score/schedulersimple.h
+++ b/cpukit/score/include/rtems/score/schedulersimple.h
@@ -98,20 +98,10 @@ Scheduler_Void_or_thread _Scheduler_simple_Yield(
Scheduler_Node *node
);
-/**
- * @brief Remove a simple-priority-based thread from the queue.
- *
- * This routine removes @a the_thread from the scheduling decision,
- * that is, removes it from the ready queue. It performs
- * any necessary scheduling operations including the selection of
- * a new heir thread.
- *
- * @param[in] scheduler The scheduler instance.
- * @param[in] the_thread is the thread that is to be blocked
- */
void _Scheduler_simple_Block(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Scheduler_Node *node
);
/**
diff --git a/cpukit/score/include/rtems/score/schedulersimpleimpl.h b/cpukit/score/include/rtems/score/schedulersimpleimpl.h
index 85951fa631..c94f9b3bdb 100644
--- a/cpukit/score/include/rtems/score/schedulersimpleimpl.h
+++ b/cpukit/score/include/rtems/score/schedulersimpleimpl.h
@@ -88,10 +88,12 @@ RTEMS_INLINE_ROUTINE void _Scheduler_simple_Insert_priority_fifo(
RTEMS_INLINE_ROUTINE void _Scheduler_simple_Extract(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Scheduler_Node *node
)
{
(void) scheduler;
+ (void) node;
_Chain_Extract_unprotected( &the_thread->Object.Node );
}
diff --git a/cpukit/score/include/rtems/score/schedulersimplesmp.h b/cpukit/score/include/rtems/score/schedulersimplesmp.h
index 36f5fb38c7..db36b84857 100644
--- a/cpukit/score/include/rtems/score/schedulersimplesmp.h
+++ b/cpukit/score/include/rtems/score/schedulersimplesmp.h
@@ -90,7 +90,8 @@ void _Scheduler_simple_SMP_Node_initialize(
void _Scheduler_simple_SMP_Block(
const Scheduler_Control *scheduler,
- Thread_Control *thread
+ Thread_Control *thread,
+ Scheduler_Node *node
);
Thread_Control *_Scheduler_simple_SMP_Unblock(
diff --git a/cpukit/score/include/rtems/score/schedulersmpimpl.h b/cpukit/score/include/rtems/score/schedulersmpimpl.h
index 6deb160405..f797735c76 100644
--- a/cpukit/score/include/rtems/score/schedulersmpimpl.h
+++ b/cpukit/score/include/rtems/score/schedulersmpimpl.h
@@ -868,6 +868,7 @@ static inline void _Scheduler_SMP_Schedule_highest_ready(
*
* @param[in] context The scheduler instance context.
* @param[in] thread The thread of the scheduling operation.
+ * @param[in] node The scheduler node of the thread to block.
* @param[in] extract_from_ready Function to extract a node from the set of
* ready nodes.
* @param[in] get_highest_ready Function to get the highest ready node.
@@ -877,41 +878,45 @@ static inline void _Scheduler_SMP_Schedule_highest_ready(
static inline void _Scheduler_SMP_Block(
Scheduler_Context *context,
Thread_Control *thread,
+ Scheduler_Node *node,
Scheduler_SMP_Extract extract_from_ready,
Scheduler_SMP_Get_highest_ready get_highest_ready,
Scheduler_SMP_Move move_from_ready_to_scheduled,
Scheduler_SMP_Allocate_processor allocate_processor
)
{
- Scheduler_SMP_Node *node = _Scheduler_SMP_Thread_get_node( thread );
- bool is_scheduled = node->state == SCHEDULER_SMP_NODE_SCHEDULED;
- bool block;
+ Scheduler_SMP_Node_state node_state;
+ bool block;
- _Assert( is_scheduled || node->state == SCHEDULER_SMP_NODE_READY );
+ node_state = _Scheduler_SMP_Node_state( node );
+ _Assert( node_state != SCHEDULER_SMP_NODE_BLOCKED );
block = _Scheduler_Block_node(
context,
thread,
- &node->Base,
- is_scheduled,
+ node,
+ node_state == SCHEDULER_SMP_NODE_SCHEDULED,
_Scheduler_SMP_Get_idle_thread
);
if ( block ) {
- _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_BLOCKED );
+ _Scheduler_SMP_Node_change_state(
+ _Scheduler_SMP_Node_downcast( node ),
+ SCHEDULER_SMP_NODE_BLOCKED
+ );
- if ( is_scheduled ) {
- _Scheduler_SMP_Extract_from_scheduled( &node->Base );
+ if ( node_state == SCHEDULER_SMP_NODE_SCHEDULED ) {
+ _Scheduler_SMP_Extract_from_scheduled( node );
_Scheduler_SMP_Schedule_highest_ready(
context,
- &node->Base,
+ node,
extract_from_ready,
get_highest_ready,
move_from_ready_to_scheduled,
allocate_processor
);
} else {
- ( *extract_from_ready )( context, &node->Base );
+ ( *extract_from_ready )( context, node );
}
}
}
diff --git a/cpukit/score/include/rtems/score/schedulerstrongapa.h b/cpukit/score/include/rtems/score/schedulerstrongapa.h
index aa352e2964..a83616cdfc 100644
--- a/cpukit/score/include/rtems/score/schedulerstrongapa.h
+++ b/cpukit/score/include/rtems/score/schedulerstrongapa.h
@@ -107,7 +107,8 @@ void _Scheduler_strong_APA_Node_initialize(
void _Scheduler_strong_APA_Block(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Scheduler_Node *node
);
Thread_Control *_Scheduler_strong_APA_Unblock(