Unevictable memory leak with i915 and dual-DP 5k monitors
On hardware setups described in this thread (Lenovo Carbon X1 v7 with a 4k internal display, connected to a LG 27MD5KL 5k Thunderbolt 2-tile monitor or to a HP Z27q 5k dual-DP 2-tile monitor), I'm experiencing a memory leak that makes long-term work with the machine a nightmare. Facts about the leak:
- There is no obvious culprit process. No crazy resident, shared or virtual memory numbers, no obvious trends.
- The missing memory appears to be in Unevictable in
/proc/meminfo; that number keeps growing. Here's why I think it might be
- It never occurs without an external monitor.
- It never occurs with a single-DP single-tile 4k external monitor.
- It always occurs with a 5k, 2-tile external monitor, at roughly the same rate, no matter if
- an external monitor is on two DisplayPorts, one on a Thunderbolt dock and one on a Thunderbolt→DP adapter.
- an external monitor is on one Thunderbolt (with two DPs internally), daisy-chained through a dock.
- an external monitor is directly on Thunderbolt (with two DPs internally), without a dock in between.
- an eGPU is connected via (the other) Thunderbolt and Google Chrome uses the eGPU for acceleration (Razer Core X Chroma + NVidia Quadro P5000).
kwin_x11 --replacereduces memory consumption, but does not stop the overall growth trend — see the plot below.
- A KDE session restart (logout + login) frees the Unevictable memory; RAM usage gets back to normal before growing again.
- In the worst case (a long period without a logout), memory pressure reaches a point where the OOM killer fires at almost random processes.
This now happens with kernel
5.10.6 and has been happening ever since kernel
5.6.x (where 2-tile 5k monitors worked for the first time, with patches to fix #27 (closed)). I tried to ignore it, logged out and back in every day to circumvent it and hoped it would go away. It has not gone away, presumably.
The plot above shows samples of the Unevictable memory number in
/proc/meminfo, taken nevery 10 seconds (7000 samples ≅ 70000 seconds of operation). This is a typical scenario, basically 100% reproducible. A few side notes:
- 7000000 kB of Unevictable RAM is a big problem on a laptop with 16 GB of RAM. One GB more (or so) already leads to a severe memory pressure, even with <10 browser tabs.
- With a 5k external monitor, a few days of a KDE session are a hard limit; a logout and login is required to reclaim the leaked memory.
- With a 4k external monitor, Unevictable stays below 2 GB (mostly around 1.8 GB) and doesn't grow. KDE sessions can (and did) last for many weeks with no memory issues.