summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/schedulerprioritysmp.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2014-05-19 15:26:55 -0500
committerJennifer Averett <jennifer.averett@oarcorp.com>2014-06-11 09:27:06 -0500
commit238629f2f144807abd29e9fefc9d20746ae16b2c (patch)
treeb156738a4f3764a717288c3b7546bfbcaf4ee749 /cpukit/score/src/schedulerprioritysmp.c
parentsamples/pppd: Fix extra drivers initializer (diff)
downloadrtems-238629f2f144807abd29e9fefc9d20746ae16b2c.tar.bz2
Add SMP Priority Scheduler with Affinity
This scheduler attempts to account for needed thread migrations caused as a side-effect of a thread state, affinity, or priority change operation. This scheduler has its own allocate_processor handler named _Scheduler_SMP_Allocate_processor_exact() because _Scheduler_SMP_Allocate_processor() attempts to prevent an executing thread from moving off its current CPU without considering affinity. Without this, the scheduler makes all the right decisions and then they are discarded at the end. ==Side Effects of Adding This Scheduler== Added Thread_Control * parameter to Scheduler_SMP_Get_highest_ready type so methods looking for the highest ready thread can filter by the processor on which the thread blocking resides. This allows affinity to be considered. Simple Priority SMP and Priority SMP ignore this parameter. + Added get_lowest_scheduled argument to _Scheduler_SMP_Enqueue_ordered(). + Added allocate_processor argument to the following methods: - _Scheduler_SMP_Block() - _Scheduler_SMP_Enqueue_scheduled_ordered() - _Scheduler_SMP_Enqueue_scheduled_ordered() + schedulerprioritysmpimpl.h is a new file with prototypes for methods which were formerly static in schedulerprioritysmp.c but now need to be public to be shared with this scheduler. NOTE: _Scheduler_SMP_Get_lowest_ready() appears to have a path which would allow it to return a NULL. Previously, _Scheduler_SMP_Enqueue_ordered() would have asserted on it. If it cannot return a NULL, _Scheduler_SMP_Get_lowest_ready() should have an assertions.
Diffstat (limited to 'cpukit/score/src/schedulerprioritysmp.c')
-rw-r--r--cpukit/score/src/schedulerprioritysmp.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/cpukit/score/src/schedulerprioritysmp.c b/cpukit/score/src/schedulerprioritysmp.c
index 7915ce6bef..48da162fe1 100644
--- a/cpukit/score/src/schedulerprioritysmp.c
+++ b/cpukit/score/src/schedulerprioritysmp.c
@@ -26,6 +26,7 @@
#include <rtems/score/schedulerprioritysmp.h>
#include <rtems/score/schedulerpriorityimpl.h>
+#include <rtems/score/schedulerprioritysmpimpl.h>
#include <rtems/score/schedulersmpimpl.h>
static Scheduler_priority_SMP_Context *
@@ -34,13 +35,14 @@ _Scheduler_priority_SMP_Get_context( const Scheduler_Control *scheduler )
return (Scheduler_priority_SMP_Context *) _Scheduler_Get_context( scheduler );
}
-static Scheduler_priority_SMP_Context *
-_Scheduler_priority_SMP_Get_self( Scheduler_Context *context )
+Scheduler_priority_SMP_Context *_Scheduler_priority_SMP_Get_self(
+ Scheduler_Context *context
+)
{
return (Scheduler_priority_SMP_Context *) context;
}
-static Scheduler_priority_SMP_Node *_Scheduler_priority_SMP_Node_get(
+Scheduler_priority_SMP_Node *_Scheduler_priority_SMP_Node_get(
Thread_Control *thread
)
{
@@ -74,7 +76,7 @@ void _Scheduler_priority_SMP_Node_initialize(
_Scheduler_SMP_Node_initialize( node );
}
-static void _Scheduler_priority_SMP_Do_update(
+void _Scheduler_priority_SMP_Do_update(
Scheduler_Context *context,
Scheduler_Node *base_node,
Priority_Control new_priority
@@ -106,19 +108,22 @@ void _Scheduler_priority_SMP_Update_priority(
}
static Thread_Control *_Scheduler_priority_SMP_Get_highest_ready(
- Scheduler_Context *context
+ Scheduler_Context *context,
+ Thread_Control *thread
)
{
Scheduler_priority_SMP_Context *self =
_Scheduler_priority_SMP_Get_self( context );
+ (void) thread;
+
return _Scheduler_priority_Ready_queue_first(
&self->Bit_map,
&self->Ready[ 0 ]
);
}
-static void _Scheduler_priority_SMP_Move_from_scheduled_to_ready(
+void _Scheduler_priority_SMP_Move_from_scheduled_to_ready(
Scheduler_Context *context,
Thread_Control *scheduled_to_ready
)
@@ -136,7 +141,7 @@ static void _Scheduler_priority_SMP_Move_from_scheduled_to_ready(
);
}
-static void _Scheduler_priority_SMP_Move_from_ready_to_scheduled(
+void _Scheduler_priority_SMP_Move_from_ready_to_scheduled(
Scheduler_Context *context,
Thread_Control *ready_to_scheduled
)
@@ -157,7 +162,7 @@ static void _Scheduler_priority_SMP_Move_from_ready_to_scheduled(
);
}
-static void _Scheduler_priority_SMP_Insert_ready_lifo(
+void _Scheduler_priority_SMP_Insert_ready_lifo(
Scheduler_Context *context,
Thread_Control *thread
)
@@ -174,7 +179,7 @@ static void _Scheduler_priority_SMP_Insert_ready_lifo(
);
}
-static void _Scheduler_priority_SMP_Insert_ready_fifo(
+void _Scheduler_priority_SMP_Insert_ready_fifo(
Scheduler_Context *context,
Thread_Control *thread
)
@@ -191,7 +196,7 @@ static void _Scheduler_priority_SMP_Insert_ready_fifo(
);
}
-static void _Scheduler_priority_SMP_Extract_from_ready(
+void _Scheduler_priority_SMP_Extract_from_ready(
Scheduler_Context *context,
Thread_Control *thread
)
@@ -220,7 +225,8 @@ void _Scheduler_priority_SMP_Block(
thread,
_Scheduler_priority_SMP_Extract_from_ready,
_Scheduler_priority_SMP_Get_highest_ready,
- _Scheduler_priority_SMP_Move_from_ready_to_scheduled
+ _Scheduler_priority_SMP_Move_from_ready_to_scheduled,
+ _Scheduler_SMP_Allocate_processor
);
}
@@ -238,7 +244,9 @@ static void _Scheduler_priority_SMP_Enqueue_ordered(
order,
insert_ready,
insert_scheduled,
- _Scheduler_priority_SMP_Move_from_scheduled_to_ready
+ _Scheduler_priority_SMP_Move_from_scheduled_to_ready,
+ _Scheduler_SMP_Get_lowest_scheduled,
+ _Scheduler_SMP_Allocate_processor
);
}
@@ -285,7 +293,8 @@ static void _Scheduler_priority_SMP_Enqueue_scheduled_ordered(
_Scheduler_priority_SMP_Get_highest_ready,
insert_ready,
insert_scheduled,
- _Scheduler_priority_SMP_Move_from_ready_to_scheduled
+ _Scheduler_priority_SMP_Move_from_ready_to_scheduled,
+ _Scheduler_SMP_Allocate_processor
);
}