Lines Matching refs:pool
14 bucket_for_size(struct intel_gt_buffer_pool *pool, size_t sz) in bucket_for_size() argument
24 if (n >= ARRAY_SIZE(pool->cache_list)) in bucket_for_size()
25 n = ARRAY_SIZE(pool->cache_list) - 1; in bucket_for_size()
27 return &pool->cache_list[n]; in bucket_for_size()
37 static bool pool_free_older_than(struct intel_gt_buffer_pool *pool, long keep) in pool_free_older_than() argument
44 for (n = 0; n < ARRAY_SIZE(pool->cache_list); n++) { in pool_free_older_than()
45 struct list_head *list = &pool->cache_list[n]; in pool_free_older_than()
50 if (spin_trylock_irq(&pool->lock)) { in pool_free_older_than()
73 spin_unlock_irq(&pool->lock); in pool_free_older_than()
89 struct intel_gt_buffer_pool *pool = in pool_free_work() local
90 container_of(wrk, typeof(*pool), work.work); in pool_free_work()
91 struct intel_gt *gt = container_of(pool, struct intel_gt, buffer_pool); in pool_free_work()
93 if (pool_free_older_than(pool, HZ)) in pool_free_work()
94 queue_delayed_work(gt->i915->unordered_wq, &pool->work, in pool_free_work()
102 struct intel_gt_buffer_pool *pool = node->pool; in pool_retire() local
103 struct intel_gt *gt = container_of(pool, struct intel_gt, buffer_pool); in pool_retire()
104 struct list_head *list = bucket_for_size(pool, node->obj->base.size); in pool_retire()
116 spin_lock_irqsave(&pool->lock, flags); in pool_retire()
119 spin_unlock_irqrestore(&pool->lock, flags); in pool_retire()
121 queue_delayed_work(gt->i915->unordered_wq, &pool->work, in pool_retire()
139 node_create(struct intel_gt_buffer_pool *pool, size_t sz, in node_create() argument
142 struct intel_gt *gt = container_of(pool, struct intel_gt, buffer_pool); in node_create()
152 node->pool = pool; in node_create()
174 struct intel_gt_buffer_pool *pool = >->buffer_pool; in intel_gt_get_buffer_pool() local
180 list = bucket_for_size(pool, size); in intel_gt_get_buffer_pool()
197 spin_lock_irq(&pool->lock); in intel_gt_get_buffer_pool()
199 spin_unlock_irq(&pool->lock); in intel_gt_get_buffer_pool()
206 node = node_create(pool, size, type); in intel_gt_get_buffer_pool()
222 struct intel_gt_buffer_pool *pool = >->buffer_pool; in intel_gt_init_buffer_pool() local
225 spin_lock_init(&pool->lock); in intel_gt_init_buffer_pool()
226 for (n = 0; n < ARRAY_SIZE(pool->cache_list); n++) in intel_gt_init_buffer_pool()
227 INIT_LIST_HEAD(&pool->cache_list[n]); in intel_gt_init_buffer_pool()
228 INIT_DELAYED_WORK(&pool->work, pool_free_work); in intel_gt_init_buffer_pool()
233 struct intel_gt_buffer_pool *pool = >->buffer_pool; in intel_gt_flush_buffer_pool() local
236 while (pool_free_older_than(pool, 0)) in intel_gt_flush_buffer_pool()
238 } while (cancel_delayed_work_sync(&pool->work)); in intel_gt_flush_buffer_pool()
243 struct intel_gt_buffer_pool *pool = >->buffer_pool; in intel_gt_fini_buffer_pool() local
246 for (n = 0; n < ARRAY_SIZE(pool->cache_list); n++) in intel_gt_fini_buffer_pool()
247 GEM_BUG_ON(!list_empty(&pool->cache_list[n])); in intel_gt_fini_buffer_pool()