11.8. 为 PTP 硬件配置 FIFO 优先级调度

在需要低延迟性能的电信或其他部署配置中,PTP 守护进程线程在受限制的 CPU 占用空间以及剩余的基础架构组件一起运行。默认情况下,PTP 线程使用 SCHED_OTHER 策略运行。在高负载下,这些线程可能没有获得无错操作所需的调度延迟。

要缓解潜在的调度延迟错误,您可以将 PTP Operator linuxptp 服务配置为允许线程使用 SCHED_FIFO 策略运行。如果为 PtpConfig CR 设置了 SCHED_FIFO,则 ptp4lphc2sys 将在 chrt 的父容器中运行,且由 PtpConfig CR 的 ptpSchedulingPriority 字段设置。

注意

设置 ptpSchedulingPolicy 是可选的,只有在遇到延迟错误时才需要。

流程

  1. 编辑 PtpConfig CR 配置集:

    $ oc edit PtpConfig -n openshift-ptp
  2. 更改 ptpSchedulingPolicyptpSchedulingPriority 字段:

    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
    1
    ptp4lphc2sys 进程的调度策略。在支持 FIFO 调度的系统上使用 SCHED_FIFO
    2
    必需。设置整数值 1-65,用于为 ptp4lphc2sys 进程配置 FIFO 优先级。
  3. 保存并退出,以将更改应用到 PtpConfig CR。

验证

  1. 获取 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

  2. 检查 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