> On Jun 3, 2020, at 11:14 AM, Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote: > [ ... snip ... ] > - err = radix_tree_preload(gfp_mask); > - if (unlikely(err)) { > - kfree(vb); > - free_vmap_area(va); > - return ERR_PTR(err); > - } > - > vaddr = vmap_block_vaddr(va->va_start, 0); > spin_lock_init(&vb->lock); > vb->va = va; > @@ -1594,11 +1586,12 @@ static void *new_vmap_block(unsigned int order, gfp_t gfp_mask) > INIT_LIST_HEAD(&vb->free_list); > > vb_idx = addr_to_vb_idx(va->va_start); > - spin_lock(&vmap_block_tree_lock); > - err = radix_tree_insert(&vmap_block_tree, vb_idx, vb); > - spin_unlock(&vmap_block_tree_lock); > - BUG_ON(err); > - radix_tree_preload_end(); > + err = xa_insert(&vmap_blocks, vb_idx, vb, gfp_mask); > + if (err) { > + kfree(vb); > + free_vmap_area(va); > + return ERR_PTR(err); > + } > Should the "(err)" here be "unlikely(err)" as the radix tree version was? Nice change and simplifies the code quite a bit. Reviewed-by: William Kucharski <william.kucharski@xxxxxxxxxx>