drm/msm/shrinker: Only iterate dontneed objs
authorRob Clark <robdclark@chromium.org>
Mon, 16 Nov 2020 17:48:51 +0000 (09:48 -0800)
committerRob Clark <robdclark@chromium.org>
Sat, 21 Nov 2020 17:50:24 +0000 (09:50 -0800)
commit3edfa30f2340e6c361b34fc0c53a5f3d3bbf9704
treed234a13a566eeee447a9573ff4c80e57f8884353
parentfcd371c23c3a0a89bf6f3f415b14f75658c55c1c
drm/msm/shrinker: Only iterate dontneed objs

In situations where the GPU is mostly idle, all or nearly all buffer
objects will be in the inactive list.  But if the system is under memory
pressure (from something other than GPU), we could still get a lot of
shrinker calls.  Which results in traversing a list of thousands of objs
and in the end finding nothing to shrink.  Which isn't so efficient.

Instead split the inactive_list into two lists, one inactive objs which
are shrinkable, and a second one for those that are not.  This way we
can avoid traversing objs which we know are not shrinker candidates.

v2: Fix inverted logic think-o

Signed-off-by: Rob Clark <robdclark@chromium.org>
drivers/gpu/drm/msm/msm_debugfs.c
drivers/gpu/drm/msm/msm_drv.c
drivers/gpu/drm/msm/msm_drv.h
drivers/gpu/drm/msm/msm_gem.c
drivers/gpu/drm/msm/msm_gem_shrinker.c