hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/include/linux/node.h
....@@ -17,13 +17,80 @@
1717
1818 #include <linux/device.h>
1919 #include <linux/cpumask.h>
20
+#include <linux/list.h>
2021 #include <linux/workqueue.h>
22
+
23
+/**
24
+ * struct node_hmem_attrs - heterogeneous memory performance attributes
25
+ *
26
+ * @read_bandwidth: Read bandwidth in MB/s
27
+ * @write_bandwidth: Write bandwidth in MB/s
28
+ * @read_latency: Read latency in nanoseconds
29
+ * @write_latency: Write latency in nanoseconds
30
+ */
31
+struct node_hmem_attrs {
32
+ unsigned int read_bandwidth;
33
+ unsigned int write_bandwidth;
34
+ unsigned int read_latency;
35
+ unsigned int write_latency;
36
+};
37
+
38
+enum cache_indexing {
39
+ NODE_CACHE_DIRECT_MAP,
40
+ NODE_CACHE_INDEXED,
41
+ NODE_CACHE_OTHER,
42
+};
43
+
44
+enum cache_write_policy {
45
+ NODE_CACHE_WRITE_BACK,
46
+ NODE_CACHE_WRITE_THROUGH,
47
+ NODE_CACHE_WRITE_OTHER,
48
+};
49
+
50
+/**
51
+ * struct node_cache_attrs - system memory caching attributes
52
+ *
53
+ * @indexing: The ways memory blocks may be placed in cache
54
+ * @write_policy: Write back or write through policy
55
+ * @size: Total size of cache in bytes
56
+ * @line_size: Number of bytes fetched on a cache miss
57
+ * @level: The cache hierarchy level
58
+ */
59
+struct node_cache_attrs {
60
+ enum cache_indexing indexing;
61
+ enum cache_write_policy write_policy;
62
+ u64 size;
63
+ u16 line_size;
64
+ u8 level;
65
+};
66
+
67
+#ifdef CONFIG_HMEM_REPORTING
68
+void node_add_cache(unsigned int nid, struct node_cache_attrs *cache_attrs);
69
+void node_set_perf_attrs(unsigned int nid, struct node_hmem_attrs *hmem_attrs,
70
+ unsigned access);
71
+#else
72
+static inline void node_add_cache(unsigned int nid,
73
+ struct node_cache_attrs *cache_attrs)
74
+{
75
+}
76
+
77
+static inline void node_set_perf_attrs(unsigned int nid,
78
+ struct node_hmem_attrs *hmem_attrs,
79
+ unsigned access)
80
+{
81
+}
82
+#endif
2183
2284 struct node {
2385 struct device dev;
86
+ struct list_head access_list;
2487
2588 #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
2689 struct work_struct node_work;
90
+#endif
91
+#ifdef CONFIG_HMEM_REPORTING
92
+ struct list_head cache_attrs;
93
+ struct device *cache_dev;
2794 #endif
2895 };
2996
....@@ -32,15 +99,14 @@
3299 typedef void (*node_registration_func_t)(struct node *);
33100
34101 #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_NUMA)
35
-int link_mem_sections(int nid, unsigned long start_pfn,
36
- unsigned long end_pfn,
37
- enum meminit_context context);
102
+void link_mem_sections(int nid, unsigned long start_pfn,
103
+ unsigned long end_pfn,
104
+ enum meminit_context context);
38105 #else
39
-static inline int link_mem_sections(int nid, unsigned long start_pfn,
40
- unsigned long end_pfn,
41
- enum meminit_context context)
106
+static inline void link_mem_sections(int nid, unsigned long start_pfn,
107
+ unsigned long end_pfn,
108
+ enum meminit_context context)
42109 {
43
- return 0;
44110 }
45111 #endif
46112
....@@ -63,8 +129,7 @@
63129 if (error)
64130 return error;
65131 /* link memory sections under this node */
66
- error = link_mem_sections(nid, start_pfn, end_pfn,
67
- MEMINIT_EARLY);
132
+ link_mem_sections(nid, start_pfn, end_pfn, MEMINIT_EARLY);
68133 }
69134
70135 return error;
....@@ -73,9 +138,11 @@
73138 extern void unregister_one_node(int nid);
74139 extern int register_cpu_under_node(unsigned int cpu, unsigned int nid);
75140 extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid);
76
-extern int register_mem_sect_under_node(struct memory_block *mem_blk,
77
- void *arg);
78141 extern void unregister_memory_block_under_nodes(struct memory_block *mem_blk);
142
+
143
+extern int register_memory_node_under_compute_node(unsigned int mem_nid,
144
+ unsigned int cpu_nid,
145
+ unsigned access);
79146
80147 #ifdef CONFIG_HUGETLBFS
81148 extern void register_hugetlbfs_with_node(node_registration_func_t doregister,
....@@ -99,11 +166,6 @@
99166 return 0;
100167 }
101168 static inline int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
102
-{
103
- return 0;
104
-}
105
-static inline int register_mem_sect_under_node(struct memory_block *mem_blk,
106
- void *arg)
107169 {
108170 return 0;
109171 }