mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 05:31:08 -04:00
mm: merge pte_mkhuge() call into arch_make_huge_pte()
Each call into pte_mkhuge() is invariably followed by arch_make_huge_pte(). Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the beginning. This updates generic fallback stub for arch_make_huge_pte() and available platforms definitions. This makes huge pte creation much cleaner and easier to follow. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Anshuman Khandual <[email protected]> Reviewed-by: Christophe Leroy <[email protected]> Acked-by: Mike Kravetz <[email protected]> Acked-by: Catalin Marinas <[email protected]> Cc: Will Deacon <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Mike Kravetz <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
1 parent
ef696f93ed
commit
16785bd774
6 files changed
+6
-6
No files matched your search
@@ -347,6 +347,7 @@ 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) {
|
||||
|
||||
@@ -71,9 +71,9 @@ static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags
|
||||
size_t size = 1UL << shift;
|
||||
|
||||
if (size == SZ_16K)
|
||||
return __pte(pte_val(entry) & ~_PAGE_HUGE);
|
||||
return __pte(pte_val(entry) | _PAGE_SPS);
|
||||
else
|
||||
return entry;
|
||||
return __pte(pte_val(entry) | _PAGE_SPS | _PAGE_HUGE);
|
||||
}
|
||||
#define arch_make_huge_pte arch_make_huge_pte
|
||||
#endif
|
||||
|
||||
@@ -181,6 +181,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
|
||||
{
|
||||
pte_t pte;
|
||||
|
||||
entry = pte_mkhuge(entry);
|
||||
pte = hugepage_shift_to_tte(entry, shift);
|
||||
|
||||
#ifdef CONFIG_SPARC64
|
||||
|
||||
@@ -754,7 +754,7 @@ static inline void arch_clear_hugepage_flags(struct page *page) { }
|
||||
static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift,
|
||||
vm_flags_t flags)
|
||||
{
|
||||
return entry;
|
||||
return pte_mkhuge(entry);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+1
-2
@@ -4637,7 +4637,6 @@ static pte_t make_huge_pte(struct vm_area_struct *vma, struct page *page,
|
||||
vma->vm_page_prot));
|
||||
}
|
||||
entry = pte_mkyoung(entry);
|
||||
entry = pte_mkhuge(entry);
|
||||
entry = arch_make_huge_pte(entry, shift, vma->vm_flags);
|
||||
|
||||
return entry;
|
||||
@@ -6171,7 +6170,7 @@ unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
|
||||
unsigned int shift = huge_page_shift(hstate_vma(vma));
|
||||
|
||||
old_pte = huge_ptep_modify_prot_start(vma, address, ptep);
|
||||
pte = pte_mkhuge(huge_pte_modify(old_pte, newprot));
|
||||
pte = huge_pte_modify(old_pte, newprot);
|
||||
pte = arch_make_huge_pte(pte, shift, vma->vm_flags);
|
||||
huge_ptep_modify_prot_commit(vma, address, ptep, old_pte, pte);
|
||||
pages++;
|
||||
|
||||
@@ -118,7 +118,6 @@ static int vmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
|
||||
if (size != PAGE_SIZE) {
|
||||
pte_t entry = pfn_pte(pfn, prot);
|
||||
|
||||
entry = pte_mkhuge(entry);
|
||||
entry = arch_make_huge_pte(entry, ilog2(size), 0);
|
||||
set_huge_pte_at(&init_mm, addr, pte, entry);
|
||||
pfn += PFN_DOWN(size);
|
||||
|
||||
Reference in new issue
Block a user