mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
mm/hugetlb: remove unused bootmem cma field
struct huge_bootmem_page no longer needs to keep the CMA pointer. The bootmem path only needs to remember whether a huge page came from CMA, which is already encoded in the flags field. Set HUGE_BOOTMEM_CMA when the page is allocated, drop the unused cma field together with the redundant assignments, and simplify the early CMA bootmem allocation fallback path now that the cma pointer no longer has to be stored in struct huge_bootmem_page. Link: https://lore.kernel.org/20260612035903.2468601-19-songmuchun@bytedance.com Signed-off-by: Muchun Song <songmuchun@bytedance.com> Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com> Cc: David Hildenbrand <david@kernel.org> Cc: Frank van der Linden <fvdl@google.com> Cc: Liam R. Howlett <liam@infradead.org> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Madhavan Srinivasan <maddy@linux.ibm.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Mike Rapoport (Microsoft) <rppt@kernel.org> Cc: Nicholas Piggin <npiggin@gmail.com> Cc: Oscar Salvador <osalvador@suse.de> Cc: Oscar Salvador (SUSE) <osalvador@kernel.org> Cc: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com> Cc: Usama Arif <usama.arif@linux.dev> Cc: Vlastimil Babka <vbabka@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
ec1adc14c1
commit
8669383759
|
|
@ -3076,10 +3076,7 @@ static bool __init alloc_bootmem_huge_page(struct hstate *h, int nid)
|
|||
*/
|
||||
INIT_LIST_HEAD(&m->list);
|
||||
m->hstate = h;
|
||||
if (!hugetlb_early_cma(h)) {
|
||||
m->cma = NULL;
|
||||
m->flags = 0;
|
||||
}
|
||||
m->flags = hugetlb_early_cma(h) ? HUGE_BOOTMEM_CMA : 0;
|
||||
|
||||
/* CMA pages: zone-crossing is validated in hugetlb_cma_reserve(). */
|
||||
if (!hugetlb_early_cma(h) &&
|
||||
|
|
|
|||
|
|
@ -59,31 +59,24 @@ struct folio *hugetlb_cma_alloc_frozen_folio(int order, gfp_t gfp_mask,
|
|||
void * __init hugetlb_cma_alloc_bootmem(struct hstate *h, int nid, bool node_exact)
|
||||
{
|
||||
struct cma *cma;
|
||||
struct huge_bootmem_page *m;
|
||||
void *m;
|
||||
int node;
|
||||
|
||||
cma = hugetlb_cma[nid];
|
||||
m = cma_reserve_early(cma, huge_page_size(h));
|
||||
if (!m) {
|
||||
if (node_exact)
|
||||
return NULL;
|
||||
if (m || node_exact)
|
||||
return m;
|
||||
|
||||
for_each_node_mask(node, hugetlb_bootmem_nodes) {
|
||||
cma = hugetlb_cma[node];
|
||||
if (!cma || node == nid)
|
||||
continue;
|
||||
m = cma_reserve_early(cma, huge_page_size(h));
|
||||
if (m)
|
||||
break;
|
||||
}
|
||||
for_each_node_mask(node, hugetlb_bootmem_nodes) {
|
||||
cma = hugetlb_cma[node];
|
||||
if (!cma || node == nid)
|
||||
continue;
|
||||
m = cma_reserve_early(cma, huge_page_size(h));
|
||||
if (m)
|
||||
return m;
|
||||
}
|
||||
|
||||
if (m) {
|
||||
m->flags = HUGE_BOOTMEM_CMA;
|
||||
m->cma = cma;
|
||||
}
|
||||
|
||||
return m;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int __init cmdline_parse_hugetlb_cma(char *p)
|
||||
|
|
|
|||
|
|
@ -24,13 +24,11 @@
|
|||
|
||||
struct folio_batch;
|
||||
struct hstate;
|
||||
struct cma;
|
||||
|
||||
struct huge_bootmem_page {
|
||||
struct list_head list;
|
||||
struct hstate *hstate;
|
||||
unsigned long flags;
|
||||
struct cma *cma;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user