Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

powerpc/mm: Use generic_hugetlb_get_unmapped_area()

Use the generic version of arch_hugetlb_get_unmapped_area()
which is now available at all time.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/05f77014c619061638ecc52a0a4136eb04cc2799.1649523076.git.christophe.leroy@csgroup.eu

authored by

Christophe Leroy and committed by
Michael Ellerman
1a0261fd 76a345ed

+1 -62
-4
arch/powerpc/include/asm/book3s/64/hugetlb.h
··· 8 8 */ 9 9 void radix__flush_hugetlb_page(struct vm_area_struct *vma, unsigned long vmaddr); 10 10 void radix__local_flush_hugetlb_page(struct vm_area_struct *vma, unsigned long vmaddr); 11 - extern unsigned long 12 - radix__hugetlb_get_unmapped_area(struct file *file, unsigned long addr, 13 - unsigned long len, unsigned long pgoff, 14 - unsigned long flags); 15 11 16 12 extern void radix__huge_ptep_modify_prot_commit(struct vm_area_struct *vma, 17 13 unsigned long addr, pte_t *ptep,
-55
arch/powerpc/mm/book3s64/radix_hugetlbpage.c
··· 41 41 radix__flush_tlb_range_psize(vma->vm_mm, start, end, psize); 42 42 } 43 43 44 - /* 45 - * A vairant of hugetlb_get_unmapped_area doing topdown search 46 - * FIXME!! should we do as x86 does or non hugetlb area does ? 47 - * ie, use topdown or not based on mmap_is_legacy check ? 48 - */ 49 - unsigned long 50 - radix__hugetlb_get_unmapped_area(struct file *file, unsigned long addr, 51 - unsigned long len, unsigned long pgoff, 52 - unsigned long flags) 53 - { 54 - struct mm_struct *mm = current->mm; 55 - struct vm_area_struct *vma; 56 - struct hstate *h = hstate_file(file); 57 - int fixed = (flags & MAP_FIXED); 58 - unsigned long high_limit; 59 - struct vm_unmapped_area_info info; 60 - 61 - high_limit = DEFAULT_MAP_WINDOW; 62 - if (addr >= high_limit || (fixed && (addr + len > high_limit))) 63 - high_limit = TASK_SIZE; 64 - 65 - if (len & ~huge_page_mask(h)) 66 - return -EINVAL; 67 - if (len > high_limit) 68 - return -ENOMEM; 69 - 70 - if (fixed) { 71 - if (addr > high_limit - len) 72 - return -ENOMEM; 73 - if (prepare_hugepage_range(file, addr, len)) 74 - return -EINVAL; 75 - return addr; 76 - } 77 - 78 - if (addr) { 79 - addr = ALIGN(addr, huge_page_size(h)); 80 - vma = find_vma(mm, addr); 81 - if (high_limit - len >= addr && addr >= mmap_min_addr && 82 - (!vma || addr + len <= vm_start_gap(vma))) 83 - return addr; 84 - } 85 - /* 86 - * We are always doing an topdown search here. Slice code 87 - * does that too. 88 - */ 89 - info.flags = VM_UNMAPPED_AREA_TOPDOWN; 90 - info.length = len; 91 - info.low_limit = max(PAGE_SIZE, mmap_min_addr); 92 - info.high_limit = mm->mmap_base + (high_limit - DEFAULT_MAP_WINDOW); 93 - info.align_mask = PAGE_MASK & ~huge_page_mask(h); 94 - info.align_offset = 0; 95 - 96 - return vm_unmapped_area(&info); 97 - } 98 - 99 44 void radix__huge_ptep_modify_prot_commit(struct vm_area_struct *vma, 100 45 unsigned long addr, pte_t *ptep, 101 46 pte_t old_pte, pte_t pte)
+1 -3
arch/powerpc/mm/hugetlbpage.c
··· 553 553 unsigned long len, unsigned long pgoff, 554 554 unsigned long flags) 555 555 { 556 - #ifdef CONFIG_PPC_RADIX_MMU 557 556 if (radix_enabled()) 558 - return radix__hugetlb_get_unmapped_area(file, addr, len, 557 + return generic_hugetlb_get_unmapped_area(file, addr, len, 559 558 pgoff, flags); 560 - #endif 561 559 #ifdef CONFIG_PPC_64S_HASH_MMU 562 560 return slice_get_unmapped_area(addr, len, flags, file_to_psize(file), 1); 563 561 #endif