summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/watchdogtick.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/score/src/watchdogtick.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/score/src/watchdogtick.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/cpukit/score/src/watchdogtick.c b/cpukit/score/src/watchdogtick.c
index e77ca4e1e1..aa2efc3626 100644
--- a/cpukit/score/src/watchdogtick.c
+++ b/cpukit/score/src/watchdogtick.c
@@ -62,11 +62,13 @@ void _Watchdog_Do_tickle(
void _Watchdog_Tick( Per_CPU_Control *cpu )
{
- ISR_lock_Context lock_context;
- Watchdog_Header *header;
- Watchdog_Control *first;
- uint64_t ticks;
- struct timespec now;
+ ISR_lock_Context lock_context;
+ Watchdog_Header *header;
+ Watchdog_Control *first;
+ uint64_t ticks;
+ struct timespec now;
+ Thread_Control *executing;
+ const Thread_CPU_budget_operations *cpu_budget_operations;
if ( _Per_CPU_Is_boot_processor( cpu ) ) {
++_Watchdog_Ticks_since_boot;
@@ -122,5 +124,16 @@ void _Watchdog_Tick( Per_CPU_Control *cpu )
_ISR_lock_Release_and_ISR_enable( &cpu->Watchdog.Lock, &lock_context );
- _Scheduler_Tick( cpu );
+ /*
+ * Each online processor has at least an idle thread as the executing thread
+ * even in case it has currently no scheduler assigned. Clock interrupts on
+ * processors which are not online would be a severe bug of the Clock Driver.
+ */
+ executing = _Per_CPU_Get_executing( cpu );
+ _Assert( executing != NULL );
+ cpu_budget_operations = executing->CPU_budget.operations;
+
+ if ( cpu_budget_operations != NULL ) {
+ ( *cpu_budget_operations->at_tick )( executing );
+ }
}