summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/threadchangepriority.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Mark parameters as intentionally unusedSebastian Huber2024-03-221-0/+1
| | | | | | | | The parameters are unused due to API constraints. The functions are used through function pointers. Alternative implementations may use the parameters. Update #4862.
* Update company nameSebastian Huber2023-05-201-1/+1
| | | | | The embedded brains GmbH & Co. KG is the legal successor of embedded brains GmbH.
* score: Conditional _Thread_Priority_replace()Sebastian Huber2022-07-071-0/+2
| | | | This function is only used in SMP configurations.
* score: Make SMP only code explicitSebastian Huber2022-06-231-1/+9
| | | | | | | Conditional expressions with inline functions are not optimized away if optimization is disabled. Avoid such expressions to prevent dead branches. It helps also during code review to immediately see if a loop is used or not.
* score/src/[t-z]*.c: Change license to BSD-2Joel Sherrill2022-02-281-3/+22
| | | | Updates #3053.
* score: Add SMP scheduler make/clean stickySebastian Huber2021-11-231-5/+127
| | | | | | | | | | | | | | | | | | | | This patch fixes the following broken behaviour: While a thread is scheduled on a helping scheduler, while it does not own a MrsP semaphore, if it obtains a MrsP semaphore, then no scheduler node using an idle thread and the ceiling priority of the semaphore is unblocked for the home scheduler. This could lead to priority inversion issues and is not in line with the MrsP protocol. Introduce two new scheduler operations which are only enabled if RTEMS_SMP is defined. The operations are used to make the scheduler node of the home scheduler sticky and to clean the sticky property. This helps to keep the sticky handing out of the frequently used priority update operation. Close #4532.
* score: Add Thread_queue_Deadlock_statusSebastian Huber2021-10-011-2/+2
| | | | | | Replace the boolen return value with the new enum Thread_queue_Deadlock_status. This improves the code readability. Improve documentation. Shorten function names.
* score: Update priority only if necessarySebastian Huber2021-09-011-1/+1
| | | | | | In _Thread_queue_Flush_critical(), update the priority of the thread queue owner only if necessary. The scheduler update priority operation could be expensive.
* score: Replace priority prepend it with an enumSebastian Huber2021-08-121-15/+24
| | | | | | | | Use the new Priority_Group_order enum instead of a boolean to indicated if a priority should be inserted as the first or last node into its priority group. This makes the code more expressive. It is also a bit more efficient since a branch in _Scheduler_Node_set_priority() is avoided and a simple bitwise or operation can be used.
* score: Canonicalize Doxygen @file commentsSebastian Huber2020-12-021-2/+6
| | | | | | Use common phrases for the file brief descriptions. Update #3706.
* Canonicalize config.h includeSebastian Huber2020-04-161-1/+1
| | | | | | | | Use the following variant which was already used by most source files: #ifdef HAVE_CONFIG_H #include "config.h" #endif
* doxygen: Rename Score* groups in RTEMSScore*Sebastian Huber2019-04-041-1/+1
| | | | Update #3706
* score: Delete Thread_Scheduler_control::own_nodeSebastian Huber2016-11-021-6/+10
| | | | Update #2556.
* score: First part of new MrsP implementationSebastian Huber2016-11-021-0/+17
| | | | Update #2556.
* score: Add _Thread_Scheduler_remove_wait_node()Sebastian Huber2016-11-021-2/+4
| | | | Update #2556.
* score: Add _Thread_Scheduler_add_wait_node()Sebastian Huber2016-11-021-4/+1
| | | | Update #2556.
* score: Scheduler node awareness for thread queuesSebastian Huber2016-09-211-18/+32
| | | | | | | | Maintain the priority of a thread for each scheduler instance via the thread queue enqueue, extract, priority actions and surrender operations. This replaces the primitive priority boosting. Update #2556.
* score: Rework thread priority managementSebastian Huber2016-09-211-94/+272
| | | | | | | | | | | | | | | | | | | | | | | | | Add priority nodes which contribute to the overall thread priority. The actual priority of a thread is now an aggregation of priority nodes. The thread priority aggregation for the home scheduler instance of a thread consists of at least one priority node, which is normally the real priority of the thread. The locking protocols (e.g. priority ceiling and priority inheritance), rate-monotonic period objects and the POSIX sporadic server add, change and remove priority nodes. A thread changes its priority now immediately, e.g. priority changes are not deferred until the thread releases its last resource. Replace the _Thread_Change_priority() function with * _Thread_Priority_perform_actions(), * _Thread_Priority_add(), * _Thread_Priority_remove(), * _Thread_Priority_change(), and * _Thread_Priority_update(). Update #2412. Update #2556.
* score: Introduce _Thread_Get_priority()Sebastian Huber2016-09-081-2/+2
| | | | Avoid direct access to thread internal data fields.
* score: Fix and simplify thread wait locksSebastian Huber2016-08-031-4/+5
| | | | | | | | | | There was a subtile race condition in _Thread_queue_Do_extract_locked(). It must first update the thread wait flags and then restore the default thread wait state. In the previous implementation this could lead under rare timing conditions to an ineffective _Thread_Wait_tranquilize() resulting to a corrupt system state. Update #2556.
* score: Turn thread lock into thread wait lockSebastian Huber2016-07-271-17/+13
| | | | | | | | | The _Thread_Lock_acquire() function had a potentially infinite run-time due to the lack of fairness at atomic operations level. Update #2412. Update #2556. Update #2765.
* score: Priority inherit thread queue operationsSebastian Huber2016-07-271-34/+0
| | | | | | | | | Move the priority change due to priority interitance to the thread queue enqueue operation to simplify the locking on SMP configurations. Update #2412. Update #2556. Update #2765.
* score: Split _Thread_Change_priority()Sebastian Huber2016-07-271-9/+52
| | | | | | Update #2412. Update #2556. Update #2765.
* score: Add thread priority to scheduler nodesSebastian Huber2016-06-221-16/+5
| | | | | | | | | | | | | | | | | | The thread priority is manifest in two independent areas. One area is the user visible thread priority along with a potential thread queue. The other is the scheduler. Currently, a thread priority update via _Thread_Change_priority() first updates the user visble thread priority and the thread queue, then the scheduler is notified if necessary. The priority is passed to the scheduler via a local variable. A generation counter ensures that the scheduler discards out-of-date priorities. This use of a local variable ties the update in these two areas close together. For later enhancements and the OMIP locking protocol implementation we need more flexibility. Add a thread priority information block to Scheduler_Node and synchronize priority value updates via a sequence lock on SMP configurations. Update #2556.
* score: Use thread state lock for current stateSebastian Huber2016-05-121-2/+2
| | | | | | | In addition protect scheduler of thread by thread state lock. Enables use of scheduler per-instance locks. Update #2555.
* score: Implement priority boostingSebastian Huber2015-09-041-0/+34
|
* score: Rework _Thread_Change_priority()Sebastian Huber2015-05-191-5/+66
| | | | | | | | | | | | | Move the writes to Thread_Control::current_priority and Thread_Control::real_priority into _Thread_Change_priority() under the protection of the thread lock. Add a filter function to _Thread_Change_priority() to enable specialized variants. Avoid race conditions during a thread priority restore with the new Thread_Control::priority_restore_hint for an important average case optimizations used by priority inheritance mutexes. Update #2273.
* score: Add Thread_queue_OperationsSebastian Huber2015-05-191-5/+5
| | | | | | | | Replace the Thread_Priority_control with more general Thread_queue_Operations which will be used for generic priority change, timeout, signal and wait queue operations in the future. Update #2273.
* score: Add scheduler acquire/releaseSebastian Huber2015-03-241-4/+3
| | | | | | | This is currently a global lock for all scheduler instances. It should get replaced with one lock per scheduler instance in the future. Update #2273.
* score: Add thread lockSebastian Huber2015-03-241-6/+13
| | | | Update #2273.
* score: Add thread priority change handlerSebastian Huber2015-03-241-4/+8
| | | | | | | | | | Since the thread current priority change and thread queue requeue is performed in one critical section it is possible to simplify the thread queue requeue procedure. Add a thread queue agnostic thread priority change handler so that we are able to use alternative thread queue implementations. Update #2273.
* score: Fix _Thread_Change_priority()Sebastian Huber2015-03-201-14/+21
| | | | | | | | | | Atomically update the current priority of a thread and the wait queue. Serialize the scheduler update in a separate critical section with a generation number. New test sptests/spintrcritical23. Close #2310.
* score: Update _Thread_Heir only if necessarySebastian Huber2015-03-051-8/+1
| | | | | | | | | | | | | | | | | | | | Previously, the _Thread_Heir was updated unconditionally in case a new heir was determined. The _Thread_Dispatch_necessary was only updated in case the executing thread was preemptible or an internal thread was unblocked. Change this to update the _Thread_Heir and _Thread_Dispatch_necessary only in case the currently selected heir thread is preemptible or a dispatch is forced. Move the schedule decision into the change priority operation and use the schedule operation only in rtems_task_mode() in case preemption is enabled or an ASR dispatch is necessary. This is a behaviour change. Previously, the RTEMS_NO_PREEMPT also prevented signal delivery in certain cases (not always). Now, signal delivery is no longer influenced by RTEMS_NO_PREEMPT. Since the currently selected heir thread is used to determine if a new heir is chosen, non-preemptible heir threads currently not executing now prevent a new heir. This may have an application impact, see change test tm04. Document this change in sp04. Update #2273.
* Thread Queue: Merge discipline subroutines into main methodsJoel Sherrill2014-07-151-48/+1
| | | | | | | | | | | There was a lot of duplication between the discipline subroutines. With the transition to RBTrees for priority discipline, there were only a few lines of source code manipulating the data structure for FIFO and priority. Thus is made sense to fold these back into the main methods. As part of doing this all of the tests for discipline were changed to be in the same order.
* score: Remove scheduler parameter from most opsSebastian Huber2014-06-231-7/+3
| | | | | | | | | | | | | Remove the scheduler parameter from most high level scheduler operations like - _Scheduler_Block(), - _Scheduler_Unblock(), - _Scheduler_Change_priority(), - _Scheduler_Update_priority(), - _Scheduler_Release_job(), and - _Scheduler_Yield(). This simplifies the scheduler operations usage.
* score: Rename _Scheduler_Update()Sebastian Huber2014-06-041-1/+1
| | | | | | Rename _Scheduler_Update() to _Scheduler_Update_priority(). Add parameter for the new thread priority to avoid direct usage of Thread_Control::current_priority in the scheduler operation.
* score: Make _Thread_queue_Requeue() staticSebastian Huber2014-05-151-0/+47
| | | | | | This function is only used by _Thread_Change_priority(). Make it static to avoid the function call overhead in the performance critical function _Thread_Change_priority().
* score: Simplify _Thread_Change_priority()Sebastian Huber2014-05-151-68/+29
| | | | | | | | | | | | | | | | | | | | | | | | The function to change a thread priority was too complex. Simplify it with a new scheduler operation. This increases the average case performance due to the simplified logic. The interrupt disabled critical section is a bit prolonged since now the extract, update and enqueue steps are executed atomically. This should however not impact the worst-case interrupt latency since at least for the Deterministic Priority Scheduler this sequence can be carried out with a wee bit of instructions and no loops. Add _Scheduler_Change_priority() to replace the sequence of - _Thread_Set_transient(), - _Scheduler_Extract(), - _Scheduler_Enqueue(), and - _Scheduler_Enqueue_first(). Delete STATES_TRANSIENT, _States_Is_transient() and _Thread_Set_transient() since this state is now superfluous. With this change it is possible to get rid of the SCHEDULER_SMP_NODE_IN_THE_AIR state. This considerably simplifies the implementation of the new SMP locking protocols.
* score: Static scheduler configurationSebastian Huber2014-04-151-3/+3
| | | | | | Do not allocate the scheduler control structures from the workspace. This is a preparation step for configuration of clustered/partitioned schedulers on SMP.
* score: Add scheduler control to scheduler opsSebastian Huber2014-04-041-6/+7
| | | | | Scheduler operations must be free of a global scheduler context to enable partitioned/clustered scheduling.
* Change all references of rtems.com to rtems.org.Chris Johns2014-03-211-1/+1
|
* score: PR2136: Fix _Thread_Change_priority()Sebastian Huber2013-08-201-4/+10
| | | | | | | | | | | | | | | Add call to _Scheduler_Schedule() in missing path after _Thread_Set_transient() in _Thread_Change_priority(). See also sptests/spintrcritical19. Add thread parameter to _Scheduler_Schedule(). This parameter is currently unused but may be used in future SMP schedulers. Do heir selection in _Scheduler_Schedule(). Use _Scheduler_Update_heir() for this in the particular scheduler implementation. Add and use _Scheduler_Generic_block().
* score: Create threadq implementation headerSebastian Huber2013-07-261-2/+1
| | | | | | | | Move implementation specific parts of tqdata.h, threadq.h and threadq.inl into new header file threadqimpl.h. The threadq.h contains now only the application visible API. Delete tqdata.h.
* score: Create thread implementation headerSebastian Huber2013-07-261-1/+1
| | | | | | | | Move implementation specific parts of thread.h and thread.inl into new header file threadimpl.h. The thread.h contains now only the application visible API. Remove superfluous header file includes from various files.
* score: Create scheduler implementation headerSebastian Huber2013-07-261-4/+2
| | | | | | Move implementation specific parts of scheduler.h and scheduler.inl into new header file schedulerimpl.h. The scheduler.h contains now only the application visible API.
* score misc: Score misc: Clean up Doxygen #6 (GCI 2012)Christopher Kerl2012-11-291-2/+8
| | | | | | | This patch is a task from GCI 2012 which improves the Doxygen comments in the RTEMS source. http://www.google-melange.com/gci/task/view/google/gci2012/7976215
* Remove All CVS Id Strings Possible Using a ScriptJoel Sherrill2012-05-111-2/+0
| | | | | | | | | | | | Script does what is expected and tries to do it as smartly as possible. + remove occurrences of two blank comment lines next to each other after Id string line removed. + remove entire comment blocks which only exited to contain CVS Ids + If the processing left a blank line at the top of a file, it was removed.
* 2011-02-18 Joel Sherrill <joel.sherrill@oarcorp.com>Joel Sherrill2011-02-181-23/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * sapi/include/confdefs.h, score/Makefile.am, score/include/rtems/score/scheduler.h, score/include/rtems/score/schedulerpriority.h, score/include/rtems/score/thread.h, score/inline/rtems/score/scheduler.inl, score/inline/rtems/score/schedulerpriority.inl, score/src/scheduler.c, score/src/schedulerpriority.c, score/src/schedulerpriorityblock.c, score/src/schedulerpriorityschedule.c, score/src/schedulerpriorityunblock.c, score/src/schedulerpriorityyield.c, score/src/threadchangepriority.c, score/src/threadclose.c, score/src/threadinitialize.c, score/src/threadsetpriority.c, score/src/threadsettransient.c: Significant clean up on Scheduler Plugin Interface. Names were shortened. Missing operations added. Many scheduler files had unneeded includes removed. Made pointer to scheduler information in Thread_Control and Scheduler_Control a void * pointer because the thread and scheduler wrapper should be unaware of scheduler types AND this is broken for user provided schedulers. * score/src/schedulerpriorityallocate.c, score/src/schedulerpriorityenqueue.c, score/src/schedulerpriorityenqueuefirst.c, score/src/schedulerpriorityextract.c, score/src/schedulerpriorityfree.c, score/src/schedulerpriorityupdate.c: New files. * score/src/schedulerprioritythreadschedulerallocate.c, score/src/schedulerprioritythreadschedulerfree.c, score/src/schedulerprioritythreadschedulerupdate.c: Removed.
* 2011-02-17 Joel Sherrill <joel.sherrill@oarcorp.com>Joel Sherrill2011-02-171-29/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * sapi/include/confdefs.h, sapi/include/rtems/config.h, score/include/rtems/score/scheduler.h, score/include/rtems/score/schedulerpriority.h, score/inline/rtems/score/scheduler.inl, score/inline/rtems/score/schedulerpriority.inl, score/src/scheduler.c, score/src/schedulerpriority.c, score/src/schedulerpriorityblock.c, score/src/schedulerpriorityschedule.c, score/src/schedulerprioritythreadschedulerallocate.c, score/src/schedulerprioritythreadschedulerfree.c, score/src/schedulerprioritythreadschedulerupdate.c, score/src/schedulerpriorityunblock.c, score/src/schedulerpriorityyield.c, score/src/threadchangepriority.c, score/src/threadclearstate.c, score/src/threadclose.c, score/src/threadinitialize.c, score/src/threadready.c, score/src/threadresume.c, score/src/threadsetpriority.c, score/src/threadsetstate.c, score/src/threadsuspend.c: Simplify the pluggable scheduler interface. Its configuration made a table of available schedulers and set a pointer to one of the. This was heavy handed since you can only use one scheduler in an application. This configuration mechanism resulted in a scheduler pointer being passed around when you could put all scheduler configuration in an initialized structure.
* 2011-01-28 Joel Sherrill <joel.sherrilL@OARcorp.com>Joel Sherrill2011-01-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | * include/rtems/bspIo.h, include/rtems/concat.h, include/rtems/irq.h, score/cpu/i386/rtems/score/idtr.h, score/cpu/powerpc/rtems/powerpc/registers.h, score/src/objectidtoname.c, score/src/schedulerpriorityblock.c, score/src/schedulerpriorityschedule.c, score/src/schedulerpriorityunblock.c, score/src/schedulerpriorityyield.c, score/src/thread.c, score/src/threadchangepriority.c, score/src/threadclearstate.c, score/src/threadclose.c, score/src/threadcreateidle.c, score/src/threaddelayended.c, score/src/threaddispatch.c, score/src/threadget.c, score/src/threadhandler.c, score/src/threadinitialize.c, score/src/threadloadenv.c, score/src/threadready.c, score/src/threadreset.c, score/src/threadrestart.c, score/src/threadresume.c, score/src/threadsetpriority.c, score/src/threadsetstate.c, score/src/threadsettransient.c, score/src/threadstackallocate.c, score/src/threadstackfree.c, score/src/threadstart.c, score/src/threadstartmultitasking.c, score/src/threadsuspend.c, score/src/threadtickletimeslice.c, score/src/threadyieldprocessor.c: Fix typo where license said found in found in.