Lines Matching refs:ptc

122 	struct nvkm_mmu_ptc *ptc;  in nvkm_mmu_ptc_find()  local
124 list_for_each_entry(ptc, &mmu->ptc.list, head) { in nvkm_mmu_ptc_find()
125 if (ptc->size == size) in nvkm_mmu_ptc_find()
126 return ptc; in nvkm_mmu_ptc_find()
129 ptc = kmalloc(sizeof(*ptc), GFP_KERNEL); in nvkm_mmu_ptc_find()
130 if (ptc) { in nvkm_mmu_ptc_find()
131 INIT_LIST_HEAD(&ptc->item); in nvkm_mmu_ptc_find()
132 ptc->size = size; in nvkm_mmu_ptc_find()
133 ptc->refs = 0; in nvkm_mmu_ptc_find()
134 list_add(&ptc->head, &mmu->ptc.list); in nvkm_mmu_ptc_find()
137 return ptc; in nvkm_mmu_ptc_find()
154 mutex_lock(&mmu->ptc.mutex); in nvkm_mmu_ptc_put()
155 if (pt->ptc->refs < 8 /* Heuristic. */ && !force) { in nvkm_mmu_ptc_put()
156 list_add_tail(&pt->head, &pt->ptc->item); in nvkm_mmu_ptc_put()
157 pt->ptc->refs++; in nvkm_mmu_ptc_put()
162 mutex_unlock(&mmu->ptc.mutex); in nvkm_mmu_ptc_put()
169 struct nvkm_mmu_ptc *ptc; in nvkm_mmu_ptc_get() local
182 mutex_lock(&mmu->ptc.mutex); in nvkm_mmu_ptc_get()
183 ptc = nvkm_mmu_ptc_find(mmu, size); in nvkm_mmu_ptc_get()
184 if (!ptc) { in nvkm_mmu_ptc_get()
185 mutex_unlock(&mmu->ptc.mutex); in nvkm_mmu_ptc_get()
190 pt = list_first_entry_or_null(&ptc->item, typeof(*pt), head); in nvkm_mmu_ptc_get()
195 ptc->refs--; in nvkm_mmu_ptc_get()
196 mutex_unlock(&mmu->ptc.mutex); in nvkm_mmu_ptc_get()
199 mutex_unlock(&mmu->ptc.mutex); in nvkm_mmu_ptc_get()
204 pt->ptc = ptc; in nvkm_mmu_ptc_get()
222 struct nvkm_mmu_ptc *ptc; in nvkm_mmu_ptc_dump() local
223 list_for_each_entry(ptc, &mmu->ptc.list, head) { in nvkm_mmu_ptc_dump()
225 list_for_each_entry_safe(pt, tt, &ptc->item, head) { in nvkm_mmu_ptc_dump()
236 struct nvkm_mmu_ptc *ptc, *ptct; in nvkm_mmu_ptc_fini() local
238 list_for_each_entry_safe(ptc, ptct, &mmu->ptc.list, head) { in nvkm_mmu_ptc_fini()
239 WARN_ON(!list_empty(&ptc->item)); in nvkm_mmu_ptc_fini()
240 list_del(&ptc->head); in nvkm_mmu_ptc_fini()
241 kfree(ptc); in nvkm_mmu_ptc_fini()
248 mutex_init(&mmu->ptc.mutex); in nvkm_mmu_ptc_init()
249 INIT_LIST_HEAD(&mmu->ptc.list); in nvkm_mmu_ptc_init()