Message ID | 1548307220-19756-6-git-send-email-anshuman.khandual@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | arm64/mm: Enable accounting for page table pages | expand |
On Thu, Jan 24, 2019 at 10:50:19AM +0530, Anshuman Khandual wrote: > TLB flush during PMD and PUD level page table page tear down currently does > not call pgtable_page_dtor() like that for PTE page table pages. Now that > all the page table pages which are allocated from the buddy allocator must > have been initialized through pgtable_page_ctor() they must be freed back > only after being called into pgtable_page_dtor() destructor. Else these > pages might run into bad page state errors while getting freed into buddy > allocator. > > Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> > --- > arch/arm64/include/asm/tlb.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h > index 106fdc9..de46ba0 100644 > --- a/arch/arm64/include/asm/tlb.h > +++ b/arch/arm64/include/asm/tlb.h > @@ -62,6 +62,7 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, > static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, > unsigned long addr) > { > + pgtable_page_dtor(virt_to_page(pmdp)); > tlb_remove_table(tlb, virt_to_page(pmdp)); > } > #endif > @@ -70,6 +71,7 @@ static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, > static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pudp, > unsigned long addr) > { > + pgtable_page_dtor(virt_to_page(pudp)); > tlb_remove_table(tlb, virt_to_page(pudp)); This would be cleaner if you assigned to a temporary struct page * variable. With that: Acked-by: Will Deacon <will.deacon@arm.com> Will
On 02/14/2019 10:41 PM, Will Deacon wrote: > On Thu, Jan 24, 2019 at 10:50:19AM +0530, Anshuman Khandual wrote: >> TLB flush during PMD and PUD level page table page tear down currently does >> not call pgtable_page_dtor() like that for PTE page table pages. Now that >> all the page table pages which are allocated from the buddy allocator must >> have been initialized through pgtable_page_ctor() they must be freed back >> only after being called into pgtable_page_dtor() destructor. Else these >> pages might run into bad page state errors while getting freed into buddy >> allocator. >> >> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> >> --- >> arch/arm64/include/asm/tlb.h | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h >> index 106fdc9..de46ba0 100644 >> --- a/arch/arm64/include/asm/tlb.h >> +++ b/arch/arm64/include/asm/tlb.h >> @@ -62,6 +62,7 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, >> static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, >> unsigned long addr) >> { >> + pgtable_page_dtor(virt_to_page(pmdp)); >> tlb_remove_table(tlb, virt_to_page(pmdp)); >> } >> #endif >> @@ -70,6 +71,7 @@ static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, >> static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pudp, >> unsigned long addr) >> { >> + pgtable_page_dtor(virt_to_page(pudp)); >> tlb_remove_table(tlb, virt_to_page(pudp)); > > This would be cleaner if you assigned to a temporary struct page * variable. > With that: Sure will do. > > Acked-by: Will Deacon <will.deacon@arm.com> > > Will >
diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h index 106fdc9..de46ba0 100644 --- a/arch/arm64/include/asm/tlb.h +++ b/arch/arm64/include/asm/tlb.h @@ -62,6 +62,7 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, unsigned long addr) { + pgtable_page_dtor(virt_to_page(pmdp)); tlb_remove_table(tlb, virt_to_page(pmdp)); } #endif @@ -70,6 +71,7 @@ static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pudp, unsigned long addr) { + pgtable_page_dtor(virt_to_page(pudp)); tlb_remove_table(tlb, virt_to_page(pudp)); } #endif
TLB flush during PMD and PUD level page table page tear down currently does not call pgtable_page_dtor() like that for PTE page table pages. Now that all the page table pages which are allocated from the buddy allocator must have been initialized through pgtable_page_ctor() they must be freed back only after being called into pgtable_page_dtor() destructor. Else these pages might run into bad page state errors while getting freed into buddy allocator. Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> --- arch/arm64/include/asm/tlb.h | 2 ++ 1 file changed, 2 insertions(+)