Lines Matching refs:pt

223 static void ttm_pool_type_give(struct ttm_pool_type *pt, struct page *p)  in ttm_pool_type_give()  argument
225 unsigned int i, num_pages = 1 << pt->order; in ttm_pool_type_give()
234 spin_lock(&pt->lock); in ttm_pool_type_give()
235 list_add(&p->lru, &pt->pages); in ttm_pool_type_give()
236 spin_unlock(&pt->lock); in ttm_pool_type_give()
237 atomic_long_add(1 << pt->order, &allocated_pages); in ttm_pool_type_give()
241 static struct page *ttm_pool_type_take(struct ttm_pool_type *pt) in ttm_pool_type_take() argument
245 spin_lock(&pt->lock); in ttm_pool_type_take()
246 p = list_first_entry_or_null(&pt->pages, typeof(*p), lru); in ttm_pool_type_take()
248 atomic_long_sub(1 << pt->order, &allocated_pages); in ttm_pool_type_take()
251 spin_unlock(&pt->lock); in ttm_pool_type_take()
257 static void ttm_pool_type_init(struct ttm_pool_type *pt, struct ttm_pool *pool, in ttm_pool_type_init() argument
260 pt->pool = pool; in ttm_pool_type_init()
261 pt->caching = caching; in ttm_pool_type_init()
262 pt->order = order; in ttm_pool_type_init()
263 spin_lock_init(&pt->lock); in ttm_pool_type_init()
264 INIT_LIST_HEAD(&pt->pages); in ttm_pool_type_init()
267 list_add_tail(&pt->shrinker_list, &shrinker_list); in ttm_pool_type_init()
272 static void ttm_pool_type_fini(struct ttm_pool_type *pt) in ttm_pool_type_fini() argument
277 list_del(&pt->shrinker_list); in ttm_pool_type_fini()
280 while ((p = ttm_pool_type_take(pt))) in ttm_pool_type_fini()
281 ttm_pool_free_page(pt->pool, pt->caching, pt->order, p); in ttm_pool_type_fini()
315 struct ttm_pool_type *pt; in ttm_pool_shrink() local
320 pt = list_first_entry(&shrinker_list, typeof(*pt), shrinker_list); in ttm_pool_shrink()
321 list_move_tail(&pt->shrinker_list, &shrinker_list); in ttm_pool_shrink()
324 p = ttm_pool_type_take(pt); in ttm_pool_shrink()
326 ttm_pool_free_page(pt->pool, pt->caching, pt->order, p); in ttm_pool_shrink()
327 num_pages = 1 << pt->order; in ttm_pool_shrink()
389 struct ttm_pool_type *pt; in ttm_pool_alloc() local
391 pt = ttm_pool_select_type(pool, tt->caching, order); in ttm_pool_alloc()
392 p = pt ? ttm_pool_type_take(pt) : NULL; in ttm_pool_alloc()
465 struct ttm_pool_type *pt; in ttm_pool_free() local
472 pt = ttm_pool_select_type(pool, tt->caching, order); in ttm_pool_free()
473 if (pt) in ttm_pool_free()
474 ttm_pool_type_give(pt, tt->pages[i]); in ttm_pool_free()
564 static unsigned int ttm_pool_type_count(struct ttm_pool_type *pt) in ttm_pool_type_count() argument
569 spin_lock(&pt->lock); in ttm_pool_type_count()
571 list_for_each_entry(p, &pt->pages, lru) in ttm_pool_type_count()
573 spin_unlock(&pt->lock); in ttm_pool_type_count()
590 static void ttm_pool_debugfs_orders(struct ttm_pool_type *pt, in ttm_pool_debugfs_orders() argument
596 seq_printf(m, " %8u", ttm_pool_type_count(&pt[i])); in ttm_pool_debugfs_orders()