diff options
author | Christian König <christian.koenig@amd.com> | 2020-11-17 16:35:24 +0100 |
---|---|---|
committer | Christian König <christian.koenig@amd.com> | 2021-01-20 12:57:13 +0100 |
commit | f987c9e0f537222e90dd3214bfc481860fe2abe0 (patch) | |
tree | e09c3c04189c6add1e75476cba0f46a17d7f8c4f /drivers/gpu/drm/ttm | |
parent | drm/ttm: add debugfs entry to test pool shrinker v2 (diff) | |
download | linux-f987c9e0f537222e90dd3214bfc481860fe2abe0.tar.xz linux-f987c9e0f537222e90dd3214bfc481860fe2abe0.zip |
drm/ttm: optimize ttm pool shrinker a bit
Only initialize the DMA coherent pools if they are used.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/414957/
Diffstat (limited to 'drivers/gpu/drm/ttm')
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_pool.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c index 98ecb9c9842c..e0617717113f 100644 --- a/drivers/gpu/drm/ttm/ttm_pool.c +++ b/drivers/gpu/drm/ttm/ttm_pool.c @@ -505,10 +505,12 @@ void ttm_pool_init(struct ttm_pool *pool, struct device *dev, pool->use_dma_alloc = use_dma_alloc; pool->use_dma32 = use_dma32; - for (i = 0; i < TTM_NUM_CACHING_TYPES; ++i) - for (j = 0; j < MAX_ORDER; ++j) - ttm_pool_type_init(&pool->caching[i].orders[j], - pool, i, j); + if (use_dma_alloc) { + for (i = 0; i < TTM_NUM_CACHING_TYPES; ++i) + for (j = 0; j < MAX_ORDER; ++j) + ttm_pool_type_init(&pool->caching[i].orders[j], + pool, i, j); + } } EXPORT_SYMBOL(ttm_pool_init); @@ -524,9 +526,11 @@ void ttm_pool_fini(struct ttm_pool *pool) { unsigned int i, j; - for (i = 0; i < TTM_NUM_CACHING_TYPES; ++i) - for (j = 0; j < MAX_ORDER; ++j) - ttm_pool_type_fini(&pool->caching[i].orders[j]); + if (pool->use_dma_alloc) { + for (i = 0; i < TTM_NUM_CACHING_TYPES; ++i) + for (j = 0; j < MAX_ORDER; ++j) + ttm_pool_type_fini(&pool->caching[i].orders[j]); + } } EXPORT_SYMBOL(ttm_pool_fini); @@ -631,6 +635,11 @@ int ttm_pool_debugfs(struct ttm_pool *pool, struct seq_file *m) { unsigned int i; + if (!pool->use_dma_alloc) { + seq_puts(m, "unused\n"); + return 0; + } + ttm_pool_debugfs_header(m); spin_lock(&shrinker_lock); |