Preempt-rt
From ArmadeusWiki
preempt-rt are a series of patches to improve Linux kernel realtime performances. This page explain how to use it.
Installation
- Depending on your board, you may have a Buildroot defconfig to apply preempt-rt automatically. For example:
$ make opos6ul-preempt-rt_defconfig
Usage
- You can change realtime priority of tasks with chrt. For example to set process X to priority 20 in FIFO scheduling queue, you have to do:
# chrt -p -f 20 X pid X's current scheduling policy: SCHED_OTHER pid X's current scheduling priority: 0 pid X's new scheduling policy: SCHED_FIFO pid X's new scheduling priority: 20
- The more priority you set, the more your process is prioritary.
- Priority queues are OTHER (no realtime), FIFO (First In First Out), RR (Round Robin time share)
- You can validate realtime performances of your system with cyclictest. For example to launch 10 processes triggering on timer set to 10ms with different descending priorities, you can do:
# cyclictest -t 10 -p 20 -n -i 10000 --priospread /dev/cpu_dma_latency set to 0us policy: fifo: loadavg: 0.45 0.23 0.10 1/86 230 T: 0 ( 219) P:99 I:10000 C: 34012 Min: 67 Act: 166 Avg: 174 Max: 536 T: 1 ( 220) P:98 I:10500 C: 32393 Min: 76 Act: 228 Avg: 202 Max: 719 T: 2 ( 221) P:97 I:11000 C: 30920 Min: 66 Act: 170 Avg: 197 Max: 1154 T: 3 ( 222) P:96 I:11500 C: 29576 Min: 65 Act: 217 Avg: 194 Max: 1176 T: 4 ( 223) P:95 I:12000 C: 28343 Min: 72 Act: 167 Avg: 194 Max: 1912 ...
- times are in microseconds