score: Simplify yield and unblock scheduler ops

Update #2556.
This commit is contained in:
Sebastian Huber
2016-11-02 10:05:45 +01:00
parent 2dd098a635
commit 63e2ca1b8b
23 changed files with 141 additions and 195 deletions
+6 -6
View File
@@ -43,13 +43,13 @@ struct Per_CPU_Control;
typedef struct Scheduler_Control Scheduler_Control;
#if defined(RTEMS_SMP)
typedef Thread_Control * Scheduler_Void_or_thread;
typedef bool Scheduler_Void_or_bool;
#define SCHEDULER_RETURN_VOID_OR_NULL return NULL
#define SCHEDULER_RETURN_VOID_OR_BOOL return false
#else
typedef void Scheduler_Void_or_thread;
typedef void Scheduler_Void_or_bool;
#define SCHEDULER_RETURN_VOID_OR_NULL return
#define SCHEDULER_RETURN_VOID_OR_BOOL return
#endif
/**
@@ -63,7 +63,7 @@ typedef struct {
void ( *schedule )( const Scheduler_Control *, Thread_Control *);
/** @see _Scheduler_Yield() */
Scheduler_Void_or_thread ( *yield )(
Scheduler_Void_or_bool ( *yield )(
const Scheduler_Control *,
Thread_Control *,
Scheduler_Node *
@@ -77,7 +77,7 @@ typedef struct {
);
/** @see _Scheduler_Unblock() */
Scheduler_Void_or_thread ( *unblock )(
Scheduler_Void_or_bool ( *unblock )(
const Scheduler_Control *,
Thread_Control *,
Scheduler_Node *
@@ -146,7 +146,7 @@ typedef struct {
*/
extern Scheduler_CBS_Server _Scheduler_CBS_Server_list[];
Scheduler_Void_or_thread _Scheduler_CBS_Unblock(
Scheduler_Void_or_bool _Scheduler_CBS_Unblock(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
Scheduler_Node *node
@@ -144,7 +144,7 @@ void _Scheduler_EDF_Node_initialize(
Priority_Control priority
);
Scheduler_Void_or_thread _Scheduler_EDF_Unblock(
Scheduler_Void_or_bool _Scheduler_EDF_Unblock(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
Scheduler_Node *node
@@ -166,7 +166,7 @@ Priority_Control _Scheduler_EDF_Unmap_priority(
Priority_Control priority
);
Scheduler_Void_or_thread _Scheduler_EDF_Yield(
Scheduler_Void_or_bool _Scheduler_EDF_Yield(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
Scheduler_Node *node
@@ -175,7 +175,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Yield( Thread_Control *the_thread )
Scheduler_Node *scheduler_node;
const Scheduler_Control *scheduler;
ISR_lock_Context lock_context;
Thread_Control *needs_help;
bool needs_help;
node = _Chain_First( &the_thread->Scheduler.Scheduler_nodes );
tail = _Chain_Immutable_tail( &the_thread->Scheduler.Scheduler_nodes );
@@ -191,7 +191,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Yield( Thread_Control *the_thread )
);
_Scheduler_Release_critical( scheduler, &lock_context );
if ( needs_help != the_thread ) {
if ( !needs_help ) {
return;
}
@@ -309,7 +309,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Unblock( Thread_Control *the_thread )
Scheduler_Node *scheduler_node;
const Scheduler_Control *scheduler;
ISR_lock_Context lock_context;
Thread_Control *needs_help;
bool needs_help;
node = _Chain_First( &the_thread->Scheduler.Scheduler_nodes );
tail = _Chain_Immutable_tail( &the_thread->Scheduler.Scheduler_nodes );
@@ -325,7 +325,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Unblock( Thread_Control *the_thread )
);
_Scheduler_Release_critical( scheduler, &lock_context );
if ( needs_help != the_thread ) {
if ( !needs_help ) {
return;
}
@@ -128,7 +128,7 @@ void _Scheduler_priority_Schedule(
Thread_Control *the_thread
);
Scheduler_Void_or_thread _Scheduler_priority_Unblock(
Scheduler_Void_or_bool _Scheduler_priority_Unblock(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
Scheduler_Node *node
@@ -147,7 +147,7 @@ void _Scheduler_priority_Node_initialize(
Priority_Control priority
);
Scheduler_Void_or_thread _Scheduler_priority_Yield(
Scheduler_Void_or_bool _Scheduler_priority_Yield(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
Scheduler_Node *node
@@ -94,7 +94,7 @@ void _Scheduler_priority_affinity_SMP_Block(
Scheduler_Node *node
);
Thread_Control *_Scheduler_priority_affinity_SMP_Unblock(
bool _Scheduler_priority_affinity_SMP_Unblock(
const Scheduler_Control *scheduler,
Thread_Control *thread,
Scheduler_Node *node
@@ -113,7 +113,7 @@ void _Scheduler_priority_SMP_Block(
Scheduler_Node *node
);
Thread_Control *_Scheduler_priority_SMP_Unblock(
bool _Scheduler_priority_SMP_Unblock(
const Scheduler_Control *scheduler,
Thread_Control *thread,
Scheduler_Node *node
@@ -144,7 +144,7 @@ void _Scheduler_priority_SMP_Withdraw_node(
Thread_Scheduler_state next_state
);
Thread_Control *_Scheduler_priority_SMP_Yield(
bool _Scheduler_priority_SMP_Yield(
const Scheduler_Control *scheduler,
Thread_Control *thread,
Scheduler_Node *node
@@ -92,7 +92,7 @@ void _Scheduler_simple_Schedule(
Thread_Control *the_thread
);
Scheduler_Void_or_thread _Scheduler_simple_Yield(
Scheduler_Void_or_bool _Scheduler_simple_Yield(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
Scheduler_Node *node
@@ -104,7 +104,7 @@ void _Scheduler_simple_Block(
Scheduler_Node *node
);
Scheduler_Void_or_thread _Scheduler_simple_Unblock(
Scheduler_Void_or_bool _Scheduler_simple_Unblock(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
Scheduler_Node *node
@@ -96,7 +96,7 @@ void _Scheduler_simple_SMP_Block(
Scheduler_Node *node
);
Thread_Control *_Scheduler_simple_SMP_Unblock(
bool _Scheduler_simple_SMP_Unblock(
const Scheduler_Control *scheduler,
Thread_Control *thread,
Scheduler_Node *node
@@ -127,7 +127,7 @@ void _Scheduler_simple_SMP_Withdraw_node(
Thread_Scheduler_state next_state
);
Thread_Control *_Scheduler_simple_SMP_Yield(
bool _Scheduler_simple_SMP_Yield(
const Scheduler_Control *scheduler,
Thread_Control *thread,
Scheduler_Node *node
@@ -313,13 +313,7 @@ typedef void ( *Scheduler_SMP_Update )(
Priority_Control new_priority
);
typedef Thread_Control *( *Scheduler_SMP_Enqueue )(
Scheduler_Context *context,
Scheduler_Node *node_to_enqueue,
Thread_Control *needs_help
);
typedef Thread_Control *( *Scheduler_SMP_Enqueue_scheduled )(
typedef bool ( *Scheduler_SMP_Enqueue )(
Scheduler_Context *context,
Scheduler_Node *node_to_enqueue
);
@@ -617,7 +611,7 @@ static inline Scheduler_Node *_Scheduler_SMP_Get_lowest_scheduled(
return lowest_scheduled;
}
static inline Thread_Control *_Scheduler_SMP_Enqueue_to_scheduled(
static inline void _Scheduler_SMP_Enqueue_to_scheduled(
Scheduler_Context *context,
Scheduler_Node *node,
Scheduler_Node *lowest_scheduled,
@@ -626,7 +620,6 @@ static inline Thread_Control *_Scheduler_SMP_Enqueue_to_scheduled(
Scheduler_SMP_Allocate_processor allocate_processor
)
{
Thread_Control *needs_help;
Scheduler_Try_to_schedule_action action;
action = _Scheduler_Try_to_schedule_node(
@@ -637,10 +630,7 @@ static inline Thread_Control *_Scheduler_SMP_Enqueue_to_scheduled(
);
if ( action == SCHEDULER_TRY_TO_SCHEDULE_DO_SCHEDULE ) {
Thread_Control *lowest_scheduled_user;
Thread_Control *idle;
lowest_scheduled_user = _Scheduler_SMP_Preempt(
_Scheduler_SMP_Preempt(
context,
node,
lowest_scheduled,
@@ -650,16 +640,11 @@ static inline Thread_Control *_Scheduler_SMP_Enqueue_to_scheduled(
( *insert_scheduled )( context, node );
( *move_from_scheduled_to_ready )( context, lowest_scheduled );
idle = _Scheduler_Release_idle_thread(
_Scheduler_Release_idle_thread(
context,
lowest_scheduled,
_Scheduler_SMP_Release_idle_thread
);
if ( idle == NULL ) {
needs_help = lowest_scheduled_user;
} else {
needs_help = NULL;
}
} else if ( action == SCHEDULER_TRY_TO_SCHEDULE_DO_IDLE_EXCHANGE ) {
_Scheduler_SMP_Node_change_state(
lowest_scheduled,
@@ -675,15 +660,10 @@ static inline Thread_Control *_Scheduler_SMP_Enqueue_to_scheduled(
lowest_scheduled,
_Scheduler_Node_get_idle( lowest_scheduled )
);
needs_help = NULL;
} else {
_Assert( action == SCHEDULER_TRY_TO_SCHEDULE_DO_BLOCK );
_Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_BLOCKED );
needs_help = NULL;
}
return needs_help;
}
/**
@@ -693,8 +673,6 @@ static inline Thread_Control *_Scheduler_SMP_Enqueue_to_scheduled(
*
* @param[in] context The scheduler instance context.
* @param[in] node The node to enqueue.
* @param[in] needs_help The thread needing help in case the node cannot be
* scheduled.
* @param[in] order The order function.
* @param[in] insert_ready Function to insert a node into the set of ready
* nodes.
@@ -709,10 +687,9 @@ static inline Thread_Control *_Scheduler_SMP_Enqueue_to_scheduled(
* @param[in] allocate_processor Function to allocate a processor to a node
* based on the rules of the scheduler.
*/
static inline Thread_Control *_Scheduler_SMP_Enqueue_ordered(
static inline bool _Scheduler_SMP_Enqueue_ordered(
Scheduler_Context *context,
Scheduler_Node *node,
Thread_Control *needs_help,
Chain_Node_order order,
Scheduler_SMP_Insert insert_ready,
Scheduler_SMP_Insert insert_scheduled,
@@ -721,11 +698,13 @@ static inline Thread_Control *_Scheduler_SMP_Enqueue_ordered(
Scheduler_SMP_Allocate_processor allocate_processor
)
{
Scheduler_Node *lowest_scheduled =
( *get_lowest_scheduled )( context, node, order );
bool needs_help;
Scheduler_Node *lowest_scheduled;
lowest_scheduled = ( *get_lowest_scheduled )( context, node, order );
if ( ( *order )( &node->Node, &lowest_scheduled->Node ) ) {
needs_help = _Scheduler_SMP_Enqueue_to_scheduled(
_Scheduler_SMP_Enqueue_to_scheduled(
context,
node,
lowest_scheduled,
@@ -733,8 +712,10 @@ static inline Thread_Control *_Scheduler_SMP_Enqueue_ordered(
move_from_scheduled_to_ready,
allocate_processor
);
needs_help = false;
} else {
( *insert_ready )( context, node );
needs_help = true;
}
return needs_help;
@@ -759,7 +740,7 @@ static inline Thread_Control *_Scheduler_SMP_Enqueue_ordered(
* @param[in] allocate_processor Function to allocate a processor to a node
* based on the rules of the scheduler.
*/
static inline Thread_Control *_Scheduler_SMP_Enqueue_scheduled_ordered(
static inline bool _Scheduler_SMP_Enqueue_scheduled_ordered(
Scheduler_Context *context,
Scheduler_Node *node,
Chain_Node_order order,
@@ -811,7 +792,7 @@ static inline Thread_Control *_Scheduler_SMP_Enqueue_scheduled_ordered(
_Thread_Scheduler_release_critical( owner, &lock_context );
}
return NULL;
return false;
}
action = _Scheduler_Try_to_schedule_node(
@@ -822,10 +803,9 @@ static inline Thread_Control *_Scheduler_SMP_Enqueue_scheduled_ordered(
);
if ( action == SCHEDULER_TRY_TO_SCHEDULE_DO_SCHEDULE ) {
Thread_Control *user;
Thread_Control *idle;
user = _Scheduler_SMP_Preempt(
_Scheduler_SMP_Preempt(
context,
highest_ready,
node,
@@ -840,12 +820,7 @@ static inline Thread_Control *_Scheduler_SMP_Enqueue_scheduled_ordered(
node,
_Scheduler_SMP_Release_idle_thread
);
if ( idle == NULL ) {
return user;
} else {
return NULL;
}
return ( idle == NULL );
} else if ( action == SCHEDULER_TRY_TO_SCHEDULE_DO_IDLE_EXCHANGE ) {
_Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_READY );
_Scheduler_SMP_Node_change_state(
@@ -861,7 +836,7 @@ static inline Thread_Control *_Scheduler_SMP_Enqueue_scheduled_ordered(
node,
_Scheduler_Node_get_idle( node )
);
return NULL;
return false;
} else {
_Assert( action == SCHEDULER_TRY_TO_SCHEDULE_DO_BLOCK );
@@ -982,7 +957,7 @@ static inline void _Scheduler_SMP_Block(
}
}
static inline Thread_Control *_Scheduler_SMP_Unblock(
static inline bool _Scheduler_SMP_Unblock(
Scheduler_Context *context,
Thread_Control *thread,
Scheduler_Node *node,
@@ -992,7 +967,7 @@ static inline Thread_Control *_Scheduler_SMP_Unblock(
{
Scheduler_SMP_Node_state node_state;
bool unblock;
Thread_Control *needs_help;
bool needs_help;
node_state = _Scheduler_SMP_Node_state( node );
unblock = _Scheduler_Unblock_node(
@@ -1017,31 +992,31 @@ static inline Thread_Control *_Scheduler_SMP_Unblock(
if ( node_state == SCHEDULER_SMP_NODE_BLOCKED ) {
_Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_READY );
needs_help = ( *enqueue_fifo )( context, node, thread );
needs_help = ( *enqueue_fifo )( context, node );
} else {
_Assert( node_state == SCHEDULER_SMP_NODE_READY );
_Assert( node->sticky_level > 0 );
_Assert( node->idle == NULL );
needs_help = thread;
needs_help = true;
}
} else {
needs_help = NULL;
needs_help = false;
}
return needs_help;
}
static inline void _Scheduler_SMP_Update_priority(
Scheduler_Context *context,
Thread_Control *thread,
Scheduler_Node *node,
Scheduler_SMP_Extract extract_from_ready,
Scheduler_SMP_Update update,
Scheduler_SMP_Enqueue enqueue_fifo,
Scheduler_SMP_Enqueue enqueue_lifo,
Scheduler_SMP_Enqueue_scheduled enqueue_scheduled_fifo,
Scheduler_SMP_Enqueue_scheduled enqueue_scheduled_lifo,
Scheduler_SMP_Ask_for_help ask_for_help
Scheduler_Context *context,
Thread_Control *thread,
Scheduler_Node *node,
Scheduler_SMP_Extract extract_from_ready,
Scheduler_SMP_Update update,
Scheduler_SMP_Enqueue enqueue_fifo,
Scheduler_SMP_Enqueue enqueue_lifo,
Scheduler_SMP_Enqueue enqueue_scheduled_fifo,
Scheduler_SMP_Enqueue enqueue_scheduled_lifo,
Scheduler_SMP_Ask_for_help ask_for_help
)
{
Priority_Control new_priority;
@@ -1076,9 +1051,9 @@ static inline void _Scheduler_SMP_Update_priority(
( *update )( context, node, new_priority );
if ( prepend_it ) {
( *enqueue_lifo )( context, node, NULL );
( *enqueue_lifo )( context, node );
} else {
( *enqueue_fifo )( context, node, NULL );
( *enqueue_fifo )( context, node );
}
} else {
( *update )( context, node, new_priority );
@@ -1089,17 +1064,17 @@ static inline void _Scheduler_SMP_Update_priority(
}
}
static inline Thread_Control *_Scheduler_SMP_Yield(
Scheduler_Context *context,
Thread_Control *thread,
Scheduler_Node *node,
Scheduler_SMP_Extract extract_from_ready,
Scheduler_SMP_Enqueue enqueue_fifo,
Scheduler_SMP_Enqueue_scheduled enqueue_scheduled_fifo
static inline bool _Scheduler_SMP_Yield(
Scheduler_Context *context,
Thread_Control *thread,
Scheduler_Node *node,
Scheduler_SMP_Extract extract_from_ready,
Scheduler_SMP_Enqueue enqueue_fifo,
Scheduler_SMP_Enqueue enqueue_scheduled_fifo
)
{
Thread_Control *needs_help;
Scheduler_SMP_Node_state node_state;
bool needs_help;
Scheduler_SMP_Node_state node_state;
node_state = _Scheduler_SMP_Node_state( node );
@@ -1110,9 +1085,9 @@ static inline Thread_Control *_Scheduler_SMP_Yield(
} else if ( node_state == SCHEDULER_SMP_NODE_READY ) {
( *extract_from_ready )( context, node );
needs_help = ( *enqueue_fifo )( context, node, NULL );
needs_help = ( *enqueue_fifo )( context, node );
} else {
needs_help = thread;
needs_help = true;
}
return needs_help;
@@ -113,7 +113,7 @@ void _Scheduler_strong_APA_Block(
Scheduler_Node *node
);
Thread_Control *_Scheduler_strong_APA_Unblock(
bool _Scheduler_strong_APA_Unblock(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
Scheduler_Node *node
@@ -144,7 +144,7 @@ void _Scheduler_strong_APA_Withdraw_node(
Thread_Scheduler_state next_state
);
Thread_Control *_Scheduler_strong_APA_Yield(
bool _Scheduler_strong_APA_Yield(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
Scheduler_Node *node
+2 -2
View File
@@ -25,7 +25,7 @@
#include <rtems/score/threadimpl.h>
#include <rtems/score/watchdogimpl.h>
Scheduler_Void_or_thread _Scheduler_CBS_Unblock(
Scheduler_Void_or_bool _Scheduler_CBS_Unblock(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
Scheduler_Node *node
@@ -68,5 +68,5 @@ Scheduler_Void_or_thread _Scheduler_CBS_Unblock(
}
_Scheduler_EDF_Unblock( scheduler, the_thread, &the_node->Base.Base );
SCHEDULER_RETURN_VOID_OR_NULL;
SCHEDULER_RETURN_VOID_OR_BOOL;
}
+2 -2
View File
@@ -22,7 +22,7 @@
#include <rtems/score/schedulerimpl.h>
#include <rtems/score/thread.h>
Scheduler_Void_or_thread _Scheduler_EDF_Unblock(
Scheduler_Void_or_bool _Scheduler_EDF_Unblock(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
Scheduler_Node *node
@@ -60,5 +60,5 @@ Scheduler_Void_or_thread _Scheduler_EDF_Unblock(
);
}
SCHEDULER_RETURN_VOID_OR_NULL;
SCHEDULER_RETURN_VOID_OR_BOOL;
}
+2 -2
View File
@@ -21,7 +21,7 @@
#include <rtems/score/scheduleredfimpl.h>
Scheduler_Void_or_thread _Scheduler_EDF_Yield(
Scheduler_Void_or_bool _Scheduler_EDF_Yield(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
Scheduler_Node *node
@@ -37,5 +37,5 @@ Scheduler_Void_or_thread _Scheduler_EDF_Yield(
_Scheduler_EDF_Enqueue( context, the_node, the_node->priority );
_Scheduler_EDF_Schedule_body( scheduler, the_thread, true );
SCHEDULER_RETURN_VOID_OR_NULL;
SCHEDULER_RETURN_VOID_OR_BOOL;
}
+10 -17
View File
@@ -270,16 +270,14 @@ static Scheduler_Node * _Scheduler_priority_affinity_SMP_Get_lowest_scheduled(
* _Scheduler_priority_affinity_SMP_Get_lowest_scheduled into
* _Scheduler_SMP_Enqueue_ordered.
*/
static Thread_Control *_Scheduler_priority_affinity_SMP_Enqueue_fifo(
static bool _Scheduler_priority_affinity_SMP_Enqueue_fifo(
Scheduler_Context *context,
Scheduler_Node *node,
Thread_Control *needs_help
Scheduler_Node *node
)
{
return _Scheduler_SMP_Enqueue_ordered(
context,
node,
needs_help,
_Scheduler_priority_affinity_SMP_Insert_priority_fifo_order,
_Scheduler_priority_SMP_Insert_ready_fifo,
_Scheduler_SMP_Insert_scheduled_fifo,
@@ -354,14 +352,14 @@ static void _Scheduler_priority_affinity_SMP_Check_for_migrations(
/*
* This is the public scheduler specific Unblock operation.
*/
Thread_Control *_Scheduler_priority_affinity_SMP_Unblock(
bool _Scheduler_priority_affinity_SMP_Unblock(
const Scheduler_Control *scheduler,
Thread_Control *thread,
Scheduler_Node *node
)
{
Scheduler_Context *context = _Scheduler_Get_context( scheduler );
Thread_Control *needs_help;
bool needs_help;
needs_help = _Scheduler_SMP_Unblock(
context,
@@ -383,10 +381,9 @@ Thread_Control *_Scheduler_priority_affinity_SMP_Unblock(
* This is unique to this scheduler because it passes scheduler specific
* get_lowest_scheduled helper to _Scheduler_SMP_Enqueue_ordered.
*/
static Thread_Control *_Scheduler_priority_affinity_SMP_Enqueue_ordered(
static bool _Scheduler_priority_affinity_SMP_Enqueue_ordered(
Scheduler_Context *context,
Scheduler_Node *node,
Thread_Control *needs_help,
Chain_Node_order order,
Scheduler_SMP_Insert insert_ready,
Scheduler_SMP_Insert insert_scheduled
@@ -395,7 +392,6 @@ static Thread_Control *_Scheduler_priority_affinity_SMP_Enqueue_ordered(
return _Scheduler_SMP_Enqueue_ordered(
context,
node,
needs_help,
order,
insert_ready,
insert_scheduled,
@@ -410,16 +406,14 @@ static Thread_Control *_Scheduler_priority_affinity_SMP_Enqueue_ordered(
* to _Scheduler_priority_affinity_SMP_Enqueue_ordered() which
* invokes a scheduler unique get_lowest_scheduled helper.
*/
static Thread_Control *_Scheduler_priority_affinity_SMP_Enqueue_lifo(
static bool _Scheduler_priority_affinity_SMP_Enqueue_lifo(
Scheduler_Context *context,
Scheduler_Node *node,
Thread_Control *needs_help
Scheduler_Node *node
)
{
return _Scheduler_priority_affinity_SMP_Enqueue_ordered(
context,
node,
needs_help,
_Scheduler_priority_affinity_SMP_Insert_priority_lifo_order,
_Scheduler_priority_SMP_Insert_ready_lifo,
_Scheduler_SMP_Insert_scheduled_lifo
@@ -431,8 +425,7 @@ static Thread_Control *_Scheduler_priority_affinity_SMP_Enqueue_lifo(
* invoke _Scheduler_SMP_Enqueue_scheduled_ordered() with
* this scheduler's get_highest_ready() helper.
*/
static Thread_Control *
_Scheduler_priority_affinity_SMP_Enqueue_scheduled_ordered(
static bool _Scheduler_priority_affinity_SMP_Enqueue_scheduled_ordered(
Scheduler_Context *context,
Scheduler_Node *node,
Chain_Node_order order,
@@ -458,7 +451,7 @@ _Scheduler_priority_affinity_SMP_Enqueue_scheduled_ordered(
* to _Scheduler_priority_affinity_SMP_Enqueue_scheduled__ordered() which
* invokes a scheduler unique get_lowest_scheduled helper.
*/
static Thread_Control *_Scheduler_priority_affinity_SMP_Enqueue_scheduled_lifo(
static bool _Scheduler_priority_affinity_SMP_Enqueue_scheduled_lifo(
Scheduler_Context *context,
Scheduler_Node *node
)
@@ -477,7 +470,7 @@ static Thread_Control *_Scheduler_priority_affinity_SMP_Enqueue_scheduled_lifo(
* to _Scheduler_priority_affinity_SMP_Enqueue_scheduled__ordered() which
* invokes a scheduler unique get_lowest_scheduled helper.
*/
static Thread_Control *_Scheduler_priority_affinity_SMP_Enqueue_scheduled_fifo(
static bool _Scheduler_priority_affinity_SMP_Enqueue_scheduled_fifo(
Scheduler_Context *context,
Scheduler_Node *node
)
+10 -16
View File
@@ -109,10 +109,9 @@ void _Scheduler_priority_SMP_Block(
);
}
static Thread_Control *_Scheduler_priority_SMP_Enqueue_ordered(
static bool _Scheduler_priority_SMP_Enqueue_ordered(
Scheduler_Context *context,
Scheduler_Node *node,
Thread_Control *needs_help,
Chain_Node_order order,
Scheduler_SMP_Insert insert_ready,
Scheduler_SMP_Insert insert_scheduled
@@ -121,7 +120,6 @@ static Thread_Control *_Scheduler_priority_SMP_Enqueue_ordered(
return _Scheduler_SMP_Enqueue_ordered(
context,
node,
needs_help,
order,
insert_ready,
insert_scheduled,
@@ -131,39 +129,35 @@ static Thread_Control *_Scheduler_priority_SMP_Enqueue_ordered(
);
}
static Thread_Control *_Scheduler_priority_SMP_Enqueue_lifo(
static bool _Scheduler_priority_SMP_Enqueue_lifo(
Scheduler_Context *context,
Scheduler_Node *node,
Thread_Control *needs_help
Scheduler_Node *node
)
{
return _Scheduler_priority_SMP_Enqueue_ordered(
context,
node,
needs_help,
_Scheduler_SMP_Insert_priority_lifo_order,
_Scheduler_priority_SMP_Insert_ready_lifo,
_Scheduler_SMP_Insert_scheduled_lifo
);
}
static Thread_Control *_Scheduler_priority_SMP_Enqueue_fifo(
static bool _Scheduler_priority_SMP_Enqueue_fifo(
Scheduler_Context *context,
Scheduler_Node *node,
Thread_Control *needs_help
Scheduler_Node *node
)
{
return _Scheduler_priority_SMP_Enqueue_ordered(
context,
node,
needs_help,
_Scheduler_SMP_Insert_priority_fifo_order,
_Scheduler_priority_SMP_Insert_ready_fifo,
_Scheduler_SMP_Insert_scheduled_fifo
);
}
static Thread_Control *_Scheduler_priority_SMP_Enqueue_scheduled_ordered(
static bool _Scheduler_priority_SMP_Enqueue_scheduled_ordered(
Scheduler_Context *context,
Scheduler_Node *node,
Chain_Node_order order,
@@ -184,7 +178,7 @@ static Thread_Control *_Scheduler_priority_SMP_Enqueue_scheduled_ordered(
);
}
static Thread_Control *_Scheduler_priority_SMP_Enqueue_scheduled_lifo(
static bool _Scheduler_priority_SMP_Enqueue_scheduled_lifo(
Scheduler_Context *context,
Scheduler_Node *node
)
@@ -198,7 +192,7 @@ static Thread_Control *_Scheduler_priority_SMP_Enqueue_scheduled_lifo(
);
}
static Thread_Control *_Scheduler_priority_SMP_Enqueue_scheduled_fifo(
static bool _Scheduler_priority_SMP_Enqueue_scheduled_fifo(
Scheduler_Context *context,
Scheduler_Node *node
)
@@ -212,7 +206,7 @@ static Thread_Control *_Scheduler_priority_SMP_Enqueue_scheduled_fifo(
);
}
Thread_Control *_Scheduler_priority_SMP_Unblock(
bool _Scheduler_priority_SMP_Unblock(
const Scheduler_Control *scheduler,
Thread_Control *thread,
Scheduler_Node *node
@@ -318,7 +312,7 @@ void _Scheduler_priority_SMP_Withdraw_node(
);
}
Thread_Control *_Scheduler_priority_SMP_Yield(
bool _Scheduler_priority_SMP_Yield(
const Scheduler_Control *scheduler,
Thread_Control *thread,
Scheduler_Node *node
+2 -2
View File
@@ -22,7 +22,7 @@
#include <rtems/score/schedulerpriorityimpl.h>
Scheduler_Void_or_thread _Scheduler_priority_Unblock (
Scheduler_Void_or_bool _Scheduler_priority_Unblock (
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
Scheduler_Node *node
@@ -72,5 +72,5 @@ Scheduler_Void_or_thread _Scheduler_priority_Unblock (
_Scheduler_Update_heir( the_thread, priority == PRIORITY_PSEUDO_ISR );
}
SCHEDULER_RETURN_VOID_OR_NULL;
SCHEDULER_RETURN_VOID_OR_BOOL;
}
+2 -2
View File
@@ -21,7 +21,7 @@
#include <rtems/score/schedulerpriorityimpl.h>
#include <rtems/score/threadimpl.h>
Scheduler_Void_or_thread _Scheduler_priority_Yield(
Scheduler_Void_or_bool _Scheduler_priority_Yield(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
Scheduler_Node *node
@@ -40,5 +40,5 @@ Scheduler_Void_or_thread _Scheduler_priority_Yield(
_Scheduler_priority_Schedule_body( scheduler, the_thread, true );
SCHEDULER_RETURN_VOID_OR_NULL;
SCHEDULER_RETURN_VOID_OR_BOOL;
}
+10 -16
View File
@@ -176,10 +176,9 @@ void _Scheduler_simple_SMP_Block(
);
}
static Thread_Control *_Scheduler_simple_SMP_Enqueue_ordered(
static bool _Scheduler_simple_SMP_Enqueue_ordered(
Scheduler_Context *context,
Scheduler_Node *node,
Thread_Control *needs_help,
Chain_Node_order order,
Scheduler_SMP_Insert insert_ready,
Scheduler_SMP_Insert insert_scheduled
@@ -188,7 +187,6 @@ static Thread_Control *_Scheduler_simple_SMP_Enqueue_ordered(
return _Scheduler_SMP_Enqueue_ordered(
context,
node,
needs_help,
order,
insert_ready,
insert_scheduled,
@@ -198,39 +196,35 @@ static Thread_Control *_Scheduler_simple_SMP_Enqueue_ordered(
);
}
static Thread_Control *_Scheduler_simple_SMP_Enqueue_lifo(
static bool _Scheduler_simple_SMP_Enqueue_lifo(
Scheduler_Context *context,
Scheduler_Node *node,
Thread_Control *needs_help
Scheduler_Node *node
)
{
return _Scheduler_simple_SMP_Enqueue_ordered(
context,
node,
needs_help,
_Scheduler_SMP_Insert_priority_lifo_order,
_Scheduler_simple_SMP_Insert_ready_lifo,
_Scheduler_SMP_Insert_scheduled_lifo
);
}
static Thread_Control *_Scheduler_simple_SMP_Enqueue_fifo(
static bool _Scheduler_simple_SMP_Enqueue_fifo(
Scheduler_Context *context,
Scheduler_Node *node,
Thread_Control *needs_help
Scheduler_Node *node
)
{
return _Scheduler_simple_SMP_Enqueue_ordered(
context,
node,
needs_help,
_Scheduler_SMP_Insert_priority_fifo_order,
_Scheduler_simple_SMP_Insert_ready_fifo,
_Scheduler_SMP_Insert_scheduled_fifo
);
}
static Thread_Control *_Scheduler_simple_SMP_Enqueue_scheduled_ordered(
static bool _Scheduler_simple_SMP_Enqueue_scheduled_ordered(
Scheduler_Context *context,
Scheduler_Node *node,
Chain_Node_order order,
@@ -251,7 +245,7 @@ static Thread_Control *_Scheduler_simple_SMP_Enqueue_scheduled_ordered(
);
}
static Thread_Control *_Scheduler_simple_SMP_Enqueue_scheduled_lifo(
static bool _Scheduler_simple_SMP_Enqueue_scheduled_lifo(
Scheduler_Context *context,
Scheduler_Node *node
)
@@ -265,7 +259,7 @@ static Thread_Control *_Scheduler_simple_SMP_Enqueue_scheduled_lifo(
);
}
static Thread_Control *_Scheduler_simple_SMP_Enqueue_scheduled_fifo(
static bool _Scheduler_simple_SMP_Enqueue_scheduled_fifo(
Scheduler_Context *context,
Scheduler_Node *node
)
@@ -279,7 +273,7 @@ static Thread_Control *_Scheduler_simple_SMP_Enqueue_scheduled_fifo(
);
}
Thread_Control *_Scheduler_simple_SMP_Unblock(
bool _Scheduler_simple_SMP_Unblock(
const Scheduler_Control *scheduler,
Thread_Control *thread,
Scheduler_Node *node
@@ -385,7 +379,7 @@ void _Scheduler_simple_SMP_Withdraw_node(
);
}
Thread_Control *_Scheduler_simple_SMP_Yield(
bool _Scheduler_simple_SMP_Yield(
const Scheduler_Control *scheduler,
Thread_Control *thread,
Scheduler_Node *node
+2 -2
View File
@@ -21,7 +21,7 @@
#include <rtems/score/schedulersimpleimpl.h>
#include <rtems/score/thread.h>
Scheduler_Void_or_thread _Scheduler_simple_Unblock(
Scheduler_Void_or_bool _Scheduler_simple_Unblock(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
Scheduler_Node *node
@@ -55,5 +55,5 @@ Scheduler_Void_or_thread _Scheduler_simple_Unblock(
);
}
SCHEDULER_RETURN_VOID_OR_NULL;
SCHEDULER_RETURN_VOID_OR_BOOL;
}
+2 -2
View File
@@ -20,7 +20,7 @@
#include <rtems/score/schedulersimpleimpl.h>
Scheduler_Void_or_thread _Scheduler_simple_Yield(
Scheduler_Void_or_bool _Scheduler_simple_Yield(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
Scheduler_Node *node
@@ -35,5 +35,5 @@ Scheduler_Void_or_thread _Scheduler_simple_Yield(
_Scheduler_simple_Insert_priority_fifo( &context->Ready, the_thread );
_Scheduler_simple_Schedule_body( scheduler, the_thread, false );
SCHEDULER_RETURN_VOID_OR_NULL;
SCHEDULER_RETURN_VOID_OR_BOOL;
}
+10 -16
View File
@@ -235,10 +235,9 @@ void _Scheduler_strong_APA_Block(
);
}
static Thread_Control *_Scheduler_strong_APA_Enqueue_ordered(
static bool _Scheduler_strong_APA_Enqueue_ordered(
Scheduler_Context *context,
Scheduler_Node *node,
Thread_Control *needs_help,
Chain_Node_order order,
Scheduler_SMP_Insert insert_ready,
Scheduler_SMP_Insert insert_scheduled
@@ -247,7 +246,6 @@ static Thread_Control *_Scheduler_strong_APA_Enqueue_ordered(
return _Scheduler_SMP_Enqueue_ordered(
context,
node,
needs_help,
order,
insert_ready,
insert_scheduled,
@@ -257,39 +255,35 @@ static Thread_Control *_Scheduler_strong_APA_Enqueue_ordered(
);
}
static Thread_Control *_Scheduler_strong_APA_Enqueue_lifo(
static bool _Scheduler_strong_APA_Enqueue_lifo(
Scheduler_Context *context,
Scheduler_Node *node,
Thread_Control *needs_help
Scheduler_Node *node
)
{
return _Scheduler_strong_APA_Enqueue_ordered(
context,
node,
needs_help,
_Scheduler_SMP_Insert_priority_lifo_order,
_Scheduler_strong_APA_Insert_ready_lifo,
_Scheduler_SMP_Insert_scheduled_lifo
);
}
static Thread_Control *_Scheduler_strong_APA_Enqueue_fifo(
static bool _Scheduler_strong_APA_Enqueue_fifo(
Scheduler_Context *context,
Scheduler_Node *node,
Thread_Control *needs_help
Scheduler_Node *node
)
{
return _Scheduler_strong_APA_Enqueue_ordered(
context,
node,
needs_help,
_Scheduler_SMP_Insert_priority_fifo_order,
_Scheduler_strong_APA_Insert_ready_fifo,
_Scheduler_SMP_Insert_scheduled_fifo
);
}
static Thread_Control *_Scheduler_strong_APA_Enqueue_scheduled_ordered(
static bool _Scheduler_strong_APA_Enqueue_scheduled_ordered(
Scheduler_Context *context,
Scheduler_Node *node,
Chain_Node_order order,
@@ -310,7 +304,7 @@ static Thread_Control *_Scheduler_strong_APA_Enqueue_scheduled_ordered(
);
}
static Thread_Control *_Scheduler_strong_APA_Enqueue_scheduled_lifo(
static bool _Scheduler_strong_APA_Enqueue_scheduled_lifo(
Scheduler_Context *context,
Scheduler_Node *node
)
@@ -324,7 +318,7 @@ static Thread_Control *_Scheduler_strong_APA_Enqueue_scheduled_lifo(
);
}
static Thread_Control *_Scheduler_strong_APA_Enqueue_scheduled_fifo(
static bool _Scheduler_strong_APA_Enqueue_scheduled_fifo(
Scheduler_Context *context,
Scheduler_Node *node
)
@@ -338,7 +332,7 @@ static Thread_Control *_Scheduler_strong_APA_Enqueue_scheduled_fifo(
);
}
Thread_Control *_Scheduler_strong_APA_Unblock(
bool _Scheduler_strong_APA_Unblock(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
Scheduler_Node *node
@@ -444,7 +438,7 @@ void _Scheduler_strong_APA_Withdraw_node(
);
}
Thread_Control *_Scheduler_strong_APA_Yield(
bool _Scheduler_strong_APA_Yield(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
Scheduler_Node *node
+18 -22
View File
@@ -314,7 +314,7 @@ static void test_update_priority_op(void)
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
static Thread_Control *yield_op(
static bool yield_op(
Thread_Control *thread,
Scheduler_SMP_Node *scheduler_node
)
@@ -322,7 +322,7 @@ static Thread_Control *yield_op(
const Scheduler_Control *scheduler;
ISR_lock_Context state_lock_context;
ISR_lock_Context scheduler_lock_context;
Thread_Control *needs_help;
bool needs_help;
_Thread_State_acquire( thread, &state_lock_context );
scheduler = _Thread_Scheduler_get_home( thread );
@@ -348,7 +348,7 @@ static void test_case_yield_op(
Scheduler_SMP_Node_state new_state
)
{
Thread_Control *needs_help;
bool needs_help;
Per_CPU_Control *cpu_self;
cpu_self = _Thread_Dispatch_disable();
@@ -395,20 +395,16 @@ static void test_case_yield_op(
needs_help = yield_op(executing, executing_node);
rtems_test_assert(executing_node->state == new_state);
if (start_state != new_state) {
switch (start_state) {
case SCHEDULER_SMP_NODE_SCHEDULED:
rtems_test_assert(needs_help == executing);
break;
case SCHEDULER_SMP_NODE_READY:
rtems_test_assert(needs_help == other);
break;
default:
rtems_test_assert(0);
break;
}
} else {
rtems_test_assert(needs_help == NULL);
switch (new_state) {
case SCHEDULER_SMP_NODE_SCHEDULED:
rtems_test_assert(!needs_help);
break;
case SCHEDULER_SMP_NODE_READY:
rtems_test_assert(needs_help);
break;
default:
rtems_test_assert(0);
break;
}
change_priority(executing, 1, true);
@@ -473,7 +469,7 @@ static void block_op(
_Thread_State_release( thread, &state_lock_context );
}
static Thread_Control *unblock_op(
static bool unblock_op(
Thread_Control *thread,
Scheduler_SMP_Node *scheduler_node
)
@@ -481,7 +477,7 @@ static Thread_Control *unblock_op(
const Scheduler_Control *scheduler;
ISR_lock_Context state_lock_context;
ISR_lock_Context scheduler_lock_context;
Thread_Control *needs_help;
bool needs_help;
_Thread_State_acquire( thread, &state_lock_context );
scheduler = _Thread_Scheduler_get_home( thread );
@@ -506,7 +502,7 @@ static void test_case_unblock_op(
Scheduler_SMP_Node_state new_state
)
{
Thread_Control *needs_help;
bool needs_help;
Per_CPU_Control *cpu_self;
cpu_self = _Thread_Dispatch_disable();
@@ -533,10 +529,10 @@ static void test_case_unblock_op(
switch (new_state) {
case SCHEDULER_SMP_NODE_SCHEDULED:
rtems_test_assert(needs_help == other);
rtems_test_assert(!needs_help);
break;
case SCHEDULER_SMP_NODE_READY:
rtems_test_assert(needs_help == executing);
rtems_test_assert(needs_help);
break;
default:
rtems_test_assert(0);