diff options
| author | Dave Airlie <[email protected]> | 2020-03-11 07:27:21 +1000 | 
|---|---|---|
| committer | Dave Airlie <[email protected]> | 2020-03-11 07:27:21 +1000 | 
| commit | d3bd37f587b4438d47751d0f1d5aaae3d39bd416 (patch) | |
| tree | 9414a8fd1ca74c47fe1a3966e0a22469ac0b73a3 /arch/powerpc/mm/hugetlbpage.c | |
| parent | 60347451ddb0646c1a9cc5b9581e5bcf648ad1aa (diff) | |
| parent | 2c523b344dfa65a3738e7039832044aa133c75fb (diff) | |
Merge v5.6-rc5 into drm-next
Requested my mripard for some misc patches that need this as a base.
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'arch/powerpc/mm/hugetlbpage.c')
| -rw-r--r-- | arch/powerpc/mm/hugetlbpage.c | 29 | 
1 files changed, 18 insertions, 11 deletions
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index 73d4873fc7f8..33b3461d91e8 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c @@ -53,20 +53,24 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,  	if (pshift >= pdshift) {  		cachep = PGT_CACHE(PTE_T_ORDER);  		num_hugepd = 1 << (pshift - pdshift); +		new = NULL;  	} else if (IS_ENABLED(CONFIG_PPC_8xx)) { -		cachep = PGT_CACHE(PTE_INDEX_SIZE); +		cachep = NULL;  		num_hugepd = 1; +		new = pte_alloc_one(mm);  	} else {  		cachep = PGT_CACHE(pdshift - pshift);  		num_hugepd = 1; +		new = NULL;  	} -	if (!cachep) { +	if (!cachep && !new) {  		WARN_ONCE(1, "No page table cache created for hugetlb tables");  		return -ENOMEM;  	} -	new = kmem_cache_alloc(cachep, pgtable_gfp_flags(mm, GFP_KERNEL)); +	if (cachep) +		new = kmem_cache_alloc(cachep, pgtable_gfp_flags(mm, GFP_KERNEL));  	BUG_ON(pshift > HUGEPD_SHIFT_MASK);  	BUG_ON((unsigned long)new & HUGEPD_SHIFT_MASK); @@ -97,7 +101,10 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,  	if (i < num_hugepd) {  		for (i = i - 1 ; i >= 0; i--, hpdp--)  			*hpdp = __hugepd(0); -		kmem_cache_free(cachep, new); +		if (cachep) +			kmem_cache_free(cachep, new); +		else +			pte_free(mm, new);  	} else {  		kmemleak_ignore(new);  	} @@ -324,8 +331,7 @@ static void free_hugepd_range(struct mmu_gather *tlb, hugepd_t *hpdp, int pdshif  	if (shift >= pdshift)  		hugepd_free(tlb, hugepte);  	else if (IS_ENABLED(CONFIG_PPC_8xx)) -		pgtable_free_tlb(tlb, hugepte, -				 get_hugepd_cache_index(PTE_INDEX_SIZE)); +		pgtable_free_tlb(tlb, hugepte, 0);  	else  		pgtable_free_tlb(tlb, hugepte,  				 get_hugepd_cache_index(pdshift - shift)); @@ -639,12 +645,13 @@ static int __init hugetlbpage_init(void)  		 * if we have pdshift and shift value same, we don't  		 * use pgt cache for hugepd.  		 */ -		if (pdshift > shift && IS_ENABLED(CONFIG_PPC_8xx)) -			pgtable_cache_add(PTE_INDEX_SIZE); -		else if (pdshift > shift) -			pgtable_cache_add(pdshift - shift); -		else if (IS_ENABLED(CONFIG_PPC_FSL_BOOK3E) || IS_ENABLED(CONFIG_PPC_8xx)) +		if (pdshift > shift) { +			if (!IS_ENABLED(CONFIG_PPC_8xx)) +				pgtable_cache_add(pdshift - shift); +		} else if (IS_ENABLED(CONFIG_PPC_FSL_BOOK3E) || +			   IS_ENABLED(CONFIG_PPC_8xx)) {  			pgtable_cache_add(PTE_T_ORDER); +		}  		configured = true;  	}  |