• Home
  • Raw
  • Download

Lines Matching refs:vb

798 	struct vmap_block *vb;  in new_vmap_block()  local
805 vb = kmalloc_node(sizeof(struct vmap_block), in new_vmap_block()
807 if (unlikely(!vb)) in new_vmap_block()
814 kfree(vb); in new_vmap_block()
820 kfree(vb); in new_vmap_block()
825 spin_lock_init(&vb->lock); in new_vmap_block()
826 vb->va = va; in new_vmap_block()
827 vb->free = VMAP_BBMAP_BITS; in new_vmap_block()
828 vb->dirty = 0; in new_vmap_block()
829 bitmap_zero(vb->dirty_map, VMAP_BBMAP_BITS); in new_vmap_block()
830 INIT_LIST_HEAD(&vb->free_list); in new_vmap_block()
834 err = radix_tree_insert(&vmap_block_tree, vb_idx, vb); in new_vmap_block()
841 list_add_rcu(&vb->free_list, &vbq->free); in new_vmap_block()
845 return vb; in new_vmap_block()
848 static void free_vmap_block(struct vmap_block *vb) in free_vmap_block() argument
853 vb_idx = addr_to_vb_idx(vb->va->va_start); in free_vmap_block()
857 BUG_ON(tmp != vb); in free_vmap_block()
859 free_vmap_area_noflush(vb->va); in free_vmap_block()
860 kfree_rcu(vb, rcu_head); in free_vmap_block()
866 struct vmap_block *vb; in purge_fragmented_blocks() local
871 list_for_each_entry_rcu(vb, &vbq->free, free_list) { in purge_fragmented_blocks()
873 if (!(vb->free + vb->dirty == VMAP_BBMAP_BITS && vb->dirty != VMAP_BBMAP_BITS)) in purge_fragmented_blocks()
876 spin_lock(&vb->lock); in purge_fragmented_blocks()
877 if (vb->free + vb->dirty == VMAP_BBMAP_BITS && vb->dirty != VMAP_BBMAP_BITS) { in purge_fragmented_blocks()
878 vb->free = 0; /* prevent further allocs after releasing lock */ in purge_fragmented_blocks()
879 vb->dirty = VMAP_BBMAP_BITS; /* prevent purging it again */ in purge_fragmented_blocks()
880 bitmap_fill(vb->dirty_map, VMAP_BBMAP_BITS); in purge_fragmented_blocks()
882 list_del_rcu(&vb->free_list); in purge_fragmented_blocks()
884 spin_unlock(&vb->lock); in purge_fragmented_blocks()
885 list_add_tail(&vb->purge, &purge); in purge_fragmented_blocks()
887 spin_unlock(&vb->lock); in purge_fragmented_blocks()
891 list_for_each_entry_safe(vb, n_vb, &purge, purge) { in purge_fragmented_blocks()
892 list_del(&vb->purge); in purge_fragmented_blocks()
893 free_vmap_block(vb); in purge_fragmented_blocks()
908 struct vmap_block *vb; in vb_alloc() local
927 list_for_each_entry_rcu(vb, &vbq->free, free_list) { in vb_alloc()
930 spin_lock(&vb->lock); in vb_alloc()
931 if (vb->free < 1UL << order) in vb_alloc()
934 i = VMAP_BBMAP_BITS - vb->free; in vb_alloc()
935 addr = vb->va->va_start + (i << PAGE_SHIFT); in vb_alloc()
937 addr_to_vb_idx(vb->va->va_start)); in vb_alloc()
938 vb->free -= 1UL << order; in vb_alloc()
939 if (vb->free == 0) { in vb_alloc()
941 list_del_rcu(&vb->free_list); in vb_alloc()
944 spin_unlock(&vb->lock); in vb_alloc()
947 spin_unlock(&vb->lock); in vb_alloc()
954 vb = new_vmap_block(gfp_mask); in vb_alloc()
955 if (IS_ERR(vb)) in vb_alloc()
956 return vb; in vb_alloc()
968 struct vmap_block *vb; in vb_free() local
981 vb = radix_tree_lookup(&vmap_block_tree, vb_idx); in vb_free()
983 BUG_ON(!vb); in vb_free()
987 spin_lock(&vb->lock); in vb_free()
988 BUG_ON(bitmap_allocate_region(vb->dirty_map, offset >> PAGE_SHIFT, order)); in vb_free()
990 vb->dirty += 1UL << order; in vb_free()
991 if (vb->dirty == VMAP_BBMAP_BITS) { in vb_free()
992 BUG_ON(vb->free); in vb_free()
993 spin_unlock(&vb->lock); in vb_free()
994 free_vmap_block(vb); in vb_free()
996 spin_unlock(&vb->lock); in vb_free()
1023 struct vmap_block *vb; in vm_unmap_aliases() local
1026 list_for_each_entry_rcu(vb, &vbq->free, free_list) { in vm_unmap_aliases()
1029 spin_lock(&vb->lock); in vm_unmap_aliases()
1030 i = find_first_bit(vb->dirty_map, VMAP_BBMAP_BITS); in vm_unmap_aliases()
1034 j = find_last_bit(vb->dirty_map, in vm_unmap_aliases()
1038 s = vb->va->va_start + (i << PAGE_SHIFT); in vm_unmap_aliases()
1039 e = vb->va->va_start + (j << PAGE_SHIFT); in vm_unmap_aliases()
1047 spin_unlock(&vb->lock); in vm_unmap_aliases()