summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-27 09:03:31 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-28 13:08:53 +0200
commit4edcede7e967ad1676211ef1ae391a473632bec0 (patch)
tree284bf30fb8c35dae7319a68be7f4c7b587bf38cc /cpukit/score/src
parentbsp: Add new riscv_generic bsp v3 (diff)
downloadrtems-4edcede7e967ad1676211ef1ae391a473632bec0.tar.bz2
score: Simplify SMP get lowest scheduled
There is no need to pass in the order relation since the scheduled threads reside on an already ordered chain. The caller will decide what to do with the lowest scheduled thread.
Diffstat (limited to 'cpukit/score/src')
-rw-r--r--cpukit/score/src/scheduleredfsmp.c5
-rw-r--r--cpukit/score/src/schedulerpriorityaffinitysmp.c30
2 files changed, 14 insertions, 21 deletions
diff --git a/cpukit/score/src/scheduleredfsmp.c b/cpukit/score/src/scheduleredfsmp.c
index bd6ce82068..3a1b1a934e 100644
--- a/cpukit/score/src/scheduleredfsmp.c
+++ b/cpukit/score/src/scheduleredfsmp.c
@@ -226,8 +226,7 @@ static inline Scheduler_EDF_SMP_Node *_Scheduler_EDF_SMP_Get_scheduled(
static inline Scheduler_Node *_Scheduler_EDF_SMP_Get_lowest_scheduled(
Scheduler_Context *context,
- Scheduler_Node *filter_base,
- Chain_Node_order order
+ Scheduler_Node *filter_base
)
{
Scheduler_EDF_SMP_Node *filter;
@@ -249,7 +248,7 @@ static inline Scheduler_Node *_Scheduler_EDF_SMP_Get_lowest_scheduled(
}
}
- return _Scheduler_SMP_Get_lowest_scheduled( context, filter_base, order );
+ return _Scheduler_SMP_Get_lowest_scheduled( context, filter_base );
}
static inline void _Scheduler_EDF_SMP_Insert_ready(
diff --git a/cpukit/score/src/schedulerpriorityaffinitysmp.c b/cpukit/score/src/schedulerpriorityaffinitysmp.c
index 03db3e9a26..6caf00c3a0 100644
--- a/cpukit/score/src/schedulerpriorityaffinitysmp.c
+++ b/cpukit/score/src/schedulerpriorityaffinitysmp.c
@@ -210,8 +210,7 @@ void _Scheduler_priority_affinity_SMP_Block(
*/
static Scheduler_Node * _Scheduler_priority_affinity_SMP_Get_lowest_scheduled(
Scheduler_Context *context,
- Scheduler_Node *filter_base,
- Chain_Node_order order
+ Scheduler_Node *filter_base
)
{
Scheduler_SMP_Context *self = _Scheduler_SMP_Get_self( context );
@@ -230,20 +229,6 @@ static Scheduler_Node * _Scheduler_priority_affinity_SMP_Get_lowest_scheduled(
node = (Scheduler_priority_affinity_SMP_Node *) chain_node;
- /*
- * If we didn't find a thread which is of equal or lower importance
- * than filter thread is, then we can't schedule the filter thread
- * to execute.
- */
- if (
- (*order)(
- &node->Base.Base.Base.Node.Chain,
- &filter->Base.Base.Base.Node.Chain
- )
- ) {
- break;
- }
-
/* cpu_index is the processor number thread is executing on */
thread = _Scheduler_Node_get_owner( &node->Base.Base.Base );
cpu_index = _Per_CPU_Get_index( _Thread_Get_CPU( thread ) );
@@ -309,8 +294,7 @@ static void _Scheduler_priority_affinity_SMP_Check_for_migrations(
lowest_scheduled =
_Scheduler_priority_affinity_SMP_Get_lowest_scheduled(
context,
- highest_ready,
- _Scheduler_SMP_Insert_priority_lifo_order
+ highest_ready
);
/*
@@ -322,9 +306,19 @@ static void _Scheduler_priority_affinity_SMP_Check_for_migrations(
* considering affinity. But now we have to consider that thread's
* affinity as we look to place it.
*/
+
if ( lowest_scheduled == NULL )
break;
+ if (
+ _Scheduler_SMP_Insert_priority_lifo_order(
+ &lowest_scheduled->Node.Chain,
+ &highest_ready->Node.Chain
+ )
+ ) {
+ break;
+ }
+
/*
* But if we found a thread which is lower priority than one
* in the ready set, then we need to swap them out.