From: Qi Zheng <zhengqi.arch@bytedance.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: tglx@linutronix.de, david@redhat.com, jannh@google.com,
hughd@google.com, yuzhao@google.com, willy@infradead.org,
muchun.song@linux.dev, vbabka@kernel.org,
lorenzo.stoakes@oracle.com, akpm@linux-foundation.org,
rientjes@google.com, vishal.moola@gmail.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 14/15] mm: pgtable: remove tlb_remove_ptdesc()
Date: Thu, 19 Dec 2024 10:16:22 +0800 [thread overview]
Message-ID: <3f9a5475-930d-4f45-8fc8-8d2e8a6a08cc@bytedance.com> (raw)
In-Reply-To: <20241218164520.GK2354@noisy.programming.kicks-ass.net>
On 2024/12/19 00:45, Peter Zijlstra wrote:
> On Wed, Dec 18, 2024 at 09:04:50PM +0800, Qi Zheng wrote:
>> diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h
>> index 7052780740349..fba11949dd2ea 100644
>> --- a/arch/s390/include/asm/tlb.h
>> +++ b/arch/s390/include/asm/tlb.h
>> @@ -86,7 +86,7 @@ static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,
>> tlb->cleared_pmds = 1;
>> if (mm_alloc_pgste(tlb->mm))
>> gmap_unlink(tlb->mm, (unsigned long *)pte, address);
>> - tlb_remove_ptdesc(tlb, pte);
>> + tlb_remove_table(tlb, pte);
>> }
>>
>> /*
>> @@ -105,7 +105,7 @@ static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd,
>> tlb->mm->context.flush_mm = 1;
>> tlb->freed_tables = 1;
>> tlb->cleared_puds = 1;
>> - tlb_remove_ptdesc(tlb, pmd);
>> + tlb_remove_table(tlb, pmd);
>> }
>>
>> /*
>> @@ -123,7 +123,7 @@ static inline void pud_free_tlb(struct mmu_gather *tlb, pud_t *pud,
>> tlb->mm->context.flush_mm = 1;
>> tlb->freed_tables = 1;
>> tlb->cleared_p4ds = 1;
>> - tlb_remove_ptdesc(tlb, pud);
>> + tlb_remove_table(tlb, pud);
>> }
>>
>> /*
>> @@ -141,7 +141,7 @@ static inline void p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d,
>> __tlb_adjust_range(tlb, address, PAGE_SIZE);
>> tlb->mm->context.flush_mm = 1;
>> tlb->freed_tables = 1;
>> - tlb_remove_ptdesc(tlb, p4d);
>> + tlb_remove_table(tlb, p4d);
>> }
>>
>> #endif /* _S390_TLB_H */
>
> AFAICT these are all virtual addresses (still)
Oops, I forgot to fix [PATCH v2 11/15]. It should be fixed like below:
diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h
index 7052780740349..da4a7d175f69c 100644
--- a/arch/s390/include/asm/tlb.h
+++ b/arch/s390/include/asm/tlb.h
@@ -86,7 +86,7 @@ static inline void pte_free_tlb(struct mmu_gather
*tlb, pgtable_t pte,
tlb->cleared_pmds = 1;
if (mm_alloc_pgste(tlb->mm))
gmap_unlink(tlb->mm, (unsigned long *)pte, address);
- tlb_remove_ptdesc(tlb, pte);
+ tlb_remove_ptdesc(tlb, virt_to_ptdesc(pte));
}
/*
@@ -105,7 +105,7 @@ static inline void pmd_free_tlb(struct mmu_gather
*tlb, pmd_t *pmd,
tlb->mm->context.flush_mm = 1;
tlb->freed_tables = 1;
tlb->cleared_puds = 1;
- tlb_remove_ptdesc(tlb, pmd);
+ tlb_remove_ptdesc(tlb, virt_to_ptdesc(pmd));
}
/*
@@ -123,7 +123,7 @@ static inline void pud_free_tlb(struct mmu_gather
*tlb, pud_t *pud,
tlb->mm->context.flush_mm = 1;
tlb->freed_tables = 1;
tlb->cleared_p4ds = 1;
- tlb_remove_ptdesc(tlb, pud);
+ tlb_remove_ptdesc(tlb, virt_to_ptdesc(pud));
}
/*
@@ -141,7 +141,7 @@ static inline void p4d_free_tlb(struct mmu_gather
*tlb, p4d_t *p4d,
__tlb_adjust_range(tlb, address, PAGE_SIZE);
tlb->mm->context.flush_mm = 1;
tlb->freed_tables = 1;
- tlb_remove_ptdesc(tlb, p4d);
+ tlb_remove_ptdesc(tlb, virt_to_ptdesc(p4d));
}
#endif /* _S390_TLB_H */
Then in [PATCH v2 14/15], just convert virt_to_ptdesc() to virt_to_page().
Will fix it in v3.
Thanks!
>
>
>> diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
>> index 8d6cfe5058543..583e95568f52b 100644
>> --- a/include/asm-generic/tlb.h
>> +++ b/include/asm-generic/tlb.h
>> @@ -211,7 +211,7 @@ struct mmu_table_batch {
>> #ifndef __HAVE_ARCH_TLB_REMOVE_TABLE
>> static inline void __tlb_remove_table(void *table)
>> {
>> - struct ptdesc *ptdesc = (struct ptdesc *)table;
>> + struct ptdesc *ptdesc = page_ptdesc((struct page *)table);
>
> And here you're assuming they're page pointers.
>
>> pagetable_dtor(ptdesc);
>> pagetable_free(ptdesc);
next prev parent reply other threads:[~2024-12-19 2:16 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-18 13:04 [PATCH v2 00/15] move pagetable_*_dtor() to __tlb_remove_table() Qi Zheng
2024-12-18 13:04 ` [PATCH v2 01/15] Revert "mm: pgtable: make ptlock be freed by RCU" Qi Zheng
2024-12-18 13:04 ` [PATCH v2 02/15] mm: pgtable: introduce generic p4d_alloc_one() and p4d_free() Qi Zheng
2024-12-18 14:53 ` [PATCH v2 02/15 fix] fix: " Qi Zheng
2024-12-19 16:32 ` [PATCH v2 02/15] " Alexander Gordeev
2024-12-20 3:19 ` Qi Zheng
2024-12-18 13:04 ` [PATCH v2 03/15] arm64: pgtable: use mmu gather to free p4d level page table Qi Zheng
2024-12-18 13:04 ` [PATCH v2 04/15] s390: pgtable: add statistics for PUD and P4D " Qi Zheng
2024-12-18 13:04 ` [PATCH v2 05/15] mm: pgtable: introduce pagetable_dtor() Qi Zheng
2024-12-18 13:04 ` [PATCH v2 06/15] arm: pgtable: move pagetable_dtor() to __tlb_remove_table() Qi Zheng
2024-12-18 13:04 ` [PATCH v2 07/15] arm64: " Qi Zheng
2024-12-18 13:04 ` [PATCH v2 08/15] riscv: " Qi Zheng
2024-12-18 13:04 ` [PATCH v2 09/15] x86: " Qi Zheng
2024-12-18 13:04 ` [PATCH v2 10/15] s390: pgtable: also move pagetable_dtor() of PxD " Qi Zheng
2024-12-20 8:42 ` Alexander Gordeev
2024-12-20 8:55 ` Qi Zheng
2024-12-18 13:04 ` [PATCH v2 11/15] mm: pgtable: introduce generic __tlb_remove_table() Qi Zheng
2024-12-18 16:39 ` Peter Zijlstra
2024-12-20 11:18 ` Alexander Gordeev
2024-12-20 11:28 ` Qi Zheng
2024-12-18 13:04 ` [PATCH v2 12/15] mm: pgtable: move __tlb_remove_table_one() in x86 to generic file Qi Zheng
2024-12-18 13:04 ` [PATCH v2 13/15] mm: pgtable: remove tlb_remove_page_ptdesc() Qi Zheng
2024-12-18 13:04 ` [PATCH v2 14/15] mm: pgtable: remove tlb_remove_ptdesc() Qi Zheng
2024-12-18 16:45 ` Peter Zijlstra
2024-12-19 2:16 ` Qi Zheng [this message]
2024-12-18 13:04 ` [PATCH v2 15/15] mm: pgtable: introduce generic pagetable_dtor_free() Qi Zheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3f9a5475-930d-4f45-8fc8-8d2e8a6a08cc@bytedance.com \
--to=zhengqi.arch@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=hughd@google.com \
--cc=jannh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=muchun.song@linux.dev \
--cc=peterz@infradead.org \
--cc=rientjes@google.com \
--cc=tglx@linutronix.de \
--cc=vbabka@kernel.org \
--cc=vishal.moola@gmail.com \
--cc=willy@infradead.org \
--cc=yuzhao@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox