This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
realtime:documentation:technical_preempt_rt [2016/12/28 01:54] ayates1 |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Technical details of PREEMPT_RT patch ====== | ||
- | The main aim of the PREEMPT_RT patch is to //minimize the amount of kernel code that is non-preemptible// ((Paul McKenney, A realtime preemption overview [[https://lwn.net/Articles/146861/]])). Therefore different mechanisms are implemented. Those mechanisms are partially available in mainline Linux. | ||
- | |||
- | ---- | ||
- | |||
- | <WRAP half column> | ||
- | ===== High resolution timers ===== | ||
- | |||
- | The high resolution timers patch is maintained by small group of core developers, led by Thomas Gleixner. It allows precise timed scheduling and removes the dependency of timers on the periodic scheduler tick (jiffies). Thomas and Ingo wrote high resolution timer design notes which explain the implementation details. | ||
- | Since 2.6.24-rc1 the high resolution timer patch are fully merged and so the project is in "history mode". | ||
- | Historically the high resolution timer patch was also integrated in the realtime preemption patch. | ||
- | |||
- | <WRAP rightalign>[[realtime:documentation:hr_timers|Read more about High Resolution Timers]]</WRAP> | ||
- | </WRAP> | ||
- | |||
- | <WRAP half column> | ||
- | ===== Sleeping spinlocks ===== | ||
- | |||
- | In a non-PREEMPT-RT preemption model spinlocks are mapped onto raw spinlocks. A task waiting for a spinlock held by another task spins until the task holding the spinlock releases it. Preemption is disabled in raw spinlock context. In PREEMPT_RT spinlocks are mapped onto sleeping spinlocks, and raw spinlocks retain their behavior. A task waiting for a sleeping spinlock goes to sleep and is woken up when the spinlock is released. In the sleeping spinlock context preemption is not disabled. | ||
- | |||
- | <WRAP rightalign>[[realtime:documentation:sleeping_spinlocks|Read more about sleeping spinlocks]]</WRAP> | ||
- | |||
- | </WRAP> | ||
- | |||
- | <WRAP half column> | ||
- | ===== Threaded interrupt handler ===== | ||
- | |||
- | The PREEMPT_RT patch forces the mechanism of threaded interrupt handlers. Due to this all interrupt handlers run in a threaded context except they are marked with the IRQF_NO_THREAD flag. This mechanism can be forced also in Linux mainline kernel without PREEMPT_RT patch by the kernel command line option ''threadirqs''. But there is a small difference in the resulted behavior. | ||
- | |||
- | <WRAP rightalign>[[realtime:documentation:threadirq|Read more about threaded interrupt handlers]]</WRAP> | ||
- | </WRAP> | ||
- | |||
- | <WRAP half column> | ||
- | ===== rt_mutex ===== | ||
- | |||
- | All mutexes in the mainline Linux kernel are replaced by rt_mutexes. A rt_mutex implements priority inheritance to avoid priority inversion. This also applies to sleeping spinlocks and rwlocks. However, the holder of a semaphore can be preempted but does not participate in priority inheritance. | ||
- | |||
- | <WRAP rightalign>[[realtime:documentation:rt_mutex|Read more about rt_mutex]]</WRAP> | ||
- | </WRAP> | ||
- | |||
- | <WRAP half column> | ||
- | ===== RCU ===== | ||
- | |||
- | RCU mechanisms in mainline Linux are only preemptible if CONFIG_PREEMPT is set (Preemption model: "Low-Latency Desktop"). The PREEMPT_RT preemption models both use preemptible RCU mechanisms. Additionally the PREEMPT_RT patch eliminates RCU handling from all intermediate states and processes it only in its own thread. | ||
- | |||
- | <WRAP rightalign>[[realtime:documentation:rcu|Read more about RCU]]</WRAP> | ||
- | |||
- | </WRAP> |