summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/pthreadsetschedparam.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-10-27 12:59:09 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-11-15 08:56:53 +0100
commit240a1f79b1fcb58b9ae7bfc393e1f890e4492683 (patch)
tree92c47fa4899b2f0a8306e32bc18d66fbbf6b216f /cpukit/posix/src/pthreadsetschedparam.c
parentscore: Do not shadow parameter (diff)
downloadrtems-240a1f79b1fcb58b9ae7bfc393e1f890e4492683.tar.bz2
score: Introduce CPU budget operations
This patch set replaces the CPU budget algorithm enumeration with a set of CPU budget operations which implement a particular CPU budget algorithm. This helps to hide the CPU budget algorithm implementation details from the general thread handling. The CPU budget callouts are turned into CPU budget operations. This slightly reduces the size of the thread control block. All schedulers used the default scheduler tick implementation. The tick scheduler operation is removed and the CPU budget operations are directly used in _Watchdog_Tick() if the executing thread uses a CPU budget algorithm. This is performance improvement for all threads which do not use a CPU budget algorithm (default behaviour).
Diffstat (limited to '')
-rw-r--r--cpukit/posix/src/pthreadsetschedparam.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/cpukit/posix/src/pthreadsetschedparam.c b/cpukit/posix/src/pthreadsetschedparam.c
index 1c207e7887..165e1d86a8 100644
--- a/cpukit/posix/src/pthreadsetschedparam.c
+++ b/cpukit/posix/src/pthreadsetschedparam.c
@@ -40,14 +40,15 @@ static int _POSIX_Set_sched_param(
Thread_queue_Context *queue_context
)
{
- const Scheduler_Control *scheduler;
- int normal_prio;
- bool valid;
- Priority_Control core_normal_prio;
+ const Scheduler_Control *scheduler;
+ int normal_prio;
+ bool valid;
+ Priority_Control core_normal_prio;
+ const Thread_CPU_budget_operations *cpu_budget_operations;
#if defined(RTEMS_POSIX_API)
- POSIX_API_Control *api;
- int low_prio;
- Priority_Control core_low_prio;
+ POSIX_API_Control *api;
+ int low_prio;
+ Priority_Control core_low_prio;
#endif
normal_prio = param->sched_priority;
@@ -103,9 +104,12 @@ static int _POSIX_Set_sched_param(
}
#endif
- the_thread->cpu_time_budget = config->cpu_time_budget;
- the_thread->budget_algorithm = config->budget_algorithm;
- the_thread->budget_callout = config->budget_callout;
+ cpu_budget_operations = config->cpu_budget_operations;
+ the_thread->CPU_budget.operations = cpu_budget_operations;
+
+ if ( cpu_budget_operations != NULL ) {
+ ( *cpu_budget_operations->initialize )( the_thread );
+ }
#if defined(RTEMS_POSIX_API)
_Priority_Node_set_priority( &api->Sporadic.Low_priority, core_low_prio );