aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/prio_sem.c
Commit message (Collapse)AuthorAge
* Implement the pi semaphore stack.Glenn Elliott2010-08-03
This patch continues the work to implement a generic pi framework. Under this framework, each task_struct maintains a stack of held locks, in the order they are acquired. This stack is mainly used to determine the proper inheritance when a lock is released. On release, the releasing job iterates through its semaphore stack to determine if it blocks a higher priority job and inherits the proper priority as needed. The stack is needed since a blocked job cannot push this information to the lock holder because the inheritance may not take place immediately when the job is blocked. Stack operations include push, pop, update, and peek. The semaphore stack is really only useful to protocols that support traditional nesting. Protocols that do not use traditional nesting, such as FMLP-Long, do not need a stack to track inheritance. So, struct rt_param now also has a task_struct pointer, eff_priority. eff_priority is used in almost the same way was rt_param.inh_task was used in the original FMLP implementation. The slight difference is that eff_priority is set to equal to self when a job acquires a semaphore with no inheritance. This is stylistically similar to FMLP using a semaphore stack. Note that FMLP-Long completely forgoes the use of semaphore stack and only uses eff_priority. Finally, it is intended that eff_priority also be used with nested protocols. A job using a nested protocol would set eff_priority equal to the highest priority received from all held locks. Thus, eff_priority caches the priority a job inherits (the semaphore stack does not need to be iterated through each time the job's priority is required).