Hi Will,
On 2025/1/14 00:26, Will Deacon wrote:
On Wed, Jan 08, 2025 at 02:57:21PM +0800, Qi Zheng wrote:
Like other levels of page tables, also use mmu gather mechanism to free
p4d level page table.
Signed-off-by: Qi Zheng
Originally-by: Peter Zijlstra (Intel)
Reviewed-by: Kevin Brodsky
s390 also calls generic pagetable_dtor_free().
Signed-off-by: Qi Zheng
Suggested-by: Peter Zijlstra (Intel)
Reviewed-by: Kevin Brodsky
Acked-by: Alexander Gordeev # s390
---
arch/s390/mm/pgalloc.c| 6 --
include/asm-generic/pgalloc.h | 12
include/asm-generic/tlb.
The __tlb_remove_table_one() in x86 does not contain architecture-specific
content, so move it to the generic file.
Signed-off-by: Qi Zheng
Reviewed-by: Kevin Brodsky
---
arch/x86/include/asm/tlb.h | 19 ---
mm/mmu_gather.c| 20 ++--
2 files changed
more easily.
Signed-off-by: Qi Zheng
Suggested-by: Kevin Brodsky
Reviewed-by: Kevin Brodsky
---
arch/arm/include/asm/tlb.h | 4
include/asm-generic/tlb.h | 10 --
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/arch/arm/include/asm/tlb.h b/arch/arm/include/asm/
Several architectures (arm, arm64, riscv and x86) define exactly the
same __tlb_remove_table(), just introduce generic __tlb_remove_table() to
eliminate these duplications.
The s390 __tlb_remove_table() is nearly the same, so also make s390
__tlb_remove_table() version generic.
Signed-off-by: Qi
Call pagetable_dtor() for PMD|PUD|P4D tables just before ptdesc is
freed - same as it is done for PTE tables. That allows consolidating
TLB free paths for all table types.
Signed-off-by: Qi Zheng
Suggested-by: Peter Zijlstra (Intel)
Reviewed-by: Kevin Brodsky
Cc: linux-s...@vger.kernel.org
Move pagetable_dtor() to __tlb_remove_table(), so that ptlock and page
table pages can be freed together (regardless of whether RCU is used).
This prevents the use-after-free problem where the ptlock is freed
immediately but the page table pages is freed later via RCU.
Signed-off-by: Qi Zheng
Convert __tlb_remove_table() to use struct ptdesc, which will help to move
pagetable_dtor() to __tlb_remove_table().
And page tables shouldn't have swap cache, so use pagetable_free() instead
of free_page_and_swap_cache() to free page table pages.
Signed-off-by: Qi Zheng
---
arch/x86/in
have swap cache, so use pagetable_free() instead of
free_page_and_swap_cache() to free page table pages.
By the way, move the comment above __tlb_remove_table() to
riscv_tlb_remove_ptdesc(), it will be more appropriate.
Signed-off-by: Qi Zheng
Suggested-by: Peter Zijlstra (Intel)
Reviewed-by:
have swap cache, so use pagetable_free() instead of
free_page_and_swap_cache() to free page table pages.
Signed-off-by: Qi Zheng
Suggested-by: Peter Zijlstra (Intel)
Reviewed-by: Kevin Brodsky
Cc: linux-arm-ker...@lists.infradead.org
---
arch/arm64/include/asm/tlb.h | 10 --
1 file ch
have swap cache, so use pagetable_free() instead of
free_page_and_swap_cache() to free page table pages.
Signed-off-by: Qi Zheng
Suggested-by: Peter Zijlstra (Intel)
Reviewed-by: Kevin Brodsky
Cc: linux-arm-ker...@lists.infradead.org
---
arch/arm/include/asm/tlb.h | 9 ++---
1 file chang
d-off-by: Qi Zheng
Originally-by: Peter Zijlstra (Intel)
Reviewed-by: Kevin Brodsky
---
Documentation/mm/split_page_table_lock.rst | 4 +-
arch/arm/include/asm/tlb.h | 4 +-
arch/arm64/include/asm/tlb.h | 8 ++--
arch/csky/include/asm/pgalloc.h| 2
Like PMD and PTE level page table, also add statistics for PUD and P4D
page table.
Signed-off-by: Qi Zheng
Suggested-by: Peter Zijlstra (Intel)
Reviewed-by: Kevin Brodsky
Cc: linux-s...@vger.kernel.org
---
arch/s390/include/asm/pgalloc.h | 29 +
arch/s390/include
Like other levels of page tables, also use mmu gather mechanism to free
p4d level page table.
Signed-off-by: Qi Zheng
Originally-by: Peter Zijlstra (Intel)
Reviewed-by: Kevin Brodsky
Cc: linux-arm-ker...@lists.infradead.org
---
arch/arm64/include/asm/pgalloc.h | 1 -
arch/arm64/include/asm
Like other levels of page tables, add statistics for P4D level page table.
Signed-off-by: Qi Zheng
Originally-by: Peter Zijlstra (Intel)
Reviewed-by: Kevin Brodsky
---
arch/riscv/include/asm/pgalloc.h | 6 +-
arch/x86/mm/pgtable.c| 3 +++
include/asm-generic/pgalloc.h
orted architectures, so we might as well include this check
in the generic implementation. No runtime check is required in
p4d_alloc_one() as the top-level p4d_alloc() already does the
required check.
Signed-off-by: Kevin Brodsky
Acked-by: Dave Hansen
Signed-off-by: Qi Zheng
---
arch/arm64/includ
generic version, so we remove it altogether.
This is consistent with the way arm64 and x86 handle this situation
(runtime check in p4d_free() only).
Signed-off-by: Kevin Brodsky
Signed-off-by: Qi Zheng
Acked-by: Dave Hansen
Reviewed-by: Alexandre Ghiti
---
arch/riscv/include/asm/pgalloc.h | 22
This reverts commit 2f3443770437e49abc39af26962d293851cbab6d.
Signed-off-by: Qi Zheng
Reviewed-by: Kevin Brodsky
---
include/linux/mm.h | 2 +-
include/linux/mm_types.h | 9 +
mm/memory.c | 22 ++
3 files changed, 8 insertions(+), 25 deletions
.
Comments and suggestions are welcome!
Thanks,
Qi
[1].
https://lore.kernel.org/all/20241211133433.gc12...@noisy.programming.kicks-ass.net/
[2]. https://lore.kernel.org/all/67548279.050a0220.a30f1.015b@google.com/
Kevin Brodsky (2):
riscv: mm: Skip pgtable level check in {pud,p4d}_alloc_one
asm-gen
On 2025/1/7 20:32, Andreas Larsson wrote:
On 2024-12-30 10:07, Qi Zheng wrote:
diff --git a/arch/sparc/include/asm/tlb_32.h b/arch/sparc/include/asm/tlb_32.h
index 5cd28a8793e39..910254867dfbd 100644
--- a/arch/sparc/include/asm/tlb_32.h
+++ b/arch/sparc/include/asm/tlb_32.h
@@ -2,6 +2,7
On 2025/1/7 19:58, Kevin Brodsky wrote:
On 07/01/2025 11:51, Qi Zheng wrote:
[...]
Author: Qi Zheng
Date: Fri Dec 13 17:13:48 2024 +0800
mm: pgtable: completely move pagetable_dtor() to generic
tlb_remove_table()
For the generic tlb_remove_table(), it is implemented in the
On 2025/1/7 17:57, Kevin Brodsky wrote:
On 06/01/2025 04:49, Qi Zheng wrote:
[...]
Once this is done, we should be able to replace all those confusing
calls to tlb_remove_page() on PTPs with tlb_remove_table() and remove
the explicit call to pagetable_dtor(). AIUI this is essentially what
On 2025/1/6 22:35, Alexander Gordeev wrote:
On Mon, Jan 06, 2025 at 09:34:55PM +0800, Qi Zheng wrote:
OK, will change the subject and description to:
s390: pgtable: also move pagetable_dtor() of PxD to pagetable_dtor_free()
To unify the PxD and PTE TLB free path, also move the
On 2025/1/6 21:34, Alexander Gordeev wrote:
On Mon, Jan 06, 2025 at 07:05:16PM +0800, Qi Zheng wrote:
I understand that you want to sort p.._free_tlb() routines, but please
Yes, I thought it was a minor change, so I just did it.
do not move the code around or make a separate follow-up
On 2025/1/6 20:44, Alexander Gordeev wrote:
On Mon, Jan 06, 2025 at 07:02:17PM +0800, Qi Zheng wrote:
On Mon, Dec 30, 2024 at 05:07:47PM +0800, Qi Zheng wrote:
To unify the PxD and PTE TLB free path, also move the pagetable_dtor() of
PMD|PUD|P4D to __tlb_remove_table().
The above and
On 2025/1/6 20:36, Alexander Gordeev wrote:
On Mon, Jan 06, 2025 at 06:55:58PM +0800, Qi Zheng wrote:
+static inline void pagetable_dtor(struct ptdesc *ptdesc)
+{
+ struct folio *folio = ptdesc_folio(ptdesc);
+
+ ptlock_free(ptdesc);
+ __folio_clear_pgtable(folio
On 2025/1/6 18:32, Alexander Gordeev wrote:
On Mon, Dec 30, 2024 at 05:07:41PM +0800, Qi Zheng wrote:
Like PMD and PTE level page table, also add statistics for PUD and P4D
page table.
...
diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h
index e95b2c8081eb8
On 2025/1/6 18:36, Alexander Gordeev wrote:
On Mon, Dec 30, 2024 at 05:07:47PM +0800, Qi Zheng wrote:
To unify the PxD and PTE TLB free path, also move the pagetable_dtor() of
PMD|PUD|P4D to __tlb_remove_table().
The above and Subject are still incorrect: pagetable_dtor() is
called from
On 2025/1/6 18:34, Alexander Gordeev wrote:
On Mon, Dec 30, 2024 at 05:07:42PM +0800, Qi Zheng wrote:
The pagetable_p*_dtor() are exactly the same except for the handling of
ptlock. If we make ptlock_free() handle the case where ptdesc->ptl is
NULL and remove VM_BUG_ON_PAGE() f
On 2025/1/3 19:14, Peter Zijlstra wrote:
On Sat, Dec 28, 2024 at 11:26:22AM +0200, Mike Rapoport wrote:
On Mon, Dec 23, 2024 at 05:41:01PM +0800, Qi Zheng wrote:
Here we are explicitly dealing with struct page, and the following logic
semms strange:
tlb_remove_page_ptdesc((tlb
Hi Kevin,
On 2025/1/3 21:27, Kevin Brodsky wrote:
On 03/01/2025 10:35, Qi Zheng wrote:
On 2025/1/3 17:13, Qi Zheng wrote:
On 2025/1/3 16:02, Kevin Brodsky wrote:
On 03/01/2025 04:48, Qi Zheng wrote:
[...]
In __tlb_batch_free_encoded_pages(), we can indeed detect PageTable()
and call
On 2025/1/3 17:13, Qi Zheng wrote:
On 2025/1/3 16:02, Kevin Brodsky wrote:
On 03/01/2025 04:48, Qi Zheng wrote:
Hi Kevin,
On 2025/1/3 00:53, Kevin Brodsky wrote:
On 30/12/2024 10:07, Qi Zheng wrote:
static inline void riscv_tlb_remove_ptdesc(struct mmu_gather *tlb,
void *pt
On 2025/1/3 16:02, Kevin Brodsky wrote:
On 03/01/2025 04:48, Qi Zheng wrote:
Hi Kevin,
On 2025/1/3 00:53, Kevin Brodsky wrote:
On 30/12/2024 10:07, Qi Zheng wrote:
static inline void riscv_tlb_remove_ptdesc(struct mmu_gather *tlb,
void *pt)
{
- if (riscv_use_sbi_for_rfence
On 2025/1/3 01:00, Kevin Brodsky wrote:
On 30/12/2024 10:07, Qi Zheng wrote:
Qi Zheng (13):
Revert "mm: pgtable: make ptlock be freed by RCU"
mm: pgtable: add statistics for P4D level page table
arm64: pgtable: use mmu gather to free p4d level page table
s390: pg
On 2025/1/3 00:53, Kevin Brodsky wrote:
On 30/12/2024 10:07, Qi Zheng wrote:
diff --git a/arch/riscv/include/asm/pgalloc.h b/arch/riscv/include/asm/pgalloc.h
index 551d614d3369c..3466fbe2e508d 100644
--- a/arch/riscv/include/asm/pgalloc.h
+++ b/arch/riscv/include/asm/pgalloc.h
@@ -108,8
Hi Kevin,
On 2025/1/3 00:53, Kevin Brodsky wrote:
On 30/12/2024 10:07, Qi Zheng wrote:
static inline void riscv_tlb_remove_ptdesc(struct mmu_gather *tlb, void *pt)
{
- if (riscv_use_sbi_for_rfence())
+ if (riscv_use_sbi_for_rfence()) {
tlb_remove_ptdesc(tlb, pt
have swap cache, so use pagetable_free() instead of
free_page_and_swap_cache() to free page table pages.
Signed-off-by: Qi Zheng
Suggested-by: Peter Zijlstra (Intel)
Cc: linux-arm-ker...@lists.infradead.org
---
arch/arm/include/asm/tlb.h | 9 -
1 file changed, 4 insertions(+), 5 dele
s390 also calls generic pagetable_dtor_free().
Signed-off-by: Qi Zheng
Suggested-by: Peter Zijlstra (Intel)
---
arch/s390/mm/pgalloc.c| 6 --
include/asm-generic/pgalloc.h | 12
include/asm-generic/tlb.h | 3 +--
include/linux/mm.h| 6 ++
4 files c
The __tlb_remove_table_one() in x86 does not contain architecture-specific
content, so move it to the generic file.
Signed-off-by: Qi Zheng
---
arch/x86/include/asm/tlb.h | 19 ---
mm/mmu_gather.c| 20 ++--
2 files changed, 18 insertions(+), 21
Several architectures (arm, arm64, riscv and x86) define exactly the
same __tlb_remove_table(), just introduce generic __tlb_remove_table() to
eliminate these duplications.
The s390 __tlb_remove_table() is nearly the same, so also make s390
__tlb_remove_table() version generic.
Signed-off-by: Qi
To unify the PxD and PTE TLB free path, also move the pagetable_dtor() of
PMD|PUD|P4D to __tlb_remove_table().
Signed-off-by: Qi Zheng
Suggested-by: Peter Zijlstra (Intel)
Cc: linux-s...@vger.kernel.org
---
arch/s390/include/asm/tlb.h | 3 ---
arch/s390/mm/pgalloc.c | 14
have swap cache, so use pagetable_free() instead of
free_page_and_swap_cache() to free page table pages.
Signed-off-by: Qi Zheng
Suggested-by: Peter Zijlstra (Intel)
Cc: x...@kernel.org
---
arch/x86/include/asm/tlb.h | 17 ++---
arch/x86/kernel/paravirt.c | 1 +
arch/x86/mm/pgta
have swap cache, so use pagetable_free() instead of
free_page_and_swap_cache() to free page table pages.
By the way, move the comment above __tlb_remove_table() to
riscv_tlb_remove_ptdesc(), it will be more appropriate.
Signed-off-by: Qi Zheng
Suggested-by: Peter Zijlstra (Intel)
Cc: lin
have swap cache, so use pagetable_free() instead of
free_page_and_swap_cache() to free page table pages.
Signed-off-by: Qi Zheng
Suggested-by: Peter Zijlstra (Intel)
Cc: linux-arm-ker...@lists.infradead.org
---
arch/arm64/include/asm/tlb.h | 10 --
1 file changed, 4 insertions(+), 6 dele
d-off-by: Qi Zheng
Originally-by: Peter Zijlstra (Intel)
---
Documentation/mm/split_page_table_lock.rst | 4 +-
arch/arm/include/asm/tlb.h | 4 +-
arch/arm64/include/asm/tlb.h | 8 ++--
arch/csky/include/asm/pgalloc.h| 2 +-
arch/hexagon/include/asm/p
Like PMD and PTE level page table, also add statistics for PUD and P4D
page table.
Signed-off-by: Qi Zheng
Suggested-by: Peter Zijlstra (Intel)
Cc: linux-s...@vger.kernel.org
---
arch/s390/include/asm/pgalloc.h | 29 +++---
arch/s390/include/asm/tlb.h | 37
Like other levels of page tables, add statistics for P4D level page table.
Signed-off-by: Qi Zheng
Originally-by: Peter Zijlstra (Intel)
---
arch/riscv/include/asm/pgalloc.h | 6 +-
arch/x86/mm/pgtable.c| 3 +++
include/asm-generic/pgalloc.h| 2 ++
include/linux/mm.h
Like other levels of page tables, also use mmu gather mechanism to free
p4d level page table.
Signed-off-by: Qi Zheng
Originally-by: Peter Zijlstra (Intel)
Cc: linux-arm-ker...@lists.infradead.org
---
arch/arm64/include/asm/pgalloc.h | 1 -
arch/arm64/include/asm/tlb.h | 14
orted architectures, so we might as well include this check
in the generic implementation. No runtime check is required in
p4d_alloc_one() as the top-level p4d_alloc() already does the
required check.
Signed-off-by: Kevin Brodsky
Acked-by: Dave Hansen
Signed-off-by: Qi Zheng
---
arch/arm64/includ
This reverts commit 2f3443770437e49abc39af26962d293851cbab6d.
Signed-off-by: Qi Zheng
---
include/linux/mm.h | 2 +-
include/linux/mm_types.h | 9 +
mm/memory.c | 22 ++
3 files changed, 8 insertions(+), 25 deletions(-)
diff --git a/include
generic version, so we remove it altogether.
This is consistent with the way arm64 and x86 handle this situation
(runtime check in p4d_free() only).
Signed-off-by: Kevin Brodsky
Acked-by: Dave Hansen
Signed-off-by: Qi Zheng
Acked-by: Palmer Dabbelt
---
arch/riscv/include/asm/pgalloc.h | 22
loc: Provide generic p4d_{alloc_one,free}
Qi Zheng (13):
Revert "mm: pgtable: make ptlock be freed by RCU"
mm: pgtable: add statistics for P4D level page table
arm64: pgtable: use mmu gather to free p4d level page table
s390: pgtable: add statistics for PUD and P4D level page tab
Hi Andrew,
On 2024/12/30 12:55, Andrew Morton wrote:
On Mon, 30 Dec 2024 11:12:00 +0800 Qi Zheng wrote:
For now struct ptdesc overlaps struct page, but the goal is to have them
separate and always operate on struct ptdesc when working with page tables.
OK, so tlb_remove_page_ptdesc() and
Hi Mike,
On 2024/12/28 17:26, Mike Rapoport wrote:
On Mon, Dec 23, 2024 at 05:41:01PM +0800, Qi Zheng wrote:
Here we are explicitly dealing with struct page, and the following logic
semms strange:
tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte)));
tlb_remove_page_ptdesc
--> tlb_remove_p
: Kevin Brodsky
Acked-by: Dave Hansen
Signed-off-by: Qi Zheng
---
arch/riscv/include/asm/pgalloc.h | 22 --
1 file changed, 4 insertions(+), 18 deletions(-)
diff --git a/arch/riscv/include/asm/pgalloc.h
b/arch/riscv/include/asm/pgalloc.h
index f52264304f772..8ad0bbe838a24
x27;s s390 also calls generic pagetable_dtor_free().
Signed-off-by: Qi Zheng
Suggested-by: Peter Zijlstra (Intel)
---
arch/s390/mm/pgalloc.c| 18 ++
include/asm-generic/pgalloc.h | 23 ---
include/asm-generic/tlb.h | 5 +
include/
Just like removing tlb_remove_page_ptdesc(), remove tlb_remove_ptdesc() as
well, and make callers call tlb_remove_table() directly.
Signed-off-by: Qi Zheng
Originally-by: Peter Zijlstra (Intel)
---
arch/arm/include/asm/tlb.h | 8 ++--
arch/arm64/include/asm/tlb.h | 16
tly.
Signed-off-by: Qi Zheng
Originally-by: Peter Zijlstra (Intel)
---
arch/csky/include/asm/pgalloc.h | 2 +-
arch/hexagon/include/asm/pgalloc.h | 2 +-
arch/loongarch/include/asm/pgalloc.h | 2 +-
arch/m68k/include/asm/sun3_pgalloc.h | 2 +-
arch/mips/include/asm/pgalloc.h | 2 +-
arch/ni
The __tlb_remove_table_one() in x86 does not contain architecture-specific
content, so move it to the generic file.
Signed-off-by: Qi Zheng
---
arch/x86/include/asm/tlb.h | 19 ---
mm/mmu_gather.c| 20 ++--
2 files changed, 18 insertions(+), 21
Several architectures (arm, arm64, riscv and x86) define exactly the
same __tlb_remove_table(), just introduce generic __tlb_remove_table() to
eliminate these duplications.
The s390 __tlb_remove_table() is nearly the same, so also make s390
__tlb_remove_table() version generic.
Signed-off-by: Qi
To unify the PxD and PTE TLB free path, also move the pagetable_dtor() of
PMD|PUD|P4D to __tlb_remove_table().
Signed-off-by: Qi Zheng
Suggested-by: Peter Zijlstra (Intel)
Cc: linux-s...@vger.kernel.org
---
arch/s390/include/asm/tlb.h | 3 ---
arch/s390/mm/pgalloc.c | 14
have swap cache, so use pagetable_free() instead of
free_page_and_swap_cache() to free page table pages.
Signed-off-by: Qi Zheng
Suggested-by: Peter Zijlstra (Intel)
Cc: x...@kernel.org
---
arch/x86/include/asm/tlb.h | 17 ++---
arch/x86/kernel/paravirt.c | 1 +
arch/x86/mm/pgta
have swap cache, so use pagetable_free() instead of
free_page_and_swap_cache() to free page table pages.
By the way, move the comment above __tlb_remove_table() to
riscv_tlb_remove_ptdesc(), it will be more appropriate.
Signed-off-by: Qi Zheng
Suggested-by: Peter Zijlstra (Intel)
Cc: lin
have swap cache, so use pagetable_free() instead of
free_page_and_swap_cache() to free page table pages.
Signed-off-by: Qi Zheng
Suggested-by: Peter Zijlstra (Intel)
Cc: linux-arm-ker...@lists.infradead.org
---
arch/arm64/include/asm/tlb.h | 10 --
1 file changed, 4 insertions(+), 6 dele
have swap cache, so use pagetable_free() instead of
free_page_and_swap_cache() to free page table pages.
Signed-off-by: Qi Zheng
Suggested-by: Peter Zijlstra (Intel)
Cc: linux-arm-ker...@lists.infradead.org
---
arch/arm/include/asm/tlb.h | 9 -
1 file changed, 4 insertions(+), 5 dele
d-off-by: Qi Zheng
Originally-by: Peter Zijlstra (Intel)
---
Documentation/mm/split_page_table_lock.rst | 4 +-
arch/arm/include/asm/tlb.h | 4 +-
arch/arm64/include/asm/tlb.h | 8 ++--
arch/csky/include/asm/pgalloc.h| 2 +-
arch/hexagon/include/asm/p
Like PMD and PTE level page table, also add statistics for PUD and P4D
page table.
Signed-off-by: Qi Zheng
Suggested-by: Peter Zijlstra (Intel)
Cc: linux-s...@vger.kernel.org
---
arch/s390/include/asm/pgalloc.h | 29 +++---
arch/s390/include/asm/tlb.h | 37
Like other levels of page tables, also use mmu gather mechanism to free
p4d level page table.
Signed-off-by: Qi Zheng
Originally-by: Peter Zijlstra (Intel)
Cc: linux-arm-ker...@lists.infradead.org
---
arch/arm64/include/asm/pgalloc.h | 1 -
arch/arm64/include/asm/tlb.h | 14
Like other levels of page tables, add statistics for P4D level page table.
Signed-off-by: Qi Zheng
Originally-by: Peter Zijlstra (Intel)
---
arch/riscv/include/asm/pgalloc.h | 6 +-
arch/x86/mm/pgtable.c| 3 +++
include/asm-generic/pgalloc.h| 2 ++
include/linux/mm.h
orted architectures, so we might as well include this check
in the generic implementation. No runtime check is required in
p4d_alloc_one() as the top-level p4d_alloc() already does the
required check.
Signed-off-by: Kevin Brodsky
Acked-by: Dave Hansen
Signed-off-by: Qi Zheng
---
arch/arm64/includ
generic version, so we remove it altogether.
This is consistent with the way arm64 and x86 handle this situation
(runtime check in p4d_free() only).
Signed-off-by: Kevin Brodsky
Acked-by: Dave Hansen
Signed-off-by: Qi Zheng
---
arch/riscv/include/asm/pgalloc.h | 22 --
1 file
This reverts commit 2f3443770437e49abc39af26962d293851cbab6d.
Signed-off-by: Qi Zheng
---
include/linux/mm.h | 2 +-
include/linux/mm_types.h | 9 +
mm/memory.c | 22 ++
3 files changed, 8 insertions(+), 25 deletions(-)
diff --git a/include
lloc_one
asm-generic: pgalloc: Provide generic p4d_{alloc_one,free}
Qi Zheng (15):
Revert "mm: pgtable: make ptlock be freed by RCU"
mm: pgtable: add statistics for P4D level page table
arm64: pgtable: use mmu gather to free p4d level page table
s390: pgtable: add statist
Now no users are using the pte_offset_map_nolock(), remove it.
Signed-off-by: Qi Zheng
Reviewed-by: Muchun Song
Acked-by: David Hildenbrand
---
Documentation/mm/split_page_table_lock.rst | 3 ---
include/linux/mm.h | 2 --
mm/pgtable-generic.c
: Qi Zheng
Reviewed-by: Muchun Song
Acked-by: David Hildenbrand
---
mm/vmscan.c | 9 -
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 749cdc110c745..bdca94e663bc5 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3375,8 +3375,10 @@ static bool
In move_pages_pte(), we may modify the dst_pte and src_pte after acquiring
the ptl, so convert it to using pte_offset_map_rw_nolock(). But since we
will use pte_same() to detect the change of the pte entry, there is no
need to get pmdval, so just pass a dummy variable to it.
Signed-off-by: Qi
y of
pvmw->pmd.
Signed-off-by: Qi Zheng
---
mm/page_vma_mapped.c | 24 ++--
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/mm/page_vma_mapped.c b/mm/page_vma_mapped.c
index ae5cc42aa2087..ab1671e71cb2d 100644
--- a/mm/page_vma_mapped.c
+++ b/mm/page_vma_mappe
we already hold the exclusive mmap_lock, so this new_pte page is
stable, so there is no need to get pmdval and do pmd_same() check.
Signed-off-by: Qi Zheng
Reviewed-by: Muchun Song
---
mm/mremap.c | 11 ++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/mm/mremap.c b
ble, there is no need to get pmdval and do pmd_same() check.
Signed-off-by: Qi Zheng
Reviewed-by: Muchun Song
---
mm/memory.c | 11 ++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/mm/memory.c b/mm/memory.c
index 6432b636d1ba7..c19cf14e1c565 100644
--- a/mm/memory.c
+++ b
: Qi Zheng
---
mm/khugepaged.c | 18 +-
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 6498721d4783a..854577f39957d 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -1605,7 +1605,7 @@ int collapse_pte_mapped_thp(struct
In handle_pte_fault(), we may modify the vmf->pte after acquiring the
vmf->ptl, so convert it to using pte_offset_map_rw_nolock(). But since we
will do the pte_same() check, so there is no need to get pmdval to do
pmd_same() check, just pass a dummy variable to it.
Signed-off-by: Qi Zheng
of update_mmu_cache_range() hold the vmf->ptl, so we can
determined whether split PTE locks is being used by doing the following,
just as we do elsewhere in the kernel.
ptl != vmf->ptl
And then we can delete the do_pte_lock() and do_pte_unlock().
Signed-off-by: Qi Zheng
Acked-by:
In __collapse_huge_page_swapin(), we just use the ptl for pte_same() check
in do_swap_page(). In other places, we directly use pte_offset_map_lock(),
so convert it to using pte_offset_map_ro_nolock().
Signed-off-by: Qi Zheng
Acked-by: David Hildenbrand
Reviewed-by: Muchun Song
---
mm
In filemap_fault_recheck_pte_none(), we just do pte_none() check, so
convert it to using pte_offset_map_ro_nolock().
Signed-off-by: Qi Zheng
Acked-by: David Hildenbrand
Reviewed-by: Muchun Song
---
mm/filemap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm
In assert_pte_locked(), we just get the ptl and assert if it was already
held, so convert it to using pte_offset_map_ro_nolock().
Signed-off-by: Qi Zheng
Acked-by: David Hildenbrand
Reviewed-by: Muchun Song
---
arch/powerpc/mm/pgtable.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion
presses the intended semantics, not that the *kmap*
will be read-only/read-write protected.
Subsequent commits will convert pte_offset_map_nolock() into the above
two functions one by one, and finally completely delete it.
Signed-off-by: Qi Zheng
Reviewed-by: Muchun Song
Acked-by: David Hildenbrand
-
series will convert all pte_offset_map_nolock() into the above two helper
functions one by one, and finally completely delete it.
This also a preparation for reclaiming the empty user PTE page table pages.
This series is based on the next-20240926.
Comments and suggestions are welcome!
Thanks,
On 2024/9/24 16:52, Muchun Song wrote:
On Sep 24, 2024, at 15:29, Qi Zheng wrote:
On 2024/9/24 15:14, Muchun Song wrote:
On Sep 24, 2024, at 14:11, Qi Zheng wrote:
In collapse_pte_mapped_thp(), we may modify the pte and pmd entry after
acquring the ptl, so convert it to using
On 2024/9/24 16:39, Muchun Song wrote:
On Sep 24, 2024, at 16:33, Qi Zheng wrote:
On 2024/9/24 16:25, Muchun Song wrote:
On Sep 24, 2024, at 14:11, Qi Zheng wrote:
In the caller of map_pte(), we may modify the pvmw->pte after acquiring
the pvmw->ptl, so convert it to
On 2024/9/24 16:25, Muchun Song wrote:
On Sep 24, 2024, at 14:11, Qi Zheng wrote:
In the caller of map_pte(), we may modify the pvmw->pte after acquiring
the pvmw->ptl, so convert it to using pte_offset_map_rw_nolock(). At
this time, the pte_same() check is not performed after th
On 2024/9/24 15:14, Muchun Song wrote:
On Sep 24, 2024, at 14:11, Qi Zheng wrote:
In collapse_pte_mapped_thp(), we may modify the pte and pmd entry after
acquring the ptl, so convert it to using pte_offset_map_rw_nolock(). At
this time, the pte_same() check is not performed after the PTL
Now no users are using the pte_offset_map_nolock(), remove it.
Signed-off-by: Qi Zheng
Reviewed-by: Muchun Song
---
Documentation/mm/split_page_table_lock.rst | 3 ---
include/linux/mm.h | 2 --
mm/pgtable-generic.c | 21 -
3
: Qi Zheng
Reviewed-by: Muchun Song
---
mm/vmscan.c | 9 -
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 749cdc110c745..bdca94e663bc5 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3375,8 +3375,10 @@ static bool walk_pte_range(pmd_t *pmd
In move_pages_pte(), we may modify the dst_pte and src_pte after acquiring
the ptl, so convert it to using pte_offset_map_rw_nolock(). But since we
will use pte_same() to detect the change of the pte entry, there is no
need to get pmdval, so just pass a dummy variable to it.
Signed-off-by: Qi
y of
pvmw->pmd.
Signed-off-by: Qi Zheng
---
mm/page_vma_mapped.c | 25 -
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/mm/page_vma_mapped.c b/mm/page_vma_mapped.c
index ae5cc42aa2087..6410f29b37c1b 100644
--- a/mm/page_vma_mapped.c
+++ b/mm/page_vma_mappe
we already hold the exclusive mmap_lock, so this new_pte page is
stable, so there is no need to get pmdval and do pmd_same() check.
Signed-off-by: Qi Zheng
---
mm/mremap.c | 11 ++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/mm/mremap.c b/mm/mremap.c
index 24712f8dbb
ble, there is no need to get pmdval and do pmd_same() check.
Signed-off-by: Qi Zheng
---
mm/memory.c | 11 ++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/mm/memory.c b/mm/memory.c
index 6432b636d1ba7..c19cf14e1c565 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1086,6 +108
: Qi Zheng
---
mm/khugepaged.c | 14 +++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 6498721d4783a..8ab79c13d077f 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -1605,7 +1605,7 @@ int collapse_pte_mapped_thp(struct
In handle_pte_fault(), we may modify the vmf->pte after acquiring the
vmf->ptl, so convert it to using pte_offset_map_rw_nolock(). But since we
will do the pte_same() check, so there is no need to get pmdval to do
pmd_same() check, just pass a dummy variable to it.
Signed-off-by: Qi Zheng
of update_mmu_cache_range() hold the vmf->ptl, so we can
determined whether split PTE locks is being used by doing the following,
just as we do elsewhere in the kernel.
ptl != vmf->ptl
And then we can delete the do_pte_lock() and do_pte_unlock().
Signed-off-by: Qi Zheng
Acked-by:
1 - 100 of 173 matches
Mail list logo