per-process/context memory usage accounting for i915
@eero-t
Submitted by Eero Tamminen Assigned to Francesco Balestrieri @baleboy
Link to original bug (#106136)
Description
This is follow up for bug 106106, where X server leaks gigabytes of dirty memory, which gets swapped out until swap fills completely, and that doesn't show up anywhere else than in debugfs (if one knows where to look into) & /proc/meminfo SwapFree value.
I think this has several problems:
- It's (mostly) process specific memory usage that isn't visible in /proc like rest of memory usage. Even slab and vmalloc usage is visible in /proc, so GEM object memory usage should be there too, not just in debugfs
* As a result, huge memory leakage can go completely unnoticed if developer just has enough memory on his own machine. Causes for such problems get harder to track down, the longer it takes to detect what is the actual issue
* This memory doesn't seem to be taken into account when kernel calculates process OOM score (kernel killed most of my other processes instead of X)
* I assume this memory usage also avoids normal memory usage limits (e.g. cgroups). Nasty process is free to cause gigs of GEM object usage, so that other processes get restricted & OOM killed, and device slowed down by swapping, without it itself being caught out
I guess solving this requires GEM API through which i915 reports its memory usage, and it's GEM responsibility to provide that information where appropriate.