1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/debugfs.h>
6 #include <linux/kobject.h>
14 unsigned long base_pfn
;
16 unsigned long *bitmap
;
17 unsigned int order_per_bit
; /* Order of pages represented by one bit */
19 #ifdef CONFIG_CMA_DEBUGFS
20 struct hlist_head mem_head
;
21 spinlock_t mem_head_lock
;
22 struct debugfs_u32_array dfs_bitmap
;
24 char name
[CMA_MAX_NAME
];
25 #ifdef CONFIG_CMA_SYSFS
26 /* the number of CMA page successful allocations */
27 atomic64_t nr_pages_succeeded
;
28 /* the number of CMA page allocation failures */
29 atomic64_t nr_pages_failed
;
30 /* the number of CMA page released */
31 atomic64_t nr_pages_released
;
32 /* kobject requires dynamic object */
33 struct cma_kobject
*cma_kobj
;
35 bool reserve_pages_on_error
;
38 extern struct cma cma_areas
[MAX_CMA_AREAS
];
39 extern unsigned cma_area_count
;
41 static inline unsigned long cma_bitmap_maxno(struct cma
*cma
)
43 return cma
->count
>> cma
->order_per_bit
;
46 #ifdef CONFIG_CMA_SYSFS
47 void cma_sysfs_account_success_pages(struct cma
*cma
, unsigned long nr_pages
);
48 void cma_sysfs_account_fail_pages(struct cma
*cma
, unsigned long nr_pages
);
49 void cma_sysfs_account_release_pages(struct cma
*cma
, unsigned long nr_pages
);
51 static inline void cma_sysfs_account_success_pages(struct cma
*cma
,
52 unsigned long nr_pages
) {};
53 static inline void cma_sysfs_account_fail_pages(struct cma
*cma
,
54 unsigned long nr_pages
) {};
55 static inline void cma_sysfs_account_release_pages(struct cma
*cma
,
56 unsigned long nr_pages
) {};