[RFC PATCH] powerpc/mm: Reduce memory usage for mm_context_t for radix

Christophe Leroy christophe.leroy at c-s.fr
Wed Apr 3 05:37:23 AEDT 2019



Le 02/04/2019 à 20:31, Christophe Leroy a écrit :
> 
> 
> Le 02/04/2019 à 16:34, Aneesh Kumar K.V a écrit :
>> Currently, our mm_context_t on book3s64 include all hash specific
>> context details like slice mask, subpage protection details. We
>> can skip allocating those on radix. This will help us to save
>> 8K per mm_context with radix translation.
>>
>> With the patch applied we have
>>
>> sizeof(mm_context_t)  = 136
>> sizeof(struct hash_mm_context)  = 8288
>>
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar at linux.ibm.com>
>> ---
>> NOTE:
>>
>> If we want to do this, I am still trying to figure out how best we can 
>> do this
>> without all the #ifdef and other overhead for 8xx book3e
>>
>>
>>   arch/powerpc/include/asm/book3s/64/mmu-hash.h |  2 +-
>>   arch/powerpc/include/asm/book3s/64/mmu.h      | 48 +++++++++++--------
>>   arch/powerpc/include/asm/book3s/64/slice.h    |  6 +--
>>   arch/powerpc/kernel/paca.c                    |  9 ++--
>>   arch/powerpc/kernel/setup-common.c            |  7 ++-
>>   arch/powerpc/mm/hash_utils_64.c               | 10 ++--
>>   arch/powerpc/mm/mmu_context_book3s64.c        | 16 ++++++-
>>   arch/powerpc/mm/slb.c                         |  2 +-
>>   arch/powerpc/mm/slice.c                       | 48 +++++++++----------
>>   arch/powerpc/mm/subpage-prot.c                |  8 ++--
>>   10 files changed, 91 insertions(+), 65 deletions(-)
>>

[...]

>> @@ -253,7 +253,7 @@ static void slice_convert(struct mm_struct *mm,
>>        */
>>       spin_lock_irqsave(&slice_convert_lock, flags);
>> -    lpsizes = mm->context.low_slices_psize;
>> +    lpsizes = mm->context.hash_context->low_slices_psize;
> 
> A help to get ->low_slices_psize would help,
> something like:
> 
> In nohash/32/mmu-8xx:
> 
> unsigned char *slice_low_slices_psize(context_t *ctx)
> {
>      return mm->context.low_slices_psize;

Of course here I meant:

unsigned char *slice_low_slices_psize(mm_context_t *ctx)
{
	return ctx->low_slices_psize;
}

> }
> 
> And in book3s/64/mmu.h:
> 
> unsigned char *slice_low_slices_psize(context_t *ctx)
> {
>      return mm->context.hash_context->low_slices_psize;

and

unsigned char *slice_low_slices_psize(mm_context_t *ctx)
{
	return ctx->hash_context->low_slices_psize;
}

Christophe


More information about the Linuxppc-dev mailing list