Total Pageviews

Sunday 15 July 2018

ubuntu 16.04的低延迟内核

在某些特殊环境中,比如音视频实时处理(比如MIDI),无线电数据的编解码(比如OpenAirInterface- https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/OpenAirKernelMainSetup
明确要求使用低延时内核)等情况下,我们希望系统尽可能的实时,同时又不会降低太多的性能(实时性越高,性能,功耗等的损失越大)。这种情况下,我们可以尝试使用低延时内核。

Linux提供了五种内核类型,对于内核类型的选择,可以参考如下的解释:
    If you do not require low latency for your system then please use the -generic kernel.
    If you need a low latency system (e.g. for recording audio) then please use the -preempt kernel as a fist choice. This reduces latency but doesn't sacrifice power saving features. It is available only for 64 bit systems (also called amd64).
    If the -preempt kernel does not provide enough low latency for your needs (or you have an 32 bit system) then you should try the -lowlatency kernel.
    If the -lowlatency kernel isn't enough then you should try the -rt kernel
    If the -rt kernel isn't enough stable for you then you should try the -realtime kernel

目前(2018.02)为止,ubuntu官方库中提供前四种内核,我们一般建议使用lowlatency版本。可以使用如下命令安装:
$ sudo apt-get install linux-lowlatency
$ sudo apt-get install linux-image-`uname -r | cut -d- -f1-2`-lowlatency
$ sudo apt-get install linux-headers-`uname -r | cut -d- -f1-2`-lowlatency

# 重启加载新内核
$ sudo reboot


目前,如果机器上使用了nvidia显卡,并且使用nvidia的闭源驱动的情况下,重启机器会无法进入图形界面,查看系统日志,出现如下错误信息:
$ cat /var/log/syslog | grep dkms
Feb 28 16:23:01 xx-System-Product-Name gpu-manager[831]: Error: can't open /lib/modules/4.13.0-36-lowlatency/updates/dkms

   解决方法如下:
#目前最新版本驱动是384版本,如果使用的其他版本,请配置使用的版本
$ sudo dpkg-reconfigure nvidia-384

注意,使用sudo apt-get dist-upgrade升级内核的时候,内核会被替换成generic版本,低延时内核需要手工重新安装一遍。

参考链接:



No comments:

Post a Comment