Lines Matching refs:va
776 va_size(struct vmap_area *va) in va_size() argument
778 return (va->va_end - va->va_start); in va_size()
784 struct vmap_area *va; in get_subtree_max_size() local
786 va = rb_entry_safe(node, struct vmap_area, rb_node); in get_subtree_max_size()
787 return va ? va->subtree_max_size : 0; in get_subtree_max_size()
808 struct vmap_area *va = NULL; in find_vmap_area_exceed_addr() local
818 va = tmp; in find_vmap_area_exceed_addr()
827 return va; in find_vmap_area_exceed_addr()
837 struct vmap_area *va; in __find_vmap_area() local
839 va = rb_entry(n, struct vmap_area, rb_node); in __find_vmap_area()
840 if (addr < va->va_start) in __find_vmap_area()
842 else if (addr >= va->va_end) in __find_vmap_area()
845 return va; in __find_vmap_area()
860 find_va_links(struct vmap_area *va, in find_va_links() argument
890 if (va->va_end <= tmp_va->va_start) in find_va_links()
892 else if (va->va_start >= tmp_va->va_end) in find_va_links()
896 va->va_start, va->va_end, tmp_va->va_start, tmp_va->va_end); in find_va_links()
925 __link_va(struct vmap_area *va, struct rb_root *root, in __link_va() argument
940 rb_link_node(&va->rb_node, parent, link); in __link_va()
953 rb_insert_augmented(&va->rb_node, in __link_va()
955 va->subtree_max_size = 0; in __link_va()
957 rb_insert_color(&va->rb_node, root); in __link_va()
961 list_add(&va->list, head); in __link_va()
965 link_va(struct vmap_area *va, struct rb_root *root, in link_va() argument
969 __link_va(va, root, parent, link, head, false); in link_va()
973 link_va_augment(struct vmap_area *va, struct rb_root *root, in link_va_augment() argument
977 __link_va(va, root, parent, link, head, true); in link_va_augment()
981 __unlink_va(struct vmap_area *va, struct rb_root *root, bool augment) in __unlink_va() argument
983 if (WARN_ON(RB_EMPTY_NODE(&va->rb_node))) in __unlink_va()
987 rb_erase_augmented(&va->rb_node, in __unlink_va()
990 rb_erase(&va->rb_node, root); in __unlink_va()
992 list_del_init(&va->list); in __unlink_va()
993 RB_CLEAR_NODE(&va->rb_node); in __unlink_va()
997 unlink_va(struct vmap_area *va, struct rb_root *root) in unlink_va() argument
999 __unlink_va(va, root, false); in unlink_va()
1003 unlink_va_augment(struct vmap_area *va, struct rb_root *root) in unlink_va_augment() argument
1005 __unlink_va(va, root, true); in unlink_va_augment()
1013 compute_subtree_max_size(struct vmap_area *va) in compute_subtree_max_size() argument
1015 return max3(va_size(va), in compute_subtree_max_size()
1016 get_subtree_max_size(va->rb_node.rb_left), in compute_subtree_max_size()
1017 get_subtree_max_size(va->rb_node.rb_right)); in compute_subtree_max_size()
1023 struct vmap_area *va; in augment_tree_propagate_check() local
1026 list_for_each_entry(va, &free_vmap_area_list, list) { in augment_tree_propagate_check()
1027 computed_size = compute_subtree_max_size(va); in augment_tree_propagate_check()
1028 if (computed_size != va->subtree_max_size) in augment_tree_propagate_check()
1030 va_size(va), va->subtree_max_size); in augment_tree_propagate_check()
1063 augment_tree_propagate_from(struct vmap_area *va) in augment_tree_propagate_from() argument
1070 free_vmap_area_rb_augment_cb_propagate(&va->rb_node, NULL); in augment_tree_propagate_from()
1078 insert_vmap_area(struct vmap_area *va, in insert_vmap_area() argument
1084 link = find_va_links(va, root, NULL, &parent); in insert_vmap_area()
1086 link_va(va, root, parent, link, head); in insert_vmap_area()
1090 insert_vmap_area_augment(struct vmap_area *va, in insert_vmap_area_augment() argument
1098 link = find_va_links(va, NULL, from, &parent); in insert_vmap_area_augment()
1100 link = find_va_links(va, root, NULL, &parent); in insert_vmap_area_augment()
1103 link_va_augment(va, root, parent, link, head); in insert_vmap_area_augment()
1104 augment_tree_propagate_from(va); in insert_vmap_area_augment()
1120 __merge_or_add_vmap_area(struct vmap_area *va, in __merge_or_add_vmap_area() argument
1133 link = find_va_links(va, root, NULL, &parent); in __merge_or_add_vmap_area()
1153 if (sibling->va_start == va->va_end) { in __merge_or_add_vmap_area()
1154 sibling->va_start = va->va_start; in __merge_or_add_vmap_area()
1157 kmem_cache_free(vmap_area_cachep, va); in __merge_or_add_vmap_area()
1160 va = sibling; in __merge_or_add_vmap_area()
1174 if (sibling->va_end == va->va_start) { in __merge_or_add_vmap_area()
1183 __unlink_va(va, root, augment); in __merge_or_add_vmap_area()
1185 sibling->va_end = va->va_end; in __merge_or_add_vmap_area()
1188 kmem_cache_free(vmap_area_cachep, va); in __merge_or_add_vmap_area()
1191 va = sibling; in __merge_or_add_vmap_area()
1198 __link_va(va, root, parent, link, head, augment); in __merge_or_add_vmap_area()
1200 return va; in __merge_or_add_vmap_area()
1204 merge_or_add_vmap_area(struct vmap_area *va, in merge_or_add_vmap_area() argument
1207 return __merge_or_add_vmap_area(va, root, head, false); in merge_or_add_vmap_area()
1211 merge_or_add_vmap_area_augment(struct vmap_area *va, in merge_or_add_vmap_area_augment() argument
1214 va = __merge_or_add_vmap_area(va, root, head, true); in merge_or_add_vmap_area_augment()
1215 if (va) in merge_or_add_vmap_area_augment()
1216 augment_tree_propagate_from(va); in merge_or_add_vmap_area_augment()
1218 return va; in merge_or_add_vmap_area_augment()
1222 is_within_this_va(struct vmap_area *va, unsigned long size, in is_within_this_va() argument
1227 if (va->va_start > vstart) in is_within_this_va()
1228 nva_start_addr = ALIGN(va->va_start, align); in is_within_this_va()
1237 return (nva_start_addr + size <= va->va_end); in is_within_this_va()
1251 struct vmap_area *va; in find_vmap_lowest_match() local
1262 va = rb_entry(node, struct vmap_area, rb_node); in find_vmap_lowest_match()
1265 vstart < va->va_start) { in find_vmap_lowest_match()
1268 if (is_within_this_va(va, size, align, vstart)) in find_vmap_lowest_match()
1269 return va; in find_vmap_lowest_match()
1288 va = rb_entry(node, struct vmap_area, rb_node); in find_vmap_lowest_match()
1289 if (is_within_this_va(va, size, align, vstart)) in find_vmap_lowest_match()
1290 return va; in find_vmap_lowest_match()
1293 vstart <= va->va_start) { in find_vmap_lowest_match()
1300 vstart = va->va_start + 1; in find_vmap_lowest_match()
1318 struct vmap_area *va; in find_vmap_lowest_linear_match() local
1320 list_for_each_entry(va, head, list) { in find_vmap_lowest_linear_match()
1321 if (!is_within_this_va(va, size, align, vstart)) in find_vmap_lowest_linear_match()
1324 return va; in find_vmap_lowest_linear_match()
1359 classify_va_fit_type(struct vmap_area *va, in classify_va_fit_type() argument
1365 if (nva_start_addr < va->va_start || in classify_va_fit_type()
1366 nva_start_addr + size > va->va_end) in classify_va_fit_type()
1370 if (va->va_start == nva_start_addr) { in classify_va_fit_type()
1371 if (va->va_end == nva_start_addr + size) in classify_va_fit_type()
1375 } else if (va->va_end == nva_start_addr + size) { in classify_va_fit_type()
1386 struct vmap_area *va, unsigned long nva_start_addr, in adjust_va_to_fit_type() argument
1390 enum fit_type type = classify_va_fit_type(va, nva_start_addr, size); in adjust_va_to_fit_type()
1400 unlink_va_augment(va, root); in adjust_va_to_fit_type()
1401 kmem_cache_free(vmap_area_cachep, va); in adjust_va_to_fit_type()
1410 va->va_start += size; in adjust_va_to_fit_type()
1419 va->va_end = nva_start_addr; in adjust_va_to_fit_type()
1463 lva->va_start = va->va_start; in adjust_va_to_fit_type()
1469 va->va_start = nva_start_addr + size; in adjust_va_to_fit_type()
1475 augment_tree_propagate_from(va); in adjust_va_to_fit_type()
1478 insert_vmap_area_augment(lva, &va->rb_node, root, head); in adjust_va_to_fit_type()
1495 struct vmap_area *va; in __alloc_vmap_area() local
1510 va = find_vmap_lowest_match(root, size, align, vstart, adjust_search_size); in __alloc_vmap_area()
1511 if (unlikely(!va)) in __alloc_vmap_area()
1514 if (va->va_start > vstart) in __alloc_vmap_area()
1515 nva_start_addr = ALIGN(va->va_start, align); in __alloc_vmap_area()
1524 ret = adjust_va_to_fit_type(root, head, va, nva_start_addr, size); in __alloc_vmap_area()
1538 static void free_vmap_area(struct vmap_area *va) in free_vmap_area() argument
1544 unlink_va(va, &vmap_area_root); in free_vmap_area()
1551 merge_or_add_vmap_area_augment(va, &free_vmap_area_root, &free_vmap_area_list); in free_vmap_area()
1558 struct vmap_area *va = NULL; in preload_this_cpu_lock() local
1570 va = kmem_cache_alloc_node(vmap_area_cachep, gfp_mask, node); in preload_this_cpu_lock()
1574 if (va && __this_cpu_cmpxchg(ne_fit_preload_node, NULL, va)) in preload_this_cpu_lock()
1575 kmem_cache_free(vmap_area_cachep, va); in preload_this_cpu_lock()
1588 struct vmap_area *va; in alloc_vmap_area() local
1603 va = kmem_cache_alloc_node(vmap_area_cachep, gfp_mask, node); in alloc_vmap_area()
1604 if (unlikely(!va)) in alloc_vmap_area()
1611 kmemleak_scan_area(&va->rb_node, SIZE_MAX, gfp_mask); in alloc_vmap_area()
1628 va->va_start = addr; in alloc_vmap_area()
1629 va->va_end = addr + size; in alloc_vmap_area()
1630 va->vm = NULL; in alloc_vmap_area()
1631 va->flags = va_flags; in alloc_vmap_area()
1634 insert_vmap_area(va, &vmap_area_root, &vmap_area_list); in alloc_vmap_area()
1637 BUG_ON(!IS_ALIGNED(va->va_start, align)); in alloc_vmap_area()
1638 BUG_ON(va->va_start < vstart); in alloc_vmap_area()
1639 BUG_ON(va->va_end > vend); in alloc_vmap_area()
1643 free_vmap_area(va); in alloc_vmap_area()
1647 return va; in alloc_vmap_area()
1668 kmem_cache_free(vmap_area_cachep, va); in alloc_vmap_area()
1729 struct vmap_area *va, *n_va; in __purge_vmap_area_lazy() local
1753 list_for_each_entry_safe(va, n_va, &local_purge_list, list) { in __purge_vmap_area_lazy()
1754 unsigned long nr = (va->va_end - va->va_start) >> PAGE_SHIFT; in __purge_vmap_area_lazy()
1755 unsigned long orig_start = va->va_start; in __purge_vmap_area_lazy()
1756 unsigned long orig_end = va->va_end; in __purge_vmap_area_lazy()
1763 va = merge_or_add_vmap_area_augment(va, &free_vmap_area_root, in __purge_vmap_area_lazy()
1766 if (!va) in __purge_vmap_area_lazy()
1771 va->va_start, va->va_end); in __purge_vmap_area_lazy()
1817 static void free_vmap_area_noflush(struct vmap_area *va) in free_vmap_area_noflush() argument
1820 unsigned long va_start = va->va_start; in free_vmap_area_noflush()
1823 if (WARN_ON_ONCE(!list_empty(&va->list))) in free_vmap_area_noflush()
1826 nr_lazy = atomic_long_add_return((va->va_end - va->va_start) >> in free_vmap_area_noflush()
1833 merge_or_add_vmap_area(va, in free_vmap_area_noflush()
1847 static void free_unmap_vmap_area(struct vmap_area *va) in free_unmap_vmap_area() argument
1849 flush_cache_vunmap(va->va_start, va->va_end); in free_unmap_vmap_area()
1850 vunmap_range_noflush(va->va_start, va->va_end); in free_unmap_vmap_area()
1852 flush_tlb_kernel_range(va->va_start, va->va_end); in free_unmap_vmap_area()
1854 free_vmap_area_noflush(va); in free_unmap_vmap_area()
1859 struct vmap_area *va; in find_vmap_area() local
1862 va = __find_vmap_area(addr, &vmap_area_root); in find_vmap_area()
1865 return va; in find_vmap_area()
1870 struct vmap_area *va; in find_unlink_vmap_area() local
1873 va = __find_vmap_area(addr, &vmap_area_root); in find_unlink_vmap_area()
1874 if (va) in find_unlink_vmap_area()
1875 unlink_va(va, &vmap_area_root); in find_unlink_vmap_area()
1878 return va; in find_unlink_vmap_area()
1935 struct vmap_area *va; member
2026 struct vmap_area *va; in new_vmap_block() local
2039 va = alloc_vmap_area(VMAP_BLOCK_SIZE, VMAP_BLOCK_SIZE, in new_vmap_block()
2043 if (IS_ERR(va)) { in new_vmap_block()
2045 return ERR_CAST(va); in new_vmap_block()
2048 vaddr = vmap_block_vaddr(va->va_start, 0); in new_vmap_block()
2050 vb->va = va; in new_vmap_block()
2061 xa = addr_to_vb_xa(va->va_start); in new_vmap_block()
2062 vb_idx = addr_to_vb_idx(va->va_start); in new_vmap_block()
2066 free_vmap_area(va); in new_vmap_block()
2083 xa = addr_to_vb_xa(vb->va->va_start); in free_vmap_block()
2084 tmp = xa_erase(xa, addr_to_vb_idx(vb->va->va_start)); in free_vmap_block()
2088 unlink_va(vb->va, &vmap_area_root); in free_vmap_block()
2091 free_vmap_area_noflush(vb->va); in free_vmap_block()
2195 vaddr = vmap_block_vaddr(vb->va->va_start, pages_off); in vb_alloc()
2285 unsigned long va_start = vb->va->va_start; in _vm_unmap_aliases()
2342 struct vmap_area *va; in vm_unmap_ram() local
2358 va = find_unlink_vmap_area(addr); in vm_unmap_ram()
2359 if (WARN_ON_ONCE(!va)) in vm_unmap_ram()
2362 debug_check_no_locks_freed((void *)va->va_start, in vm_unmap_ram()
2363 (va->va_end - va->va_start)); in vm_unmap_ram()
2364 free_unmap_vmap_area(va); in vm_unmap_ram()
2394 struct vmap_area *va; in vm_map_ram() local
2395 va = alloc_vmap_area(size, PAGE_SIZE, in vm_map_ram()
2398 if (IS_ERR(va)) in vm_map_ram()
2401 addr = va->va_start; in vm_map_ram()
2542 struct vmap_area *va, unsigned long flags, const void *caller) in setup_vmalloc_vm_locked() argument
2545 vm->addr = (void *)va->va_start; in setup_vmalloc_vm_locked()
2546 vm->size = va->va_end - va->va_start; in setup_vmalloc_vm_locked()
2548 va->vm = vm; in setup_vmalloc_vm_locked()
2551 static void setup_vmalloc_vm(struct vm_struct *vm, struct vmap_area *va, in setup_vmalloc_vm() argument
2555 setup_vmalloc_vm_locked(vm, va, flags, caller); in setup_vmalloc_vm()
2575 struct vmap_area *va; in __get_vm_area_node() local
2595 va = alloc_vmap_area(size, align, start, end, node, gfp_mask, 0); in __get_vm_area_node()
2596 if (IS_ERR(va)) { in __get_vm_area_node()
2601 setup_vmalloc_vm(area, va, flags, caller); in __get_vm_area_node()
2665 struct vmap_area *va; in find_vm_area() local
2667 va = find_vmap_area((unsigned long)addr); in find_vm_area()
2668 if (!va) in find_vm_area()
2671 return va->vm; in find_vm_area()
2686 struct vmap_area *va; in remove_vm_area() local
2695 va = find_unlink_vmap_area((unsigned long)addr); in remove_vm_area()
2696 if (!va || !va->vm) in remove_vm_area()
2698 vm = va->vm; in remove_vm_area()
2705 free_unmap_vmap_area(va); in remove_vm_area()
3679 start = vmap_block_vaddr(vb->va->va_start, rs); in vmap_ram_vread_iter()
3744 struct vmap_area *va; in vread_iter() local
3758 va = find_vmap_area_exceed_addr((unsigned long)addr); in vread_iter()
3759 if (!va) in vread_iter()
3763 if ((unsigned long)addr + remains <= va->va_start) in vread_iter()
3766 list_for_each_entry_from(va, &vmap_area_list, list) { in vread_iter()
3772 vm = va->vm; in vread_iter()
3773 flags = va->flags & VMAP_FLAGS_MASK; in vread_iter()
3789 vaddr = (char *) va->va_start; in vread_iter()
3790 size = vm ? get_vm_area_size(vm) : va_size(va); in vread_iter()
3948 struct vmap_area *va, *tmp; in pvm_find_va_enclose_addr() local
3952 va = NULL; in pvm_find_va_enclose_addr()
3957 va = tmp; in pvm_find_va_enclose_addr()
3967 return va; in pvm_find_va_enclose_addr()
3981 pvm_determine_end_from_reverse(struct vmap_area **va, unsigned long align) in pvm_determine_end_from_reverse() argument
3986 if (likely(*va)) { in pvm_determine_end_from_reverse()
3987 list_for_each_entry_from_reverse((*va), in pvm_determine_end_from_reverse()
3989 addr = min((*va)->va_end & ~(align - 1), vmalloc_end); in pvm_determine_end_from_reverse()
3990 if ((*va)->va_start < addr) in pvm_determine_end_from_reverse()
4028 struct vmap_area **vas, *va; in pcpu_get_vm_areas() local
4081 va = pvm_find_va_enclose_addr(vmalloc_end); in pcpu_get_vm_areas()
4082 base = pvm_determine_end_from_reverse(&va, align) - end; in pcpu_get_vm_areas()
4095 if (va == NULL) in pcpu_get_vm_areas()
4102 if (base + end > va->va_end) { in pcpu_get_vm_areas()
4103 base = pvm_determine_end_from_reverse(&va, align) - end; in pcpu_get_vm_areas()
4111 if (base + start < va->va_start) { in pcpu_get_vm_areas()
4112 va = node_to_va(rb_prev(&va->rb_node)); in pcpu_get_vm_areas()
4113 base = pvm_determine_end_from_reverse(&va, align) - end; in pcpu_get_vm_areas()
4128 va = pvm_find_va_enclose_addr(base + end); in pcpu_get_vm_areas()
4138 va = pvm_find_va_enclose_addr(start); in pcpu_get_vm_areas()
4139 if (WARN_ON_ONCE(va == NULL)) in pcpu_get_vm_areas()
4145 va, start, size); in pcpu_get_vm_areas()
4151 va = vas[area]; in pcpu_get_vm_areas()
4152 va->va_start = start; in pcpu_get_vm_areas()
4153 va->va_end = start + size; in pcpu_get_vm_areas()
4197 va = merge_or_add_vmap_area_augment(vas[area], &free_vmap_area_root, in pcpu_get_vm_areas()
4199 if (va) in pcpu_get_vm_areas()
4201 va->va_start, va->va_end); in pcpu_get_vm_areas()
4247 va = merge_or_add_vmap_area_augment(vas[area], &free_vmap_area_root, in pcpu_get_vm_areas()
4249 if (va) in pcpu_get_vm_areas()
4251 va->va_start, va->va_end); in pcpu_get_vm_areas()
4284 struct vmap_area *va; in vmalloc_dump_obj() local
4290 va = __find_vmap_area((unsigned long)objp, &vmap_area_root); in vmalloc_dump_obj()
4291 if (!va) { in vmalloc_dump_obj()
4296 vm = va->vm; in vmalloc_dump_obj()
4361 struct vmap_area *va; in show_purge_info() local
4364 list_for_each_entry(va, &purge_vmap_area_list, list) { in show_purge_info()
4366 (void *)va->va_start, (void *)va->va_end, in show_purge_info()
4367 va->va_end - va->va_start); in show_purge_info()
4374 struct vmap_area *va; in s_show() local
4377 va = list_entry(p, struct vmap_area, list); in s_show()
4379 if (!va->vm) { in s_show()
4380 if (va->flags & VMAP_RAM) in s_show()
4382 (void *)va->va_start, (void *)va->va_end, in s_show()
4383 va->va_end - va->va_start); in s_show()
4388 v = va->vm; in s_show()
4427 if (list_is_last(&va->list, &vmap_area_list)) in s_show()
4456 struct vmap_area *va; in vmalloc_init() local
4480 va = kmem_cache_zalloc(vmap_area_cachep, GFP_NOWAIT); in vmalloc_init()
4481 if (WARN_ON_ONCE(!va)) in vmalloc_init()
4484 va->va_start = (unsigned long)tmp->addr; in vmalloc_init()
4485 va->va_end = va->va_start + tmp->size; in vmalloc_init()
4486 va->vm = tmp; in vmalloc_init()
4487 insert_vmap_area(va, &vmap_area_root, &vmap_area_list); in vmalloc_init()