• Home
  • Raw
  • Download

Lines Matching refs:block

20 	struct i915_buddy_block *block;  in i915_block_alloc()  local
24 block = kmem_cache_zalloc(slab_blocks, GFP_KERNEL); in i915_block_alloc()
25 if (!block) in i915_block_alloc()
28 block->header = offset; in i915_block_alloc()
29 block->header |= order; in i915_block_alloc()
30 block->parent = parent; in i915_block_alloc()
32 GEM_BUG_ON(block->header & I915_BUDDY_HEADER_UNUSED); in i915_block_alloc()
33 return block; in i915_block_alloc()
37 struct i915_buddy_block *block) in i915_block_free() argument
39 kmem_cache_free(slab_blocks, block); in i915_block_free()
42 static void mark_allocated(struct i915_buddy_block *block) in mark_allocated() argument
44 block->header &= ~I915_BUDDY_HEADER_STATE; in mark_allocated()
45 block->header |= I915_BUDDY_ALLOCATED; in mark_allocated()
47 list_del(&block->link); in mark_allocated()
51 struct i915_buddy_block *block) in mark_free() argument
53 block->header &= ~I915_BUDDY_HEADER_STATE; in mark_free()
54 block->header |= I915_BUDDY_FREE; in mark_free()
56 list_add(&block->link, in mark_free()
57 &mm->free_list[i915_buddy_block_order(block)]); in mark_free()
60 static void mark_split(struct i915_buddy_block *block) in mark_split() argument
62 block->header &= ~I915_BUDDY_HEADER_STATE; in mark_split()
63 block->header |= I915_BUDDY_SPLIT; in mark_split()
65 list_del(&block->link); in mark_split()
163 struct i915_buddy_block *block) in split_block() argument
165 unsigned int block_order = i915_buddy_block_order(block) - 1; in split_block()
166 u64 offset = i915_buddy_block_offset(block); in split_block()
168 GEM_BUG_ON(!i915_buddy_block_is_free(block)); in split_block()
169 GEM_BUG_ON(!i915_buddy_block_order(block)); in split_block()
171 block->left = i915_block_alloc(mm, block, block_order, offset); in split_block()
172 if (!block->left) in split_block()
175 block->right = i915_block_alloc(mm, block, block_order, in split_block()
177 if (!block->right) { in split_block()
178 i915_block_free(mm, block->left); in split_block()
182 mark_free(mm, block->left); in split_block()
183 mark_free(mm, block->right); in split_block()
185 mark_split(block); in split_block()
191 get_buddy(struct i915_buddy_block *block) in get_buddy() argument
195 parent = block->parent; in get_buddy()
199 if (parent->left == block) in get_buddy()
206 struct i915_buddy_block *block) in __i915_buddy_free() argument
210 while ((parent = block->parent)) { in __i915_buddy_free()
213 buddy = get_buddy(block); in __i915_buddy_free()
220 i915_block_free(mm, block); in __i915_buddy_free()
223 block = parent; in __i915_buddy_free()
226 mark_free(mm, block); in __i915_buddy_free()
230 struct i915_buddy_block *block) in i915_buddy_free() argument
232 GEM_BUG_ON(!i915_buddy_block_is_allocated(block)); in i915_buddy_free()
233 __i915_buddy_free(mm, block); in i915_buddy_free()
238 struct i915_buddy_block *block, *on; in i915_buddy_free_list() local
240 list_for_each_entry_safe(block, on, objects, link) { in i915_buddy_free_list()
241 i915_buddy_free(mm, block); in i915_buddy_free_list()
258 struct i915_buddy_block *block = NULL; in i915_buddy_alloc() local
263 block = list_first_entry_or_null(&mm->free_list[i], in i915_buddy_alloc()
266 if (block) in i915_buddy_alloc()
270 if (!block) in i915_buddy_alloc()
273 GEM_BUG_ON(!i915_buddy_block_is_free(block)); in i915_buddy_alloc()
276 err = split_block(mm, block); in i915_buddy_alloc()
281 block = block->left; in i915_buddy_alloc()
285 mark_allocated(block); in i915_buddy_alloc()
286 kmemleak_update_trace(block); in i915_buddy_alloc()
287 return block; in i915_buddy_alloc()
291 __i915_buddy_free(mm, block); in i915_buddy_alloc()
319 struct i915_buddy_block *block; in i915_buddy_alloc_range() local
345 block = list_first_entry_or_null(&dfs, in i915_buddy_alloc_range()
348 if (!block) in i915_buddy_alloc_range()
351 list_del(&block->tmp_link); in i915_buddy_alloc_range()
353 block_start = i915_buddy_block_offset(block); in i915_buddy_alloc_range()
354 block_end = block_start + i915_buddy_block_size(mm, block) - 1; in i915_buddy_alloc_range()
359 if (i915_buddy_block_is_allocated(block)) { in i915_buddy_alloc_range()
365 if (!i915_buddy_block_is_free(block)) { in i915_buddy_alloc_range()
370 mark_allocated(block); in i915_buddy_alloc_range()
371 list_add_tail(&block->link, &allocated); in i915_buddy_alloc_range()
375 if (!i915_buddy_block_is_split(block)) { in i915_buddy_alloc_range()
376 err = split_block(mm, block); in i915_buddy_alloc_range()
381 list_add(&block->right->tmp_link, &dfs); in i915_buddy_alloc_range()
382 list_add(&block->left->tmp_link, &dfs); in i915_buddy_alloc_range()
394 buddy = get_buddy(block); in i915_buddy_alloc_range()
396 (i915_buddy_block_is_free(block) && in i915_buddy_alloc_range()
398 __i915_buddy_free(mm, block); in i915_buddy_alloc_range()