• Home
  • Raw
  • Download

Lines Matching refs:node

30 static void node_free(struct intel_gt_buffer_pool_node *node)  in node_free()  argument
32 i915_gem_object_put(node->obj); in node_free()
33 i915_active_fini(&node->active); in node_free()
34 kfree_rcu(node, rcu); in node_free()
39 struct intel_gt_buffer_pool_node *node, *stale = NULL; in pool_free_older_than() local
57 node = list_entry(pos, typeof(*node), link); in pool_free_older_than()
59 age = READ_ONCE(node->age); in pool_free_older_than()
64 if (!xchg(&node->age, 0)) in pool_free_older_than()
67 node->free = stale; in pool_free_older_than()
68 stale = node; in pool_free_older_than()
79 while ((node = stale)) { in pool_free_older_than()
81 node_free(node); in pool_free_older_than()
100 struct intel_gt_buffer_pool_node *node = in pool_retire() local
101 container_of(ref, typeof(*node), active); in pool_retire()
102 struct intel_gt_buffer_pool *pool = node->pool; in pool_retire()
104 struct list_head *list = bucket_for_size(pool, node->obj->base.size); in pool_retire()
107 if (node->pinned) { in pool_retire()
108 i915_gem_object_unpin_pages(node->obj); in pool_retire()
111 i915_gem_object_make_purgeable(node->obj); in pool_retire()
112 node->pinned = false; in pool_retire()
115 GEM_BUG_ON(node->age); in pool_retire()
117 list_add_rcu(&node->link, list); in pool_retire()
118 WRITE_ONCE(node->age, jiffies ?: 1); /* 0 reserved for active nodes */ in pool_retire()
125 void intel_gt_buffer_pool_mark_used(struct intel_gt_buffer_pool_node *node) in intel_gt_buffer_pool_mark_used() argument
127 assert_object_held(node->obj); in intel_gt_buffer_pool_mark_used()
129 if (node->pinned) in intel_gt_buffer_pool_mark_used()
132 __i915_gem_object_pin_pages(node->obj); in intel_gt_buffer_pool_mark_used()
134 i915_gem_object_make_unshrinkable(node->obj); in intel_gt_buffer_pool_mark_used()
135 node->pinned = true; in intel_gt_buffer_pool_mark_used()
143 struct intel_gt_buffer_pool_node *node; in node_create() local
146 node = kmalloc(sizeof(*node), in node_create()
148 if (!node) in node_create()
151 node->age = 0; in node_create()
152 node->pool = pool; in node_create()
153 node->pinned = false; in node_create()
154 i915_active_init(&node->active, NULL, pool_retire, 0); in node_create()
158 i915_active_fini(&node->active); in node_create()
159 kfree(node); in node_create()
165 node->type = type; in node_create()
166 node->obj = obj; in node_create()
167 return node; in node_create()
175 struct intel_gt_buffer_pool_node *node; in intel_gt_get_buffer_pool() local
183 list_for_each_entry_rcu(node, list, link) { in intel_gt_get_buffer_pool()
186 if (node->obj->base.size < size) in intel_gt_get_buffer_pool()
189 if (node->type != type) in intel_gt_get_buffer_pool()
192 age = READ_ONCE(node->age); in intel_gt_get_buffer_pool()
196 if (cmpxchg(&node->age, age, 0) == age) { in intel_gt_get_buffer_pool()
198 list_del_rcu(&node->link); in intel_gt_get_buffer_pool()
205 if (&node->link == list) { in intel_gt_get_buffer_pool()
206 node = node_create(pool, size, type); in intel_gt_get_buffer_pool()
207 if (IS_ERR(node)) in intel_gt_get_buffer_pool()
208 return node; in intel_gt_get_buffer_pool()
211 ret = i915_active_acquire(&node->active); in intel_gt_get_buffer_pool()
213 node_free(node); in intel_gt_get_buffer_pool()
217 return node; in intel_gt_get_buffer_pool()