summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/msm/msm_drv.h
diff options
context:
space:
mode:
authorRob Clark <robdclark@chromium.org>2021-03-31 18:27:19 -0700
committerRob Clark <robdclark@chromium.org>2021-04-07 11:05:42 -0700
commitcc8a4d5a1bd84a37ff1827e2902c459e9b2d4e25 (patch)
tree7de47a94da6e7aee4f9d19cf7be12351b926035a /drivers/gpu/drm/msm/msm_drv.h
parentbc90dc33c46c8b98843f33f40446b7fdb0ba8f1c (diff)
downloadlinux-cc8a4d5a1bd84a37ff1827e2902c459e9b2d4e25.tar.bz2
drm/msm: Avoid mutex in shrinker_count()
When the system is under heavy memory pressure, we can end up with lots of concurrent calls into the shrinker. Keeping a running tab on what we can shrink avoids grabbing a lock in shrinker->count(), and avoids shrinker->scan() getting called when not profitable. Also, we can keep purged objects in their own list to avoid re-traversing them to help cut down time in the critical section further. Signed-off-by: Rob Clark <robdclark@chromium.org> Tested-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Douglas Anderson <dianders@chromium.org> Link: https://lore.kernel.org/r/20210401012722.527712-3-robdclark@gmail.com Signed-off-by: Rob Clark <robdclark@chromium.org>
Diffstat (limited to 'drivers/gpu/drm/msm/msm_drv.h')
-rw-r--r--drivers/gpu/drm/msm/msm_drv.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 591c47a654e8..5cad921c32ba 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -179,8 +179,8 @@ struct msm_drm_private {
* inactive lists (depending on whether or not it is shrinkable) or
* gpu->active_list (for the gpu it is active on[1])
*
- * These lists are protected by mm_lock. If struct_mutex is involved, it
- * should be aquired prior to mm_lock. One should *not* hold mm_lock in
+ * These lists are protected by mm_lock (which should be acquired
+ * before per GEM object lock). One should *not* hold mm_lock in
* get_pages()/vmap()/etc paths, as they can trigger the shrinker.
*
* [1] if someone ever added support for the old 2d cores, there could be
@@ -188,6 +188,8 @@ struct msm_drm_private {
*/
struct list_head inactive_willneed; /* inactive + !shrinkable */
struct list_head inactive_dontneed; /* inactive + shrinkable */
+ struct list_head inactive_purged; /* inactive + purged */
+ long shrinkable_count; /* write access under mm_lock */
struct mutex mm_lock;
struct workqueue_struct *wq;