Skip to content

Commit 5803ed2

Browse files
Christoph Hellwigtorvalds
authored andcommitted
mm: mark all calls into the vmalloc subsystem as potentially sleeping
We will take a sleeping lock in later in this series, so this adds the proper safeguards. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Christoph Hellwig <[email protected]> Tested-by: Jisheng Zhang <[email protected]> Cc: Andrey Ryabinin <[email protected]> Cc: Joel Fernandes <[email protected]> Cc: Chris Wilson <[email protected]> Cc: John Dias <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Ingo Molnar <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 8d5341a commit 5803ed2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

mm/vmalloc.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
365365
BUG_ON(offset_in_page(size));
366366
BUG_ON(!is_power_of_2(align));
367367

368-
might_sleep_if(gfpflags_allow_blocking(gfp_mask));
368+
might_sleep();
369369

370370
va = kmalloc_node(sizeof(struct vmap_area),
371371
gfp_mask & GFP_RECLAIM_MASK, node);
@@ -1037,6 +1037,8 @@ void vm_unmap_aliases(void)
10371037
if (unlikely(!vmap_initialized))
10381038
return;
10391039

1040+
might_sleep();
1041+
10401042
for_each_possible_cpu(cpu) {
10411043
struct vmap_block_queue *vbq = &per_cpu(vmap_block_queue, cpu);
10421044
struct vmap_block *vb;
@@ -1080,6 +1082,7 @@ void vm_unmap_ram(const void *mem, unsigned int count)
10801082
unsigned long addr = (unsigned long)mem;
10811083
struct vmap_area *va;
10821084

1085+
might_sleep();
10831086
BUG_ON(!addr);
10841087
BUG_ON(addr < VMALLOC_START);
10851088
BUG_ON(addr > VMALLOC_END);
@@ -1431,6 +1434,8 @@ struct vm_struct *remove_vm_area(const void *addr)
14311434
{
14321435
struct vmap_area *va;
14331436

1437+
might_sleep();
1438+
14341439
va = find_vmap_area((unsigned long)addr);
14351440
if (va && va->flags & VM_VM_AREA) {
14361441
struct vm_struct *vm = va->vm;

0 commit comments

Comments
 (0)