11.8. 为 PTP 硬件配置 FIFO 优先级调度
在需要低延迟性能的电信或其他部署配置中,PTP 守护进程线程在受限制的 CPU 占用空间以及剩余的基础架构组件一起运行。默认情况下,PTP 线程使用 SCHED_OTHER
策略运行。在高负载下,这些线程可能没有获得无错操作所需的调度延迟。
要缓解潜在的调度延迟错误,您可以将 PTP Operator linuxptp
服务配置为允许线程使用 SCHED_FIFO
策略运行。如果为 PtpConfig
CR 设置了 SCHED_FIFO
,则 ptp4l
和 phc2sys
将在 chrt
的父容器中运行,且由 PtpConfig
CR 的 ptpSchedulingPriority
字段设置。
注意
设置 ptpSchedulingPolicy
是可选的,只有在遇到延迟错误时才需要。
流程
编辑
PtpConfig
CR 配置集:$ oc edit PtpConfig -n openshift-ptp
更改
ptpSchedulingPolicy
和ptpSchedulingPriority
字段:apiVersion: ptp.openshift.io/v1 kind: PtpConfig metadata: name: <ptp_config_name> namespace: openshift-ptp ... spec: profile: - name: "profile1" ... ptpSchedulingPolicy: SCHED_FIFO 1 ptpSchedulingPriority: 10 2
-
保存并退出,以将更改应用到
PtpConfig
CR。
验证
获取
linuxptp-daemon
pod 的名称以及应用PtpConfig
CR 的对应节点:$ oc get pods -n openshift-ptp -o wide
输出示例
NAME READY STATUS RESTARTS AGE IP NODE linuxptp-daemon-gmv2n 3/3 Running 0 1d17h 10.1.196.24 compute-0.example.com linuxptp-daemon-lgm55 3/3 Running 0 1d17h 10.1.196.25 compute-1.example.com ptp-operator-3r4dcvf7f4-zndk7 1/1 Running 0 1d7h 10.129.0.61 control-plane-1.example.com
检查
ptp4l
进程是否使用更新的chrt
FIFO 运行:$ oc -n openshift-ptp logs linuxptp-daemon-lgm55 -c linuxptp-daemon-container|grep chrt
输出示例
I1216 19:24:57.091872 1600715 daemon.go:285] /bin/chrt -f 65 /usr/sbin/ptp4l -f /var/run/ptp4l.0.config -2 --summary_interval -4 -m