Finding latency issues (stalls) in embedded Linux systems

前端 未结 1 1864
星月不相逢
星月不相逢 2021-02-15 01:01

I have an embedded Linux system running on an Atmel AT91SAM9260EK board on which I have two processes running at real-time priority. A manager process periodically \"pings\" a w

相关标签:
1条回答
  • 2021-02-15 01:49

    The problem is (as you said) syslogd. While your process is running at a RT priority, syslogd is not. Additionally, syslogd does not lock its heap and can (and will) be paged out by the kernel, especially with very few 'customers'.

    What you could try is:

    • Start another thread to manage a priority queue, have that thread talk to syslog. Logging would then just be acquiring a lock and inserting something into a list. Given only two subscribers, you should not spend a lot of time acquiring the mutex.

    • Not using syslog, implement your own logging (basically the first suggestion, minus talking to syslog).

    I had a similar problem and my first attempt to fix it was to modify syslogd itself to lock its heap. That was a disaster. I then tried rsyslogd, which improved some but I still got random latency peaks. I ended up just implementing my own logging using a priority queue to help ensure that more critical messages were actually written first.

    Note, if you are not using swap (at all), the shortest path to fixing this is probably implementing your own logging.

    0 讨论(0)
提交回复
热议问题