[PATCH] powerpc/mm/hash: Clear the invalid slot information correctly

Aneesh Kumar K.V aneesh.kumar at linux.vnet.ibm.com
Sun Feb 21 01:34:27 AEDT 2016


Balbir Singh <bsingharora at gmail.com> writes:

...........
............

>> diff --git a/arch/powerpc/mm/hugepage-hash64.c b/arch/powerpc/mm/hugepage-hash64.c
>> index 49b152b0f926..8424f46c2bf7 100644
>> --- a/arch/powerpc/mm/hugepage-hash64.c
>> +++ b/arch/powerpc/mm/hugepage-hash64.c
>> @@ -78,9 +78,14 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid,
>>  		 * base page size. This is because demote_segment won't flush
>>  		 * hash page table entries.
>>  		 */
>> -		if ((old_pmd & _PAGE_HASHPTE) && !(old_pmd & _PAGE_COMBO))
>> +		if ((old_pmd & _PAGE_HASHPTE) && !(old_pmd & _PAGE_COMBO)) {
>>  			flush_hash_hugepage(vsid, ea, pmdp, MMU_PAGE_64K,
>>  					    ssize, flags);
>> +			/*
>> +			 * clear the old slot information 
>> +			 */
> Redundant comment, something more useful? why clear it?
>> +			memset(hpte_slot_array, 0, PTE_FRAG_SIZE);
>> +		}
>>  	}
>>  

explained in the commit message. 


 With THP, we also clear the slot information with respect to all
 the 64K hash pte mapping that 16MB page. They are all invalid
 now. This make sure we don't find the slot valid when we fault with
 4k base page size. Finding the slot valid should not result in any wrong
 behavior because we do check again in hash page table for the validity.
 But we can avoid that check completely.



>>  	valid = hpte_valid(hpte_slot_array, index);



More information about the Linuxppc-dev mailing list