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()
92 if (pool_free_older_than(pool, HZ)) in pool_free_work()
93 schedule_delayed_work(&pool->work, in pool_free_work()
101 struct intel_gt_buffer_pool *pool = node->pool; in pool_retire() local
102 struct list_head *list = bucket_for_size(pool, node->obj->base.size); in pool_retire()
114 spin_lock_irqsave(&pool->lock, flags); in pool_retire()
117 spin_unlock_irqrestore(&pool->lock, flags); in pool_retire()
119 schedule_delayed_work(&pool->work, in pool_retire()
137 node_create(struct intel_gt_buffer_pool *pool, size_t sz, in node_create() argument
140 struct intel_gt *gt = container_of(pool, struct intel_gt, buffer_pool); in node_create()
150 node->pool = pool; in node_create()
172 struct intel_gt_buffer_pool *pool = >->buffer_pool; in intel_gt_get_buffer_pool() local
178 list = bucket_for_size(pool, size); in intel_gt_get_buffer_pool()
195 spin_lock_irq(&pool->lock); in intel_gt_get_buffer_pool()
197 spin_unlock_irq(&pool->lock); in intel_gt_get_buffer_pool()
204 node = node_create(pool, size, type); in intel_gt_get_buffer_pool()
220 struct intel_gt_buffer_pool *pool = >->buffer_pool; in intel_gt_init_buffer_pool() local
223 spin_lock_init(&pool->lock); in intel_gt_init_buffer_pool()
224 for (n = 0; n < ARRAY_SIZE(pool->cache_list); n++) in intel_gt_init_buffer_pool()
225 INIT_LIST_HEAD(&pool->cache_list[n]); in intel_gt_init_buffer_pool()
226 INIT_DELAYED_WORK(&pool->work, pool_free_work); in intel_gt_init_buffer_pool()
231 struct intel_gt_buffer_pool *pool = >->buffer_pool; in intel_gt_flush_buffer_pool() local
234 while (pool_free_older_than(pool, 0)) in intel_gt_flush_buffer_pool()
236 } while (cancel_delayed_work_sync(&pool->work)); in intel_gt_flush_buffer_pool()
241 struct intel_gt_buffer_pool *pool = >->buffer_pool; in intel_gt_fini_buffer_pool() local
244 for (n = 0; n < ARRAY_SIZE(pool->cache_list); n++) in intel_gt_fini_buffer_pool()
245 GEM_BUG_ON(!list_empty(&pool->cache_list[n])); in intel_gt_fini_buffer_pool()