diff options
author | Dmitry Osipenko <[email protected]> | 2022-11-04 19:04:59 +0300 |
---|---|---|
committer | Dmitry Osipenko <[email protected]> | 2023-02-27 07:06:56 +0300 |
commit | 9630b585b607bd26f505d34620b14d75b9a5af7d (patch) | |
tree | 46eb1c8f9016be79477886fc966a5b6ce4480544 /tools/testing/selftests/bpf/progs/test_autoload.c | |
parent | ee9adb7a45516cfa536ca92253d7ae59d56db9e4 (diff) |
drm/msm/gem: Prevent blocking within shrinker loop
Consider this scenario:
1. APP1 continuously creates lots of small GEMs
2. APP2 triggers `drop_caches`
3. Shrinker starts to evict APP1 GEMs, while APP1 produces new purgeable
GEMs
4. msm_gem_shrinker_scan() returns non-zero number of freed pages
and causes shrinker to try shrink more
5. msm_gem_shrinker_scan() returns non-zero number of freed pages again,
goto 4
6. The APP2 is blocked in `drop_caches` until APP1 stops producing
purgeable GEMs
To prevent this blocking scenario, check number of remaining pages
that GPU shrinker couldn't release due to a GEM locking contention
or shrinking rejection. If there are no remaining pages left to shrink,
then there is no need to free up more pages and shrinker may break out
from the loop.
This problem was found during shrinker/madvise IOCTL testing of
virtio-gpu driver. The MSM driver is affected in the same way.
Reviewed-by: Rob Clark <[email protected]>
Reviewed-by: Thomas Zimmermann <[email protected]>
Fixes: b352ba54a820 ("drm/msm/gem: Convert to using drm_gem_lru")
Signed-off-by: Dmitry Osipenko <[email protected]>
Link: https://lore.kernel.org/all/[email protected]/
Diffstat (limited to 'tools/testing/selftests/bpf/progs/test_autoload.c')
0 files changed, 0 insertions, 0 deletions