Hello Nathalie, Den 2025-09-01 kl. 14:45, skrev Natalie Vock: > Hi, > > On 8/19/25 13:49, Maarten Lankhorst wrote: >> When exporting dma-bufs to other devices, even when it is allowed to use >> move_notify in some drivers, performance will degrade severely when >> eviction happens. >> >> A perticular example where this can happen is in a multi-card setup, >> where PCI-E peer-to-peer is used to prevent using access to system memory. >> >> If the buffer is evicted to system memory, not only the evicting GPU wher >> the buffer resided is affected, but it will also stall the GPU that is >> waiting on the buffer. >> >> It also makes sense for long running jobs not to be preempted by having >> its buffers evicted, so it will make sense to have the ability to pin >> from system memory too. >> >> This is dependant on patches by Dave Airlie, so it's not part of this >> series yet. But I'm planning on extending pinning to the memory cgroup >> controller in the future to handle this case. >> >> Implementation details: >> >> For each cgroup up until the root cgroup, the 'min' limit is checked >> against currently effectively pinned value. If the value will go above >> 'min', the pinning attempt is rejected. > > Why do you want to reject pins in this case? What happens in desktop usecases > (e.g. PRIME buffer sharing)? AFAIU, you kind of need to be able to pin > buffers and export them to other devices for that whole thing to work, right? > If the user doesn't explicitly set a min value, wouldn't the value being zero > mean any pins will be rejected (and thus PRIME would break)? > > If your objective is to prevent pinned buffers from being evicted, perhaps > you could instead make TTM try to avoid evicting pinned buffers and prefer > unpinned buffers as long as there are unpinned buffers to evict? As long as > the total amount of pinned memory stays below min, no pinned buffers should > get evicted with that either. That would be setting an eviction priority, that can be done but that gives no guarantee memory will not be evicted.
Kind regards, ~Maarten
