Re: [PATCH v4 06/10] powerpc/mm: Use generic_get_unmapped_area() and call it from arch_get_unmapped_area()

Christophe Leroy
2021-12-10T17:47:09Z

Le 09/12/2021 à 10:50, Nicholas Piggin a écrit :
> Excerpts from Christophe Leroy's message of December 9, 2021 3:18 am:
>> Use the generic version of arch_get_unmapped_area() which
>> is now available at all time instead of its copy
>> radix__arch_get_unmapped_area()
>>
>> Instead of setting mm->get_unmapped_area() to either
>> arch_get_unmapped_area() or generic_get_unmapped_area(),
>> always set it to arch_get_unmapped_area() and call
>> generic_get_unmapped_area() from there when radix is enabled.
>>
>> Do the same with radix__arch_get_unmapped_area_topdown()
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>> ---
>> arch/powerpc/mm/mmap.c | 127 ++---------------------------------------
>> 1 file changed, 6 insertions(+), 121 deletions(-)
>>
>> diff --git a/arch/powerpc/mm/mmap.c b/arch/powerpc/mm/mmap.c
>> index 9b0d6e395bc0..46781d0103d1 100644
>> --- a/arch/powerpc/mm/mmap.c
>> +++ b/arch/powerpc/mm/mmap.c
>> @@ -81,115 +81,15 @@ static inline unsigned long mmap_base(unsigned long rnd,
>> }
>>
>> #ifdef HAVE_ARCH_UNMAPPED_AREA
>> -#ifdef CONFIG_PPC_RADIX_MMU
>> -/*
>> - * Same function as generic code used only for radix, because we don't need to overload
>> - * the generic one. But we will have to duplicate, because hash select
>> - * HAVE_ARCH_UNMAPPED_AREA
>> - */
>> -static unsigned long
>> -radix__arch_get_unmapped_area(struct file *filp, unsigned long addr,
>> - unsigned long len, unsigned long pgoff,
>> - unsigned long flags)
>> -{
>> - struct mm_struct *mm = current->mm;
>> - struct vm_area_struct *vma;
>> - int fixed = (flags & MAP_FIXED);
>> - unsigned long high_limit;
>> - struct vm_unmapped_area_info info;
>> -
>> - high_limit = DEFAULT_MAP_WINDOW;
>> - if (addr >= high_limit || (fixed && (addr + len > high_limit)))
>> - high_limit = TASK_SIZE;
>
> Does 64s radix need to define arch_get_mmap_end() to do the above now?

Sure, good point.

Seems like I got hypnotised by the comment "- * Same function as generic
code used only for radix", I didn't catch that little difference.

>
> Otherwise great to consolidate this with core code, nice patch.
>
> Thanks,
> Nick
>