.. | .. |
---|
2 | 2 | #ifndef __MM_CMA_H__ |
---|
3 | 3 | #define __MM_CMA_H__ |
---|
4 | 4 | |
---|
| 5 | +#include <linux/debugfs.h> |
---|
| 6 | +#include <linux/kobject.h> |
---|
| 7 | +#include <linux/android_vendor.h> |
---|
| 8 | + |
---|
| 9 | +struct cma_kobject { |
---|
| 10 | + struct kobject kobj; |
---|
| 11 | + struct cma *cma; |
---|
| 12 | +}; |
---|
| 13 | + |
---|
5 | 14 | struct cma { |
---|
6 | 15 | unsigned long base_pfn; |
---|
7 | 16 | unsigned long count; |
---|
.. | .. |
---|
11 | 20 | #ifdef CONFIG_CMA_DEBUGFS |
---|
12 | 21 | struct hlist_head mem_head; |
---|
13 | 22 | spinlock_t mem_head_lock; |
---|
| 23 | + struct debugfs_u32_array dfs_bitmap; |
---|
14 | 24 | #endif |
---|
15 | | - const char *name; |
---|
16 | | - bool inactive; |
---|
| 25 | + char name[CMA_MAX_NAME]; |
---|
| 26 | +#ifdef CONFIG_CMA_SYSFS |
---|
| 27 | + /* the number of CMA page successful allocations */ |
---|
| 28 | + atomic64_t nr_pages_succeeded; |
---|
| 29 | + /* the number of CMA page allocation failures */ |
---|
| 30 | + atomic64_t nr_pages_failed; |
---|
| 31 | + /* kobject requires dynamic object */ |
---|
| 32 | + struct cma_kobject *cma_kobj; |
---|
| 33 | +#endif |
---|
| 34 | + ANDROID_OEM_DATA_ARRAY(1, 4); |
---|
17 | 35 | }; |
---|
18 | 36 | |
---|
19 | 37 | extern struct cma cma_areas[MAX_CMA_AREAS]; |
---|
.. | .. |
---|
24 | 42 | return cma->count >> cma->order_per_bit; |
---|
25 | 43 | } |
---|
26 | 44 | |
---|
| 45 | +#ifdef CONFIG_CMA_SYSFS |
---|
| 46 | +void cma_sysfs_account_success_pages(struct cma *cma, unsigned long nr_pages); |
---|
| 47 | +void cma_sysfs_account_fail_pages(struct cma *cma, unsigned long nr_pages); |
---|
| 48 | +#else |
---|
| 49 | +static inline void cma_sysfs_account_success_pages(struct cma *cma, |
---|
| 50 | + unsigned long nr_pages) {}; |
---|
| 51 | +static inline void cma_sysfs_account_fail_pages(struct cma *cma, |
---|
| 52 | + unsigned long nr_pages) {}; |
---|
| 53 | +#endif |
---|
27 | 54 | #endif |
---|