mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 20:51:44 +00:00
sparc64/mm: Implement pXX_leaf_size() support
Sparc64 has non-pagetable aligned large page support; wire up the pXX_leaf_size() functions to report the correct pagetable page size. This enables PERF_SAMPLE_{DATA,CODE}_PAGE_SIZE to report accurate pagetable leaf sizes. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20201126121121.301768209@infradead.org
This commit is contained in:
parent
c5eecbb58f
commit
e6e4f42eb7
@ -1121,6 +1121,19 @@ extern unsigned long cmdline_memory_size;
|
||||
|
||||
asmlinkage void do_sparc64_fault(struct pt_regs *regs);
|
||||
|
||||
#ifdef CONFIG_HUGETLB_PAGE
|
||||
|
||||
#define pud_leaf_size pud_leaf_size
|
||||
extern unsigned long pud_leaf_size(pud_t pud);
|
||||
|
||||
#define pmd_leaf_size pmd_leaf_size
|
||||
extern unsigned long pmd_leaf_size(pmd_t pmd);
|
||||
|
||||
#define pte_leaf_size pte_leaf_size
|
||||
extern unsigned long pte_leaf_size(pte_t pte);
|
||||
|
||||
#endif /* CONFIG_HUGETLB_PAGE */
|
||||
|
||||
#endif /* !(__ASSEMBLY__) */
|
||||
|
||||
#endif /* !(_SPARC64_PGTABLE_H) */
|
||||
|
@ -247,14 +247,17 @@ static unsigned int sun4u_huge_tte_to_shift(pte_t entry)
|
||||
return shift;
|
||||
}
|
||||
|
||||
static unsigned long tte_to_shift(pte_t entry)
|
||||
{
|
||||
if (tlb_type == hypervisor)
|
||||
return sun4v_huge_tte_to_shift(entry);
|
||||
|
||||
return sun4u_huge_tte_to_shift(entry);
|
||||
}
|
||||
|
||||
static unsigned int huge_tte_to_shift(pte_t entry)
|
||||
{
|
||||
unsigned long shift;
|
||||
|
||||
if (tlb_type == hypervisor)
|
||||
shift = sun4v_huge_tte_to_shift(entry);
|
||||
else
|
||||
shift = sun4u_huge_tte_to_shift(entry);
|
||||
unsigned long shift = tte_to_shift(entry);
|
||||
|
||||
if (shift == PAGE_SHIFT)
|
||||
WARN_ONCE(1, "tto_to_shift: invalid hugepage tte=0x%lx\n",
|
||||
@ -272,6 +275,10 @@ static unsigned long huge_tte_to_size(pte_t pte)
|
||||
return size;
|
||||
}
|
||||
|
||||
unsigned long pud_leaf_size(pud_t pud) { return 1UL << tte_to_shift(*(pte_t *)&pud); }
|
||||
unsigned long pmd_leaf_size(pmd_t pmd) { return 1UL << tte_to_shift(*(pte_t *)&pmd); }
|
||||
unsigned long pte_leaf_size(pte_t pte) { return 1UL << tte_to_shift(pte); }
|
||||
|
||||
pte_t *huge_pte_alloc(struct mm_struct *mm,
|
||||
unsigned long addr, unsigned long sz)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user