[PERF] VulkanVblankThr at nice 0: dropped frames under CPU load (much worse with Linux 7.3's default cgroup_mode)
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 28/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- linux
- Área
- operating-systems, performance
Línea de trabajo
Start by reproducing with stress-ng --cpu $(nproc) and comparing /proc/<tid>/schedstat for VulkanVblankThr at nice 0 versus chrt -r -p 90, as the report does. The attached tools include vblank_ab.sh, cgmode_ab.sh, plot_ab.py and xr_pacing_probe.c; use the A/B block method to separate scheduling changes from run-to-run noise. Done would be a SteamVR-side policy that gives this thread realtime priority when CAP_SYS_NICE is available, with dropped-frame counts near the SCHED_RR 90 column under the same load.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
vrcompositor's VulkanVblankThr runs as SCHED_OTHER at nice 0 (RenderThread and SignalThread get nice -10). On Linux 7.3.4, when every CPU thread is busy, it spends 250-445 ms of each second runnable but waiting for a CPU, and the compositor drops roughly 400 to 1200 frames a minute (of 5400 at 90 Hz). If I give that one thread a realtime priority with chrt, the waiting goes to under 0.3 ms a second and the drops to 20-60 a minute. They come back as soon as I undo it. nice -10 is not enough: 173 a minute under the load where SCHED_RR 90 gets 20.
Linux 7.3's new default cgroup weight mode makes it much worse (concur, https://github.com/torvalds/linux/commit/fb1050ac8e40aaa014291b5b53612d27890c2b09): a cgroup's weight now grows with the number of its runnable threads, so a 32-thread job weighs far more against a single nice 0 thread in another cgroup than it used to. Switching back to the old formula inside one session (echo smp > /sys/kernel/debug/sched/cgroup_mode) takes the drops from 1049 a minute to 127.
To Reproduce
- Start SteamVR and an app (I used
hello_xr -g Vulkanfrom the OpenXR SDK), headset awake, frame timing graph open stress-ng --cpu $(nproc)in a terminalps -T -o tid,cls,rtprio,ni,comm -p $(pgrep -x vrcompositor) | grep Vblankfor the thread id, thensudo chrt -r -p 90 <tid>: most of the drops stopsudo chrt -o -p 0 <tid>: they come backcat /proc/$(pgrep -x vrcompositor)/task/<tid>/schedstatbefore and after each step: the second number is the time in ns the thread was runnable but not running
vblank_ab.sh in the attached tools zip does the switching in 90 s blocks (A B B A) and prints the numbers below; cgmode_ab.sh switches the kernel's mode instead.
Expected behavior
CPU load elsewhere on the machine doesn't turn into hundreds of dropped frames a minute. A realtime priority for VulkanVblankThr when vrcompositor has CAP_SYS_NICE would do that here.
System Information (please complete the following information):
- Distribution: Arch Linux, kernel 7.3.4
- SteamVR version: 2.19.3 beta (build 26655409). Same thread policy and the same picture on 2.18.4.
- Steam client version: 1794536281
- Opted into Steam client beta?: No
- Graphics driver version: NVIDIA 620.70.06, open kernel modules
- Gist for SteamVR System Information: not attached; I can add one if it helps. Bigscreen Beyond 2e at 90 Hz, Lighthouse tracking, KWin 6.8.2 (Wayland, DRM lease), Mesa 26.2.7.
Performance Data (optional, but very helpful):
- CPU: i9-14900KS (32 threads)
- GPU: RTX 4090
- Gist for perf top:
perf sched latencyfor the thread is in the results zip. Per wakeup under load: 1.1 ms on average and up to 51 ms at nice 0, 1.6 µs on average at SCHED_RR 90. - Link to gpuvis trace: none captured. I can make one if it helps.
Dropped frames per minute (sum of m_nNumDroppedFrames). VulkanVblankThr was switched every 90 s between nice 0 (A) and SCHED_RR 90 (B) in the order A B B A, the first 5 s of each block not counted; brackets give the lowest and highest block. SteamVR 2.19.3 unless noted:
| App, load | nice 0 (as shipped) | SCHED_RR 90 |
|---|---|---|
my test app, stress-ng --cpu 32, 8 blocks |
1216 (1084-1383) | 20 (16-23) |
my test app, kernel build (make -j32), 4 blocks |
764 | 57 |
hello_xr, stress-ng --cpu 32, 4 blocks |
422 | 28 |
SteamVR 2.18.4, my test app, stress-ng --cpu 32, 4 blocks of 60 s |
801 | 22 |
The thread is busy: at SCHED_RR 90 it uses 77-79 ms of CPU per second with hello_xr and 178-195 with my test app.
The kernel's part: cgroup weight mode switched every 60 s inside one session (S C C S S C C S), same load, thread as shipped unless noted:
smp (formula of 7.2 and earlier) |
concur (7.3 default) |
|
|---|---|---|
| my test app | 127 | 1049 |
| my test app, VulkanVblankThr at SCHED_RR 90 (4 blocks) | 1 | 12 |
hello_xr |
57 | 416 |
Screenshots
Dropped frames per 5 s for the first row of each table (drawn by plot_ab.py):
Additional context
- My test app is
xr_pacing_probe.cin the tools zip: about 2 ms of CPU and 4.5 ms of GPU work per frame. - Measured on my daily desktop with its usual background jobs running. The comparison inside each session is the evidence.
- RenderThread and SignalThread at SCHED_RR 99 instead of nice -10 made it worse under the same load: 1275 dropped frames a minute against 986 with the vblank thread at nice 0, 42 against 16 with it at SCHED_RR 90 (
renderthread-rr99.txtin the results zip).
Note: Commenters who are also experiencing this issue are encouraged to include the "System Information" and "Perf Data" sections in their replies.
- Lenguaje dominante
- Shell
- Estrellas
- 1.2k
- Forks
- 58
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de ValveSoftware/SteamVR-for-Linux
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
ValveSoftware/SteamVR-for-Linux#981 · 4 comentarios · 1 reacción ·
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
ValveSoftware/SteamVR-for-Linux#1097 ·
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
ValveSoftware/SteamVR-for-Linux#1095 · 2 comentarios ·
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
ValveSoftware/SteamVR-for-Linux#1094 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
ValveSoftware/SteamVR-for-Linux#1093 ·
Todos los issues de ValveSoftware/SteamVR-for-Linux
Issues similares
-
Bump runtime to 26.08Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
flathub/cc.arduino.IDE2#168 ·
-
area:docs community needs-triage
Dificultad 1/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
NetSparkleUpdater/NetSparkle#759 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
sidebandstudio/clawtrate#1114 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100