The pte_free(), pmd_free(), __pud_free() and __p4d_free() in
asm-generic/pgalloc.h and the generic __tlb_remove_table() are basically
the same, so let's introduce pagetable_dtor_free() to deduplicate them.
In addition, the pagetable_dtor_free() in s390 does the same thing, so
let's s390 also calls
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
For the generic tlb_remove_table(), it is implemented in the following two
forms:
1) CONFIG_MMU_GATHER_TABLE_FREE is enabled
tlb_remove_table
--> generic __tlb_remove_table()
2) CONFIG_MMU_GATHER_TABLE_FREE is disabled
tlb_remove_table
--> tlb_remove_page
For case 1), the pagetable_dtor() has
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
---
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/include/as
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.
Page tables shouldn't have s
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.
Page tables shouldn't have s
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.
Page tables shouldn't have s
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() from pmd_ptlock_free(), we can unify
pagetable_p*_dtor() into one function. Let's introduce pagetable_dtor()
to do this.
La
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/as
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/tl
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| 2
From: Kevin Brodsky
Four architectures currently implement 5-level pgtables: arm64,
riscv, x86 and s390. The first three have essentially the same
implementation for p4d_alloc_one() and p4d_free(), so we've got an
opportunity to reduce duplication like at the lower levels.
Provide a generic vers
From: Kevin Brodsky
{pmd,pud,p4d}_alloc_one() is never called if the corresponding page
table level is folded, as {pmd,pud,p4d}_alloc() already does the
required check. We can therefore remove the runtime page table level
checks in {pud,p4d}_alloc_one. The PUD helper becomes equivalent to
the gen
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(-)
Changes in v5:
- cancel the move of p4d_free_tlb()'s location in [PATCH v4 06/15]
(Alexander Gordeev)
- fix the missing pagetable_dtor() in [PATCH v4 08/15] (Kevin Brodsky)
- change the subject and description in [PATCH v4 12/15]
(Alexander Gordeev)
- remove the redundant __HAVE_ARCH_TLB_
Similar to syscall_set_arguments() that complements
syscall_get_arguments(), introduce syscall_set_nr()
that complements syscall_get_nr().
syscall_set_nr() is going to be needed along with
syscall_set_arguments() on all HAVE_ARCH_TRACEHOOK
architectures to implement PTRACE_SET_SYSCALL_INFO API.
S
PTRACE_SET_SYSCALL_INFO is a generic ptrace API that complements
PTRACE_GET_SYSCALL_INFO by letting the ptracer modify details of
system calls the tracee is blocked in.
This API allows ptracers to obtain and modify system call details
in a straightforward and architecture-agnostic way.
Current im
syscall_set_arguments() is going to be needed to implement
PTRACE_SET_SYSCALL_INFO API.
This is a partial revert: on a few architectures syscall_set_arguments()
implementations were buggy, so instead of adding them here and applying
fixes on top, cleaner implementations are coming in follow-up com
Hello,
On Wed, 4 Dec 2024 08:48:27 +0100 Benjamin Berg
wrote:
> From: Benjamin Berg
>
> It was reported that qemu may not enable the XSTATE CPU extension, which
> is a requirement after commit 3f17fed21491 ("um: switch to regset API
> and depend on XSTATE"). Add a fallback to use FXSAVE (FP r
On Sun, Dec 22, 2024 at 07:15:37PM +0800, Guo Weikang wrote:
Hi Guo,
> Before SLUB initialization, various subsystems used memblock_alloc to
> allocate memory. In most cases, when memory allocation fails, an immediate
> panic is required. To simplify this behavior and reduce repetitive checks,
>
On Mon, Dec 30, 2024 at 05:07:50PM +0800, Qi Zheng wrote:
> The pte_free(), pmd_free(), __pud_free() and __p4d_free() in
> asm-generic/pgalloc.h and the generic __tlb_remove_table() are basically
> the same, so let's introduce pagetable_dtor_free() to deduplicate them.
>
> In addition, the pagetab
On Mon, Dec 30, 2024 at 05:07:48PM +0800, Qi Zheng wrote:
> 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
On 07/01/2025 13:31, Qi Zheng wrote:
> 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()
>>>
>>>
From: Benjamin Berg
The stack needs to be properly aligned so 16 byte memory accesses on the
stack are correct. This was broken when introducing the dynamic math
register sizing as the rounding was not moved appropriately.
Fixes: 3f17fed21491 ("um: switch to regset API and depend on XSTATE")
Sig
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 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 @@
> #ifndef _SPARC_TLB_H
> #define _SPA
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
fol
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
> following two
> forms:
>
>
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
P
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
>> Peter suggested on v3 [2].
>
> Si
On 06/01/2025 14:23, Qi Zheng wrote:
> 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_f
On 06/01/2025 09:38, Qi Zheng wrote:
> For this series:
>
> Acked-by: Qi Zheng
Thank you for the review, appreciated!
- Kevin
33 matches
Mail list logo