summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/msm/msm_drv.h
diff options
context:
space:
mode:
authorRob Clark <robdclark@chromium.org>2021-04-05 10:45:29 -0700
committerRob Clark <robdclark@chromium.org>2021-04-07 11:05:47 -0700
commit64fcbde772c72af81e96189d748a4bc8950b08d3 (patch)
tree187b7eca148b40daa4d8959c930ccd31b8c89f73 /drivers/gpu/drm/msm/msm_drv.h
parentf48f356330f7124671b28ddc93a28c492ef05b9f (diff)
drm/msm: Track potentially evictable objects
Objects that are potential for swapping out are (1) willneed (ie. if they are purgable/MADV_WONTNEED we can just free the pages without them having to land in swap), (2) not on an active list, (3) not dma-buf imported or exported, and (4) not vmap'd. This repurposes the purged list for objects that do not have backing pages (either because they have not been pinned for the first time yet, or in a later patch because they have been unpinned/evicted. Signed-off-by: Rob Clark <robdclark@chromium.org> Link: https://lore.kernel.org/r/20210405174532.1441497-7-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.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 6a42cdf4cf7e..2668941df529 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -182,11 +182,15 @@ struct msm_drm_private {
struct mutex obj_lock;
/**
- * Lists of inactive GEM objects. Every bo is either in one of the
+ * LRUs of inactive GEM objects. Every bo is either in one of the
* inactive lists (depending on whether or not it is shrinkable) or
* gpu->active_list (for the gpu it is active on[1]), or transiently
* on a temporary list as the shrinker is running.
*
+ * Note that inactive_willneed also contains pinned and vmap'd bos,
+ * but the number of pinned-but-not-active objects is small (scanout
+ * buffers, ringbuffer, etc).
+ *
* 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.
@@ -194,10 +198,11 @@ struct msm_drm_private {
* [1] if someone ever added support for the old 2d cores, there could be
* more than one gpu object
*/
- struct list_head inactive_willneed; /* inactive + !shrinkable */
- struct list_head inactive_dontneed; /* inactive + shrinkable */
- struct list_head inactive_purged; /* inactive + purged */
+ struct list_head inactive_willneed; /* inactive + potentially unpin/evictable */
+ struct list_head inactive_dontneed; /* inactive + shrinkable */
+ struct list_head inactive_unpinned; /* inactive + purged or unpinned */
long shrinkable_count; /* write access under mm_lock */
+ long evictable_count; /* write access under mm_lock */
struct mutex mm_lock;
struct workqueue_struct *wq;