Commit 5211e6e6 authored by Giridhar Pemmasani's avatar Giridhar Pemmasani Committed by Linus Torvalds

[PATCH] Fix GFP_HIGHMEM slab panic

As reported by Martin J. Bligh <>, we let through some
non-slab bits to slab allocation through __get_vm_area_node when doing a

I haven't been able to reproduce this, although I understand why it
happens: vmalloc allocates memory with


and commit 52fd24ca resulted in the same
flags are passed down to cache_alloc_refill, causing the BUG.  The
following patch fixes it.

Note that when calling kmalloc_node, I am masking off __GFP_HIGHMEM with
GFP_LEVEL_MASK, whereas __vmalloc_area_node does the same with


IMHO, using GFP_LEVEL_MASK is preferable, but either should fix this

Signed-off-by: Giridhar Pemmasani (
Cc: Martin J. Bligh <>
Cc: Andrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 2da6dc28
......@@ -182,7 +182,7 @@ static struct vm_struct *__get_vm_area_node(unsigned long size, unsigned long fl
addr = ALIGN(start, align);
size = PAGE_ALIGN(size);
area = kmalloc_node(sizeof(*area), gfp_mask, node);
area = kmalloc_node(sizeof(*area), gfp_mask & GFP_LEVEL_MASK, node);
if (unlikely(!area))
return NULL;
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