xref: /linux/mm/hugetlb_cma.h (revision 3a64d5b82eccc0dc629d43cde791a2c19bd67dfc)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_HUGETLB_CMA_H
3 #define _LINUX_HUGETLB_CMA_H
4 
5 #ifdef CONFIG_CMA
6 void hugetlb_cma_free_frozen_folio(struct folio *folio);
7 struct folio *hugetlb_cma_alloc_frozen_folio(int order, gfp_t gfp_mask,
8 				      int nid, nodemask_t *nodemask);
9 struct huge_bootmem_page *hugetlb_cma_alloc_bootmem(struct hstate *h, int *nid,
10 						    bool node_exact);
11 bool hugetlb_cma_exclusive_alloc(void);
12 unsigned long hugetlb_cma_total_size(void);
13 void hugetlb_cma_validate_params(void);
14 bool hugetlb_early_cma(struct hstate *h);
15 #else
16 static inline void hugetlb_cma_free_frozen_folio(struct folio *folio)
17 {
18 }
19 
20 static inline struct folio *hugetlb_cma_alloc_frozen_folio(int order,
21 		gfp_t gfp_mask,	int nid, nodemask_t *nodemask)
22 {
23 	return NULL;
24 }
25 
26 static inline
27 struct huge_bootmem_page *hugetlb_cma_alloc_bootmem(struct hstate *h, int *nid,
28 						    bool node_exact)
29 {
30 	return NULL;
31 }
32 
33 static inline bool hugetlb_cma_exclusive_alloc(void)
34 {
35 	return false;
36 }
37 
38 static inline unsigned long hugetlb_cma_total_size(void)
39 {
40 	return 0;
41 }
42 
43 static inline void hugetlb_cma_validate_params(void)
44 {
45 }
46 
47 static inline bool hugetlb_early_cma(struct hstate *h)
48 {
49 	return false;
50 }
51 #endif
52 #endif
53