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

Christophe Leroy christophe.leroy at csgroup.eu
Fri Dec 17 01:25:36 AEDT 2021



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 at 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?
> 
> Otherwise great to consolidate this with core code, nice patch.
> 

Yes it needs arch_get_mmap_end() and also arch_get_mmap_base().

I added it in v5, taking also suggestion from Michael.

Thanks
Christophe


More information about the Linuxppc-dev mailing list