From: Benjamin Herrenschmidt Date: Sun, 6 May 2007 21:50:12 +0000 (-0700) Subject: get_unmapped_area handles MAP_FIXED in hugetlbfs X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=036e08568cbee4b16e14551e9f004c3d490d6271;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git get_unmapped_area handles MAP_FIXED in hugetlbfs Generic hugetlb_get_unmapped_area() now handles MAP_FIXED by just calling prepare_hugepage_range() Signed-off-by: Benjamin Herrenschmidt Acked-by: William Irwin Cc: Paul Mackerras Cc: Richard Henderson Cc: Ivan Kokshaysky Cc: Russell King Cc: David Howells Cc: Andi Kleen Cc: "Luck, Tony" Cc: Kyle McMartin Cc: Grant Grundler Cc: Matthew Wilcox Cc: "David S. Miller" Cc: Adam Litke Cc: David Gibson Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 8e1b7825e2f3..fe625cd1719a 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -112,6 +113,12 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, if (len > TASK_SIZE) return -ENOMEM; + if (flags & MAP_FIXED) { + if (prepare_hugepage_range(addr, len, pgoff)) + return -EINVAL; + return addr; + } + if (addr) { addr = ALIGN(addr, HPAGE_SIZE); vma = find_vma(mm, addr);