xref: /linux/mm/hugetlb_cma.h (revision 3a2c4d55e32ad65efebdb6de44eef3bfa08bb49d)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_HUGETLB_CMA_H
3 #define _LINUX_HUGETLB_CMA_H
4 
5 #include <linux/hugetlb.h>
6 
7 #ifdef CONFIG_CMA
8 void hugetlb_cma_free_frozen_folio(struct folio *folio);
9 struct folio *hugetlb_cma_alloc_frozen_folio(int order, gfp_t gfp_mask,
10 				      int nid, nodemask_t *nodemask);
11 void *hugetlb_cma_alloc_bootmem(struct hstate *h, int nid, bool node_exact);
12 bool hugetlb_cma_exclusive_alloc(void);
13 unsigned long hugetlb_cma_total_size(void);
14 void hugetlb_cma_validate_params(void);
15 bool hugetlb_early_cma(struct hstate *h);
16 #else
17 static inline void hugetlb_cma_free_frozen_folio(struct folio *folio)
18 {
19 }
20 
21 static inline struct folio *hugetlb_cma_alloc_frozen_folio(int order,
22 		gfp_t gfp_mask,	int nid, nodemask_t *nodemask)
23 {
24 	return NULL;
25 }
26 
27 static inline void *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