Unverified Commit dfc7e145 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!15270 v2 mm: Backport two patch

Merge Pull Request from: @ci-robot 
 
PR sync from: Liu Shixin <liushixin2@huawei.com>
https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/VBK7RAPAGL5AGRCUYPOTIDZC47LR26RK/ 
Anshuman Khandual (2):
  arm64/mm: Re-organize arch_make_huge_pte()
  arm64/mm: Drop setting PTE_TYPE_PAGE in pte_mkcont()

Liu Shixin (1):
  mm/hugetlb: use arch_make_huge_pte() in __hugetlb_insert_pfn()

 
https://gitee.com/openeuler/kernel/issues/IBPX2S 
 
Link:https://gitee.com/openeuler/kernel/pulls/15270

 

Reviewed-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: default avatarZhang Peng <zhangpeng362@huawei.com>
parents 305d3014 74bf0f1a
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -236,8 +236,7 @@ static inline pte_t pte_mkspecial(pte_t pte)

static inline pte_t pte_mkcont(pte_t pte)
{
	pte = set_pte_bit(pte, __pgprot(PTE_CONT));
	return set_pte_bit(pte, __pgprot(PTE_TYPE_PAGE));
	return set_pte_bit(pte, __pgprot(PTE_CONT));
}

static inline pte_t pte_mknoncont(pte_t pte)
@@ -378,11 +377,6 @@ static inline void __set_ptes(struct mm_struct *mm,
	}
}

/*
 * Huge pte definitions.
 */
#define pte_mkhuge(pte)		(__pte(pte_val(pte) & ~PTE_TABLE_BIT))

/*
 * Hugetlb definitions.
 */
+16 −5
Original line number Diff line number Diff line
@@ -379,14 +379,25 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
{
	size_t pagesize = 1UL << shift;

	entry = pte_mkhuge(entry);
	if (pagesize == CONT_PTE_SIZE) {
		entry = pte_mkcont(entry);
	} else if (pagesize == CONT_PMD_SIZE) {
	switch (pagesize) {
#ifndef __PAGETABLE_PMD_FOLDED
	case PUD_SIZE:
		entry = pud_pte(pud_mkhuge(pte_pud(entry)));
		break;
#endif
	case CONT_PMD_SIZE:
		entry = pmd_pte(pmd_mkcont(pte_pmd(entry)));
	} else if (pagesize != PUD_SIZE && pagesize != PMD_SIZE) {
		fallthrough;
	case PMD_SIZE:
		entry = pmd_pte(pmd_mkhuge(pte_pmd(entry)));
		break;
	case CONT_PTE_SIZE:
		entry = pte_mkcont(entry);
		break;
	default:
		pr_warn("%s: unrecognized huge page size 0x%lx\n",
			__func__, pagesize);
		break;
	}
	return entry;
}
+1 −1
Original line number Diff line number Diff line
@@ -7776,7 +7776,7 @@ static int __hugetlb_insert_pfn(struct mm_struct *mm, unsigned long addr,
	if (!(pgprot_val(prot) & PTE_RDONLY))
		entry = huge_pte_mkwrite(entry);
	entry = pte_mkyoung(entry);
	entry = pte_mkhuge(entry);
	entry = arch_make_huge_pte(entry, huge_page_shift(h), VM_ACCESS_FLAGS);
	entry = pte_mkspecial(entry);

	ptl = huge_pte_lockptr(h, mm, ptep);