linux/arch/arc/include/asm
Kevin Brodsky a9b3c355c2 asm-generic: pgalloc: provide generic __pgd_{alloc,free}
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 introducing a
generic pgd_alloc() isn't worth it.  Instead we introduce two new helpers,
__pgd_alloc() and __pgd_free(), and make use of them in the arch-specific
pgd_alloc() and pgd_free() wherever possible.  To accommodate as many arch
as possible, __pgd_alloc() takes a page allocation order.

Because pagetable_alloc() allocates zeroed pages, explicit zeroing in
pgd_alloc() becomes redundant and we can get rid of it.  Some trivial
implementations of pgd_free() also become unnecessary once __pgd_alloc()
is used; remove them.

Another small improvement is consistent accounting of 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.

Link: https://lkml.kernel.org/r/20250103184415.2744423-6-kevin.brodsky@arm.com
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
Acked-by: Qi Zheng <zhengqi.arch@bytedance.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-01-25 20:22:24 -08:00
..
Kbuild asm-generic: introduce text-patching.h 2024-11-07 14:25:15 -08:00
arcregs.h arc: rename aux.h to arc_aux.h 2024-12-10 10:12:56 -08:00
asm-offsets.h
asserts.h
atomic-llsc.h
atomic-spinlock.h
atomic.h
atomic64-arcv2.h
barrier.h
bitops.h
bug.h
cache.h
cacheflush.h
cachetype.h mm: introduce cpu_icache_is_aliasing() across all architectures 2024-12-18 19:04:43 -08:00
checksum.h
cmpxchg.h ARC: build: Use __force to suppress per-CPU cmpxchg warnings 2024-12-10 10:12:56 -08:00
current.h
delay.h
disasm.h
dma.h
dsp-impl.h
dsp.h
dwarf.h
elf.h
entry-arcv2.h
entry-compact.h
entry.h
exec.h
fpu.h
futex.h
highmem.h
hugepage.h
io.h asm-generic: provide generic page_to_phys and phys_to_page implementations 2024-10-28 21:44:28 +00:00
irq.h
irqflags-arcv2.h
irqflags-compact.h
irqflags.h
jump_label.h
kdebug.h
kgdb.h
kprobes.h
linkage.h
mach_desc.h
mmu-arcv2.h arc: rename aux.h to arc_aux.h 2024-12-10 10:12:56 -08:00
mmu.h arc: get rid of private asm/unaligned.h 2024-10-02 17:22:47 -04:00
mmu_context.h
module.h
page.h
pci.h
perf_event.h
pgalloc.h asm-generic: pgalloc: provide generic __pgd_{alloc,free} 2025-01-25 20:22:24 -08:00
pgtable-bits-arcv2.h
pgtable-levels.h
pgtable.h
processor.h
ptrace.h
sections.h
serial.h
setup.h
shmparam.h
smp.h
spinlock.h
spinlock_types.h
stacktrace.h
string.h
switch_to.h
syscall.h
syscalls.h
thread_info.h
timex.h
tlb.h
tlbflush.h
uaccess.h
unistd.h arc: convert to generic syscall table 2024-07-10 14:23:38 +02:00
unwind.h
vermagic.h
vmalloc.h