mm-hugetlb-enable-bootmem-allocation-from-cma-areas.patch removed from -mm tree
The quilt patch titled
Subject: mm/hugetlb: enable bootmem allocation from CMA areas
has been removed from the -mm tree. Its filename was
mm-hugetlb-enable-bootmem-allocation-from-cma-areas.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Frank van der Linden <[email protected]>
Subject: mm/hugetlb: enable bootmem allocation from CMA areas
Date: Fri, 28 Feb 2025 18:29:27 +0000
If hugetlb_cma_only is enabled, we know that hugetlb pages can only be allocated from CMA. Now that there is an interface to do early reservations from a CMA area (returning memblock memory), it can be used to allocate hugetlb pages from CMA.
This also allows for doing pre-HVO on these pages (if enabled).
Make sure to initialize the page structures and associated data correctly. Create a flag to signal that a hugetlb page has been allocated from CMA to make things a little easier.
Some configurations of powerpc have a special hugetlb bootmem allocator, so introduce a boolean arch_specific_huge_bootmem_alloc that returns true if such an allocator is present. In that case, CMA bootmem allocations can't be used, so check that function before trying.
---
arch/powerpc/include/asm/book3s/64/hugetlb.h | 6 include/linux/hugetlb.h | 17 + mm/hugetlb.c | 168 +++++++++++++---- 3 files changed, 152 insertions(+), 39 deletions(-)
arch/powerpc/include/asm/book3s/64/hugetlb.h renamed from arch/powerpc/include/asm/book3s/64/hugetlb.h~mm-hugetlb-enable-bootmem-allocation-from-cma-areas +6 -0
@@ -94,4 +94,10 @@ static inline int check_and_get_huge_psi return mmu_psize; } +#define arch_has_huge_bootmem_alloc arch_has_huge_bootmem_alloc + +static inline bool arch_has_huge_bootmem_alloc (void ) +{ +return (firmware_has_feature (FW_FEATURE_LPAR ) && !radix_enabled ()); +}#endif
include/linux/hugetlb.h renamed from include/linux/hugetlb.h~mm-hugetlb-enable-bootmem-allocation-from-cma-areas +17 -0
@@ -591,6 +591,7 @@ enum hugetlb_page_flags { HPG_freed, HPG_vmemmap_optimized, HPG_raw_hwp_unreliable, + HPG_cma, __NR_HPAGEFLAGS, };
@@ -650,6 +651,7 @@ HPAGEFLAG(Temporary, temporary) HPAGEFLAG(Freed, freed) HPAGEFLAG(VmemmapOptimized, vmemmap_optimized) HPAGEFLAG(RawHwpUnreliable, raw_hwp_unreliable) +HPAGEFLAG(Cma, cma)#ifdef CONFIG_HUGETLB_PAGE
@@ -678,14 +680,18 @@ struct hstate {char name[HSTATE_NAME_LEN ]; }; +struct cma ; +struct huge_bootmem_page {struct list_head list;struct hstate *hstate;unsigned long flags; +struct cma *cma; };#define HUGE_BOOTMEM_HVO 0x0001#define HUGE_BOOTMEM_ZONES_VALID 0x0002 +#define HUGE_BOOTMEM_CMA 0x0004bool hugetlb_bootmem_page_zones_valid (int nid,struct huge_bootmem_page *m);
@@ -824,6 +830,17 @@ static inline pte_t arch_make_huge_pte(p }#endif +#ifndef arch_has_huge_bootmem_alloc +/* +* Some architectures do their own bootmem allocation, so they can't use +* early CMA allocation. +*/ +static inline bool arch_has_huge_bootmem_alloc (void ) +{ +return false; +} +#endif +static inline struct hstate *folio_hstate (struct folio *folio) {VM_BUG_ON_FOLIO (!folio_test_hugetlb (folio), folio);
mm/hugetlb.c renamed from mm/hugetlb.c~mm-hugetlb-enable-bootmem-allocation-from-cma-areas +129 -39
257 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are