Lines Matching refs:pt

276 static void ttm_pool_type_give(struct ttm_pool_type *pt, struct page *p)  in ttm_pool_type_give()  argument
278 unsigned int i, num_pages = 1 << pt->order; in ttm_pool_type_give()
287 spin_lock(&pt->lock); in ttm_pool_type_give()
288 list_add(&p->lru, &pt->pages); in ttm_pool_type_give()
289 spin_unlock(&pt->lock); in ttm_pool_type_give()
290 atomic_long_add(1 << pt->order, &allocated_pages); in ttm_pool_type_give()
294 static struct page *ttm_pool_type_take(struct ttm_pool_type *pt) in ttm_pool_type_take() argument
298 spin_lock(&pt->lock); in ttm_pool_type_take()
299 p = list_first_entry_or_null(&pt->pages, typeof(*p), lru); in ttm_pool_type_take()
301 atomic_long_sub(1 << pt->order, &allocated_pages); in ttm_pool_type_take()
304 spin_unlock(&pt->lock); in ttm_pool_type_take()
310 static void ttm_pool_type_init(struct ttm_pool_type *pt, struct ttm_pool *pool, in ttm_pool_type_init() argument
313 pt->pool = pool; in ttm_pool_type_init()
314 pt->caching = caching; in ttm_pool_type_init()
315 pt->order = order; in ttm_pool_type_init()
316 spin_lock_init(&pt->lock); in ttm_pool_type_init()
317 INIT_LIST_HEAD(&pt->pages); in ttm_pool_type_init()
320 list_add_tail(&pt->shrinker_list, &shrinker_list); in ttm_pool_type_init()
325 static void ttm_pool_type_fini(struct ttm_pool_type *pt) in ttm_pool_type_fini() argument
330 list_del(&pt->shrinker_list); in ttm_pool_type_fini()
333 while ((p = ttm_pool_type_take(pt))) in ttm_pool_type_fini()
334 ttm_pool_free_page(pt->pool, pt->caching, pt->order, p); in ttm_pool_type_fini()
374 struct ttm_pool_type *pt; in ttm_pool_shrink() local
380 pt = list_first_entry(&shrinker_list, typeof(*pt), shrinker_list); in ttm_pool_shrink()
381 list_move_tail(&pt->shrinker_list, &shrinker_list); in ttm_pool_shrink()
384 p = ttm_pool_type_take(pt); in ttm_pool_shrink()
386 ttm_pool_free_page(pt->pool, pt->caching, pt->order, p); in ttm_pool_shrink()
387 num_pages = 1 << pt->order; in ttm_pool_shrink()
459 struct ttm_pool_type *pt = NULL; in ttm_pool_unmap_and_free() local
469 pt = ttm_pool_select_type(pool, caching, order); in ttm_pool_unmap_and_free()
475 if (pt) in ttm_pool_unmap_and_free()
476 ttm_pool_type_give(pt, page); in ttm_pool_unmap_and_free()
732 struct ttm_pool_type *pt; in __ttm_pool_alloc() local
736 pt = ttm_pool_select_type(pool, page_caching, order); in __ttm_pool_alloc()
737 if (pt && allow_pools) in __ttm_pool_alloc()
738 p = ttm_pool_type_take(pt); in __ttm_pool_alloc()
1080 struct ttm_pool_type *pt; in ttm_pool_init() local
1083 pt = ttm_pool_select_type(pool, i, j); in ttm_pool_init()
1084 if (pt != &pool->caching[i].orders[j]) in ttm_pool_init()
1087 ttm_pool_type_init(pt, pool, i, j); in ttm_pool_init()
1119 struct ttm_pool_type *pt; in ttm_pool_fini() local
1121 pt = ttm_pool_select_type(pool, i, j); in ttm_pool_fini()
1122 if (pt != &pool->caching[i].orders[j]) in ttm_pool_fini()
1125 ttm_pool_type_fini(pt); in ttm_pool_fini()
1165 static unsigned int ttm_pool_type_count(struct ttm_pool_type *pt) in ttm_pool_type_count() argument
1170 spin_lock(&pt->lock); in ttm_pool_type_count()
1172 list_for_each_entry(p, &pt->pages, lru) in ttm_pool_type_count()
1174 spin_unlock(&pt->lock); in ttm_pool_type_count()
1191 static void ttm_pool_debugfs_orders(struct ttm_pool_type *pt, in ttm_pool_debugfs_orders() argument
1197 seq_printf(m, " %8u", ttm_pool_type_count(&pt[i])); in ttm_pool_debugfs_orders()