Re: [PATCH v2 0/6] Account page tables at all levels

2025-01-07 Thread Kevin Brodsky
On 06/01/2025 09:38, Qi Zheng wrote: > For this series: > > Acked-by: Qi Zheng Thank you for the review, appreciated! - Kevin ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-ar

[PATCH v2 6/6] mm: Introduce ctor/dtor at PGD level

2025-01-03 Thread Kevin Brodsky
page table pages. This patch should cover all architectures and all configurations where PGDs are one or more regular pages. This excludes any configuration where PGDs are allocated from a kmem_cache object. Acked-by: Dave Hansen Signed-off-by: Kevin Brodsky --- arch/m68k/include/asm/mcf_pgalloc.

[PATCH v2 5/6] asm-generic: pgalloc: Provide generic __pgd_{alloc,free}

2025-01-03 Thread Kevin Brodsky
s by using GFP_PGTABLE_{USER,KERNEL} as appropriate. Not all PGD allocations can be handled by the generic helpers. In particular, multiple architectures allocate PGDs from a kmem_cache, and those PGDs may not be page-sized. Acked-by: Dave Hansen Signed-off-by: Kevin Brodsky --- arch/alpha

[PATCH v2 4/6] ARM: mm: Rename PGD helpers

2025-01-03 Thread Kevin Brodsky
ansen Signed-off-by: Kevin Brodsky --- arch/arm/mm/pgd.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/arm/mm/pgd.c b/arch/arm/mm/pgd.c index f8e9bc58a84f..2a1077747758 100644 --- a/arch/arm/mm/pgd.c +++ b/arch/arm/mm/pgd.c @@ -17,11 +17,11 @@ #include

[PATCH v2 3/6] m68k: mm: Add calls to pagetable_pmd_[cd]tor

2025-01-03 Thread Kevin Brodsky
ating ptable_list for PMD/PGD levels. Acked-by: Dave Hansen Signed-off-by: Kevin Brodsky --- arch/m68k/include/asm/motorola_pgalloc.h | 6 +++--- arch/m68k/mm/motorola.c | 17 - 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/arch/m68k/includ

[PATCH v2 2/6] parisc: mm: Ensure pagetable_pmd_[cd]tor are called

2025-01-03 Thread Kevin Brodsky
) can handle higher allocation orders so we don't need to define our own. These changes ensure that pagetable_pmd_[cd]tor are called, improving the accounting of page table pages. Acked-by: Dave Hansen Signed-off-by: Kevin Brodsky --- arch/parisc/include/asm/pgalloc.h | 23

[PATCH v2 1/6] mm: Move common part of pagetable_*_ctor to helper

2025-01-03 Thread Kevin Brodsky
pagetable_*_ctor all have the same basic implementation. Move the common part to a helper to reduce duplication. Acked-by: Dave Hansen Signed-off-by: Kevin Brodsky --- include/linux/mm.h | 28 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/include

[PATCH v2 0/6] Account page tables at all levels

2025-01-03 Thread Kevin Brodsky
x-snps-arc@lists.infradead.org Cc: linux...@lists.infradead.org Cc: loonga...@lists.linux.dev Cc: x...@kernel.org --- Kevin Brodsky (6): mm: Move common part of pagetable_*_ctor to helper parisc: mm: Ensure pagetable_pmd_[cd]tor are called m68k: mm: Add calls to pagetable_pmd_[cd]tor ARM: mm: Rename PGD

Re: [PATCH 05/10] riscv: mm: Skip pgtable level check in {pud,p4d}_alloc_one

