How to improve real-time performance of 1 ms timer in Linux?

I am working on an embedded Linux project using the arago distribution, which is probably around version 3.3.

I set up a high-resolution Linux timer to wake my process up once in a millisecond. This works fine, but there are two problems with synchronization:

  • Jitter while waking up
  • The variability of the processing time upon waking, despite the fact that the processing performed by the process is constant.

I attribute these issues to Linux performance to a lesser extent than in real time. But I need to explore ways to improve real-time performance.

I checked that the kernel is configured with the CONFIG_PREEMPT kernel parameter, which is good for real time.

I also applied the SCHED_FIFO scheduling class to my process:

struct sched_param schedparm; memset(&schedparm, 0, sizeof(schedparm)); schedparm.sched_priority = 1; // lowest rt priority sched_setscheduler(0, SCHED_FIFO, &schedparm); 

but it didn’t matter.

I assume that the logical step is to apply the PREEMPT_RT patch to the kernel assembly, but I have not yet decided how to do this.

Is there anything else I can do to improve the jitter / duration variability?

Or can anyone suggest an affordable tutorial on how to apply the PREEMPT_RT patch?

+4
source share
2 answers

PREEMPT_RT seems to be the logical next step. Have you tried this tutorial?

https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO

Update: I suggest you watch how others create a proactive kernel, for example. Here: https://aur.archlinux.org/packages/linux-rt/

You can read PKGBUILD to understand what has been done.

+1
source

If you are using Debian or LMDE testing, then they have a precompiled PREEMPT_RT kernel in the repo for x86 and amd64 architectures.

 apt-get install linux-image-rt-686-pae 

or

 apt-get install linux-image-rt-amd64 
0
source

All Articles