Commit 5803ed29 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Linus Torvalds

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/1479474236-4139-9-git-send-email-hch@lst.deSigned-off-by: default avatarChristoph Hellwig <hch@lst.de>
Tested-by: default avatarJisheng Zhang <jszhang@marvell.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Joel Fernandes <joelaf@google.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: John Dias <joaodias@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8d5341a6
...@@ -365,7 +365,7 @@ static struct vmap_area *alloc_vmap_area(unsigned long size, ...@@ -365,7 +365,7 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
BUG_ON(offset_in_page(size)); BUG_ON(offset_in_page(size));
BUG_ON(!is_power_of_2(align)); BUG_ON(!is_power_of_2(align));
might_sleep_if(gfpflags_allow_blocking(gfp_mask)); might_sleep();
va = kmalloc_node(sizeof(struct vmap_area), va = kmalloc_node(sizeof(struct vmap_area),
gfp_mask & GFP_RECLAIM_MASK, node); gfp_mask & GFP_RECLAIM_MASK, node);
...@@ -1037,6 +1037,8 @@ void vm_unmap_aliases(void) ...@@ -1037,6 +1037,8 @@ void vm_unmap_aliases(void)
if (unlikely(!vmap_initialized)) if (unlikely(!vmap_initialized))
return; return;
might_sleep();
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
struct vmap_block_queue *vbq = &per_cpu(vmap_block_queue, cpu); struct vmap_block_queue *vbq = &per_cpu(vmap_block_queue, cpu);
struct vmap_block *vb; struct vmap_block *vb;
...@@ -1080,6 +1082,7 @@ void vm_unmap_ram(const void *mem, unsigned int count) ...@@ -1080,6 +1082,7 @@ void vm_unmap_ram(const void *mem, unsigned int count)
unsigned long addr = (unsigned long)mem; unsigned long addr = (unsigned long)mem;
struct vmap_area *va; struct vmap_area *va;
might_sleep();
BUG_ON(!addr); BUG_ON(!addr);
BUG_ON(addr < VMALLOC_START); BUG_ON(addr < VMALLOC_START);
BUG_ON(addr > VMALLOC_END); BUG_ON(addr > VMALLOC_END);
...@@ -1431,6 +1434,8 @@ struct vm_struct *remove_vm_area(const void *addr) ...@@ -1431,6 +1434,8 @@ struct vm_struct *remove_vm_area(const void *addr)
{ {
struct vmap_area *va; struct vmap_area *va;
might_sleep();
va = find_vmap_area((unsigned long)addr); va = find_vmap_area((unsigned long)addr);
if (va && va->flags & VM_VM_AREA) { if (va && va->flags & VM_VM_AREA) {
struct vm_struct *vm = va->vm; struct vm_struct *vm = va->vm;
......
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