2025-01-03 Thread Kevin Brodsky
+Qi On 03/01/2025 11:31, Alexandre Ghiti wrote: > Hi Kevin, > > On 19/12/2024 17:44, Kevin Brodsky wrote: >> {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.

Re: [PATCH 00/10] Account page tables at all levels

2025-01-03 Thread Kevin Brodsky
On 20/12/2024 20:31, Dave Hansen wrote: > On 12/20/24 02:58, Kevin Brodsky wrote: >>> One super tiny nit is that the PAE pgd _can_ be allocated using >>> __get_free_pages(). It was originally there for Xen, but I think it's >>> being used for PTI only at this p

Re: [PATCH 01/10] mm: Move common parts of pagetable_*_[cd]tor to helpers

2024-12-20 Thread Kevin Brodsky
On 20/12/2024 15:16, Qi Zheng wrote: >>> >>> Did I miss something? >>> >>> My patch series is not only for cleanup, but also for fixes of >>> UAF issue [1], so is it possible to rebase your patch series onto >>> mine? I can post v3 ASAP. >> >> I see, yours should be merged first then. The issue is

Re: [PATCH 01/10] mm: Move common parts of pagetable_*_[cd]tor to helpers

2024-12-20 Thread Kevin Brodsky
On 20/12/2024 12:46, Qi Zheng wrote: > Hi Kevin, > > On 2024/12/20 18:49, Kevin Brodsky wrote: >> [...] >> >> Qi, shall we collaborate to make our series complementary? I believe my >> series covers patch 2 and 4 of your series, but it goes further by >> co

Re: [PATCH 00/10] Account page tables at all levels

2024-12-20 Thread Kevin Brodsky
On 19/12/2024 18:13, Dave Hansen wrote: > On 12/19/24 08:44, Kevin Brodsky wrote: >> >> +---+-+---+--++ >> | x86 | Y | Y

Re: [PATCH 01/10] mm: Move common parts of pagetable_*_[cd]tor to helpers

2024-12-20 Thread Kevin Brodsky
Hi Peter, Qi, On 19/12/2024 18:19, Peter Zijlstra wrote: > On Thu, Dec 19, 2024 at 04:44:16PM +0000, Kevin Brodsky wrote: >> Besides the ptlock management at PTE/PMD level, all the >> pagetable_*_[cd]tor have the same implementation. Introduce common >> helpers for all

[PATCH 10/10] mm: Introduce ctor/dtor at PGD level

2024-12-19 Thread Kevin Brodsky
page table pages. This patch should cover all architectures and all configurations where PGDs are one or more regular pages. This excludes any configuration where PGDs are allocated from a kmem_cache object. Signed-off-by: Kevin Brodsky --- arch/m68k/include/asm/mcf_pgalloc.h | 2 ++ arch/m6

[PATCH 02/10] parisc: mm: Ensure pagetable_pmd_[cd]tor are called

2024-12-19 Thread Kevin Brodsky
) can handle higher allocation orders so we don't need to define our own. These changes ensure that pagetable_pmd_[cd]tor are called, improving the accounting of page table pages. Signed-off-by: Kevin Brodsky --- arch/parisc/include/asm/pgalloc.h | 23 --- 1 file c

[PATCH 04/10] s390/mm: Add calls to pagetable_pud_[cd]tor

2024-12-19 Thread Kevin Brodsky
o the ctor/dtor helpers in pud_alloc_one/pud_free to match the other architectures. Signed-off-by: Kevin Brodsky --- arch/s390/include/asm/pgalloc.h | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h ind

[PATCH 09/10] asm-generic: pgalloc: Provide generic __pgd_{alloc,free}

2024-12-19 Thread Kevin Brodsky
PGD pages by using GFP_PGTABLE_{USER,KERNEL} as appropriate. Not all PGD allocations can be handled by the generic helpers. In particular, multiple architectures allocate PGDs from a kmem_cache, and those PGDs may not be page-sized. Signed-off-by: Kevin Brodsky --- arch/alpha

[PATCH 08/10] ARM: mm: Rename PGD helpers

2024-12-19 Thread Kevin Brodsky
Generic implementations of __pgd_alloc and __pgd_free are about to be introduced. Rename the macros in arch/arm/mm/pgd.c to avoid clashes. While we're at it, also pass down the mm as argument to those helpers, as it will be needed to call the generic __pgd_{alloc,free}. Signed-off-by:

[PATCH 07/10] mm: Introduce ctor/dtor at P4D level

2024-12-19 Thread Kevin Brodsky
alloc/free paths. Besides the small improvement in accounting accuracy, this also enables adding construction/destruction hooks in just one generic place for page tables at P4D level (like lower levels). Signed-off-by: Kevin Brodsky --- arch/riscv/include/asm/pgalloc.h | 8 ++-- arch/s390/i

[PATCH 06/10] asm-generic: pgalloc: Provide generic p4d_{alloc_one,free}

2024-12-19 Thread Kevin Brodsky
ht 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 --- arch/arm64/include/asm/pgalloc.h | 17 arch/riscv/include/asm/pgalloc.h

[PATCH 05/10] riscv: mm: Skip pgtable level check in {pud,p4d}_alloc_one

2024-12-19 Thread Kevin Brodsky
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 --- arch/riscv/include/asm/pgalloc.h | 22 -- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/arch/riscv

[PATCH 03/10] m68k: mm: Add calls to pagetable_pmd_[cd]tor

2024-12-19 Thread Kevin Brodsky
ating ptable_list for PMD/PGD levels. Signed-off-by: Kevin Brodsky --- arch/m68k/include/asm/motorola_pgalloc.h | 6 +++--- arch/m68k/mm/motorola.c | 25 +++- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/arch/m68k/include/asm/motorola_pgal

[PATCH 01/10] mm: Move common parts of pagetable_*_[cd]tor to helpers

2024-12-19 Thread Kevin Brodsky
Besides the ptlock management at PTE/PMD level, all the pagetable_*_[cd]tor have the same implementation. Introduce common helpers for all levels to reduce the duplication. Signed-off-by: Kevin Brodsky --- include/linux/mm.h | 46 ++ 1 file changed

[PATCH 00/10] Account page tables at all levels

2024-12-19 Thread Kevin Brodsky
nel.org Cc: linux-ri...@lists.infradead.org Cc: linux-s...@vger.kernel.org Cc: linux-snps-arc@lists.infradead.org Cc: linux...@lists.infradead.org Cc: loonga...@lists.linux.dev Cc: x...@kernel.org --- Kevin Brodsky (10): mm: Move common parts of pagetable_*_[cd]tor to helpers parisc: