[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240125111946.797a1e1e@collabora.com>
Date: Thu, 25 Jan 2024 11:19:46 +0100
From: Boris Brezillon <boris.brezillon@...labora.com>
To: Dmitry Osipenko <dmitry.osipenko@...labora.com>
Cc: David Airlie <airlied@...il.com>, Gerd Hoffmann <kraxel@...hat.com>,
Gurchetan Singh <gurchetansingh@...omium.org>, Chia-I Wu
<olvaffe@...il.com>, Daniel Vetter <daniel@...ll.ch>, Maarten Lankhorst
<maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>, Christian König
<christian.koenig@....com>, Qiang Yu <yuq825@...il.com>, Steven Price
<steven.price@....com>, Emma Anholt <emma@...olt.net>, Melissa Wen
<mwen@...lia.com>, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, kernel@...labora.com,
virtualization@...ts.linux-foundation.org
Subject: Re: [PATCH v19 22/30] drm/shmem-helper: Add common memory shrinker
On Fri, 5 Jan 2024 21:46:16 +0300
Dmitry Osipenko <dmitry.osipenko@...labora.com> wrote:
> +static bool drm_gem_shmem_is_evictable(struct drm_gem_shmem_object *shmem)
> +{
> + return (shmem->madv >= 0) && shmem->base.funcs->evict &&
> + refcount_read(&shmem->pages_use_count) &&
> + !refcount_read(&shmem->pages_pin_count) &&
> + !shmem->base.dma_buf && !shmem->base.import_attach &&
> + !shmem->evicted;
Are we missing
&& dma_resv_test_signaled(shmem->base.resv,
DMA_RESV_USAGE_BOOKKEEP)
to make sure the GPU is done using the BO?
The same applies to drm_gem_shmem_is_purgeable() BTW.
If you don't want to do this test here, we need a way to let drivers
provide a custom is_{evictable,purgeable}() test.
I guess we should also expose drm_gem_shmem_shrinker_update_lru_locked()
to let drivers move the GEMs that were used most recently (those
referenced by a GPU job) at the end of the evictable LRU.
> +}
> +
Powered by blists - more mailing lists