[PATCH] hostfs: Convert to writepages

2024-12-19 Thread Matthew Wilcox (Oracle)
If we add a migrate_folio operation, we can convert the writepage operation to writepages. The large folio support here is illusory; we would need to kmap each page in turn for proper support. But we do remove a few hidden calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- fs

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

2024-12-19 Thread Kevin Brodsky
Following on from the introduction of P4D-level ctor/dtor, let's finish the job and introduce ctor/dtor at PGD level. The incurred improvement in page accounting is minimal - the main motivation is to create a single, generic place where construction/destruction hooks can be added for all page tabl

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

2024-12-19 Thread Kevin Brodsky
The implementation of pmd_{alloc_one,free} on parisc requires a non-zero allocation order, but is completely standard aside from that. Let's reuse the generic implementation of pmd_alloc_one(). Explicit zeroing is not needed as GFP_PGTABLE_KERNEL includes __GFP_ZERO. The generic pmd_free() can hand

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

2024-12-19 Thread Kevin Brodsky
Commit 55d2a0bd5ead ("mm: add statistics for PUD level pagetable") introduced PUD-level ctor/dtor helpers to improve the accounting of page table pages. s390 doesn't use the generic pgalloc implementation and it seems that it got missed in the process. Add the missing calls to the ctor/dtor helpers

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

2024-12-19 Thread Peter Zijlstra
On Thu, Dec 19, 2024 at 04:44:16PM +, 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 levels to reduce the duplication. Uff, I forgot to Cc you on the discussion here, sorry!:

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

2024-12-19 Thread Dave Hansen
On 12/19/24 08:44, Kevin Brodsky wrote: > > +---+-+---+--++ > | x86 | Y | Y | Y/N > | kmem_cache at pgd level if PAE | >

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

2024-12-19 Thread Kevin Brodsky
We already have a generic implementation of alloc/free up to P4D level, as well as pgd_free(). Let's finish the work and add a generic PGD-level alloc helper as well. Unlike at lower levels, almost all architectures need some specific magic at PGD level (typically initialising PGD entries), so int

[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: Kevin Brodsk

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

2024-12-19 Thread Kevin Brodsky
Commit 55d2a0bd5ead ("mm: add statistics for PUD level pagetable") added accounting for PUD-level page tables. This patch does exactly the same thing for P4D-level page tables, introducing pagetable_p4d_[cd]tor with the same implementation as the PUD ctor/dtor and calling them on all alloc/free pat

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

2024-12-19 Thread 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 version of p4d_alloc_one()

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

2024-12-19 Thread 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 generic version, so we re

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

2024-12-19 Thread Kevin Brodsky
get_pointer_table() and free_pointer_table() already special-case TABLE_PTE to call pagetable_pte_[cd]tor. Let's do the same at PMD level to improve accounting further. TABLE_PGD and TABLE_PMD are currently defined to the same value, so we first need to separate them. That also implies separating p

[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, 22

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

2024-12-19 Thread Kevin Brodsky
We currently have a pair of ctor/dtor calls for lower page table levels, up to PUD. At PTE and PMD level, these handle split locks, if supported. Additionally, the helpers ensure correct accounting of page table pages to the corresponding process. This series takes that principle to its logical co