aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/mm/hugetlbpage.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index d0ec887f05a2..1f07f70ac89f 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -566,6 +566,13 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
566 if (len > TASK_SIZE) 566 if (len > TASK_SIZE)
567 return -ENOMEM; 567 return -ENOMEM;
568 568
569 /* handle fixed mapping: prevent overlap with huge pages */
570 if (flags & MAP_FIXED) {
571 if (is_hugepage_only_range(mm, addr, len))
572 return -EINVAL;
573 return addr;
574 }
575
569 if (addr) { 576 if (addr) {
570 addr = PAGE_ALIGN(addr); 577 addr = PAGE_ALIGN(addr);
571 vma = find_vma(mm, addr); 578 vma = find_vma(mm, addr);
@@ -641,6 +648,13 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
641 if (len > TASK_SIZE) 648 if (len > TASK_SIZE)
642 return -ENOMEM; 649 return -ENOMEM;
643 650
651 /* handle fixed mapping: prevent overlap with huge pages */
652 if (flags & MAP_FIXED) {
653 if (is_hugepage_only_range(mm, addr, len))
654 return -EINVAL;
655 return addr;
656 }
657
644 /* dont allow allocations above current base */ 658 /* dont allow allocations above current base */
645 if (mm->free_area_cache > base) 659 if (mm->free_area_cache > base)
646 mm->free_area_cache = base; 660 mm->free_area_cache = base;
@@ -823,6 +837,13 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
823 /* Paranoia, caller should have dealt with this */ 837 /* Paranoia, caller should have dealt with this */
824 BUG_ON((addr + len) < addr); 838 BUG_ON((addr + len) < addr);
825 839
840 /* Handle MAP_FIXED */
841 if (flags & MAP_FIXED) {
842 if (prepare_hugepage_range(addr, len, pgoff))
843 return -EINVAL;
844 return addr;
845 }
846
826 if (test_thread_flag(TIF_32BIT)) { 847 if (test_thread_flag(TIF_32BIT)) {
827 curareas = current->mm->context.low_htlb_areas; 848 curareas = current->mm->context.low_htlb_areas;
828 849