Commit 3fcd76e8 authored by Zhang Yanfei's avatar Zhang Yanfei Committed by Linus Torvalds
Browse files

mm/vmalloc.c: remove dead code in vb_alloc

Space in a vmap block that was once allocated is considered dirty and
not made available for allocation again before the whole block is
recycled.  The result is that free space within a vmap block is always

So if a vmap block has enough free space for allocation, the allocation
is impossible to fail.  Thus, the fragmented block purging was never
invoked from vb_alloc().  So remove this dead code.

[ Same patches also sent by:

    Chanho Min <>
    Johannes Weiner <>

  but git doesn't do "multiple authors" ]
Signed-off-by: default avatarZhang Yanfei <>
Cc: Johannes Weiner <>
Cc: Mel Gorman <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent ab15d9b4
......@@ -910,7 +910,6 @@ static void *vb_alloc(unsigned long size, gfp_t gfp_mask)
struct vmap_block *vb;
unsigned long addr = 0;
unsigned int order;
int purge = 0;
BUG_ON(size & ~PAGE_MASK);
......@@ -934,17 +933,7 @@ again:
if (vb->free < 1UL << order)
goto next;
i = bitmap_find_free_region(vb->alloc_map,
if (i < 0) {
if (vb->free + vb->dirty == VMAP_BBMAP_BITS) {
/* fragmented and no outstanding allocations */
BUG_ON(vb->dirty != VMAP_BBMAP_BITS);
purge = 1;
goto next;
i = VMAP_BBMAP_BITS - vb->free;
addr = vb->va->va_start + (i << PAGE_SHIFT);
BUG_ON(addr_to_vb_idx(addr) !=
......@@ -960,9 +949,6 @@ next:
if (purge)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment