hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/mm/cma.h
....@@ -2,6 +2,15 @@
22 #ifndef __MM_CMA_H__
33 #define __MM_CMA_H__
44
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
+
514 struct cma {
615 unsigned long base_pfn;
716 unsigned long count;
....@@ -11,9 +20,18 @@
1120 #ifdef CONFIG_CMA_DEBUGFS
1221 struct hlist_head mem_head;
1322 spinlock_t mem_head_lock;
23
+ struct debugfs_u32_array dfs_bitmap;
1424 #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);
1735 };
1836
1937 extern struct cma cma_areas[MAX_CMA_AREAS];
....@@ -24,4 +42,13 @@
2442 return cma->count >> cma->order_per_bit;
2543 }
2644
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
2754 #endif