Skip to content

Commit d086817

Browse files
MinChan Kimtorvalds
authored andcommitted
vmap: remove needless lock and list in vmap
vmap's dirty_list is unused. It's for optimizing flushing. but Nick didn't write the code yet. so, we don't need it until time as it is needed. This patch removes vmap_block's dirty_list and codes related to it. Signed-off-by: MinChan Kim <[email protected]> Acked-by: Nick Piggin <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent ef161a9 commit d086817

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

mm/vmalloc.c

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -671,10 +671,7 @@ struct vmap_block {
671671
DECLARE_BITMAP(alloc_map, VMAP_BBMAP_BITS);
672672
DECLARE_BITMAP(dirty_map, VMAP_BBMAP_BITS);
673673
union {
674-
struct {
675-
struct list_head free_list;
676-
struct list_head dirty_list;
677-
};
674+
struct list_head free_list;
678675
struct rcu_head rcu_head;
679676
};
680677
};
@@ -741,7 +738,6 @@ static struct vmap_block *new_vmap_block(gfp_t gfp_mask)
741738
bitmap_zero(vb->alloc_map, VMAP_BBMAP_BITS);
742739
bitmap_zero(vb->dirty_map, VMAP_BBMAP_BITS);
743740
INIT_LIST_HEAD(&vb->free_list);
744-
INIT_LIST_HEAD(&vb->dirty_list);
745741

746742
vb_idx = addr_to_vb_idx(va->va_start);
747743
spin_lock(&vmap_block_tree_lock);
@@ -772,12 +768,7 @@ static void free_vmap_block(struct vmap_block *vb)
772768
struct vmap_block *tmp;
773769
unsigned long vb_idx;
774770

775-
spin_lock(&vb->vbq->lock);
776-
if (!list_empty(&vb->free_list))
777-
list_del(&vb->free_list);
778-
if (!list_empty(&vb->dirty_list))
779-
list_del(&vb->dirty_list);
780-
spin_unlock(&vb->vbq->lock);
771+
BUG_ON(!list_empty(&vb->free_list));
781772

782773
vb_idx = addr_to_vb_idx(vb->va->va_start);
783774
spin_lock(&vmap_block_tree_lock);
@@ -862,11 +853,7 @@ static void vb_free(const void *addr, unsigned long size)
862853

863854
spin_lock(&vb->lock);
864855
bitmap_allocate_region(vb->dirty_map, offset >> PAGE_SHIFT, order);
865-
if (!vb->dirty) {
866-
spin_lock(&vb->vbq->lock);
867-
list_add(&vb->dirty_list, &vb->vbq->dirty);
868-
spin_unlock(&vb->vbq->lock);
869-
}
856+
870857
vb->dirty += 1UL << order;
871858
if (vb->dirty == VMAP_BBMAP_BITS) {
872859
BUG_ON(vb->free || !list_empty(&vb->free_list));

0 commit comments

Comments
 (0)