summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems
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/rtems
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 'cpukit/rtems')
-rw-r--r--cpukit/rtems/src/signalsend.c25
-rw-r--r--cpukit/rtems/src/taskconstruct.c9
-rw-r--r--cpukit/rtems/src/taskmode.c2
3 files changed, 18 insertions, 18 deletions
diff --git a/cpukit/rtems/src/signalsend.c b/cpukit/rtems/src/signalsend.c
index 72407e2b01..6ce59f2e74 100644
--- a/cpukit/rtems/src/signalsend.c
+++ b/cpukit/rtems/src/signalsend.c
@@ -35,16 +35,15 @@ static void _Signal_Action_handler(
ISR_lock_Context *lock_context
)
{
- RTEMS_API_Control *api;
- ASR_Information *asr;
- rtems_signal_set signal_set;
- bool normal_is_preemptible;
- uint32_t normal_cpu_time_budget;
- Thread_CPU_budget_algorithms normal_budget_algorithm;
- uint32_t normal_isr_level;
- uint32_t before_call_isr_level;
- bool after_call_is_preemptible;
- bool after_call_asr_is_enabled;
+ RTEMS_API_Control *api;
+ ASR_Information *asr;
+ rtems_signal_set signal_set;
+ bool normal_is_preemptible;
+ Thread_CPU_budget_control normal_cpu_budget;
+ uint32_t normal_isr_level;
+ uint32_t before_call_isr_level;
+ bool after_call_is_preemptible;
+ bool after_call_asr_is_enabled;
(void) action;
@@ -69,8 +68,7 @@ static void _Signal_Action_handler(
_Assert( asr->is_enabled );
normal_is_preemptible = executing->is_preemptible;
- normal_cpu_time_budget = executing->cpu_time_budget;
- normal_budget_algorithm = executing->budget_algorithm;
+ normal_cpu_budget = executing->CPU_budget;
/* Set mode for ASR processing */
@@ -102,8 +100,7 @@ static void _Signal_Action_handler(
_Thread_State_acquire( executing, lock_context );
- executing->cpu_time_budget = normal_cpu_time_budget ;
- executing->budget_algorithm = normal_budget_algorithm ;
+ executing->CPU_budget = normal_cpu_budget;
after_call_is_preemptible = executing->is_preemptible;
executing->is_preemptible = normal_is_preemptible;
diff --git a/cpukit/rtems/src/taskconstruct.c b/cpukit/rtems/src/taskconstruct.c
index 6e03440aed..05fbf32ff5 100644
--- a/cpukit/rtems/src/taskconstruct.c
+++ b/cpukit/rtems/src/taskconstruct.c
@@ -154,14 +154,17 @@ rtems_status_code _RTEMS_tasks_Create(
attributes = _Attributes_Clear( attributes, ATTRIBUTES_NOT_SUPPORTED );
memset( &thread_config, 0, sizeof( thread_config ) );
- thread_config.budget_algorithm = _Modes_Is_timeslice( config->initial_modes ) ?
- THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE
- : THREAD_CPU_BUDGET_ALGORITHM_NONE,
thread_config.isr_level = _Modes_Get_interrupt_level( config->initial_modes );
thread_config.name = config->name;
thread_config.is_fp = _Attributes_Is_floating_point( attributes );
thread_config.is_preemptible = _Modes_Is_preempt( config->initial_modes );
+ if ( _Modes_Is_timeslice( config->initial_modes ) ) {
+ thread_config.cpu_budget_operations = &_Thread_CPU_budget_reset_timeslice;
+ } else {
+ thread_config.cpu_budget_operations = NULL;
+ }
+
/*
* Validate the RTEMS API priority and convert it to the core priority range.
*/
diff --git a/cpukit/rtems/src/taskmode.c b/cpukit/rtems/src/taskmode.c
index 96bed470f4..3300eafa28 100644
--- a/cpukit/rtems/src/taskmode.c
+++ b/cpukit/rtems/src/taskmode.c
@@ -73,7 +73,7 @@ rtems_status_code rtems_task_mode(
old_mode = (executing->is_preemptible) ? RTEMS_PREEMPT : RTEMS_NO_PREEMPT;
- if ( executing->budget_algorithm == THREAD_CPU_BUDGET_ALGORITHM_NONE )
+ if ( executing->CPU_budget.operations == NULL )
old_mode |= RTEMS_NO_TIMESLICE;
else
old_mode |= RTEMS_TIMESLICE;