Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drivers/base/node: Add a helper function node_update_perf_attrs()

Add helper function node_update_perf_attrs() to allow update of node access
coordinates computed by an external agent such as CXL. The helper allows
updating of coordinates after the attribute being created by HMAT.

Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Link: https://patch.msgid.link/20250829222907.1290912-3-dave.jiang@intel.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>

+46
+38
drivers/base/node.c
··· 249 249 EXPORT_SYMBOL_GPL(node_set_perf_attrs); 250 250 251 251 /** 252 + * node_update_perf_attrs - Update the performance values for given access class 253 + * @nid: Node identifier to be updated 254 + * @coord: Heterogeneous memory performance coordinates 255 + * @access: The access class for the given attributes 256 + */ 257 + void node_update_perf_attrs(unsigned int nid, struct access_coordinate *coord, 258 + enum access_coordinate_class access) 259 + { 260 + struct node_access_nodes *access_node; 261 + struct node *node; 262 + int i; 263 + 264 + if (WARN_ON_ONCE(!node_online(nid))) 265 + return; 266 + 267 + node = node_devices[nid]; 268 + list_for_each_entry(access_node, &node->access_list, list_node) { 269 + if (access_node->access != access) 270 + continue; 271 + 272 + access_node->coord = *coord; 273 + for (i = 0; access_attrs[i]; i++) { 274 + sysfs_notify(&access_node->dev.kobj, 275 + NULL, access_attrs[i]->name); 276 + } 277 + break; 278 + } 279 + 280 + /* When setting CPU access coordinates, update mempolicy */ 281 + if (access != ACCESS_COORDINATE_CPU) 282 + return; 283 + 284 + if (mempolicy_set_node_perf(nid, coord)) 285 + pr_info("failed to set mempolicy attrs for node %d\n", nid); 286 + } 287 + EXPORT_SYMBOL_GPL(node_update_perf_attrs); 288 + 289 + /** 252 290 * struct node_cache_info - Internal tracking for memory node caches 253 291 * @dev: Device represeting the cache level 254 292 * @node: List element for tracking in the node
+8
include/linux/node.h
··· 85 85 void node_add_cache(unsigned int nid, struct node_cache_attrs *cache_attrs); 86 86 void node_set_perf_attrs(unsigned int nid, struct access_coordinate *coord, 87 87 enum access_coordinate_class access); 88 + void node_update_perf_attrs(unsigned int nid, struct access_coordinate *coord, 89 + enum access_coordinate_class access); 88 90 #else 89 91 static inline void node_add_cache(unsigned int nid, 90 92 struct node_cache_attrs *cache_attrs) ··· 96 94 static inline void node_set_perf_attrs(unsigned int nid, 97 95 struct access_coordinate *coord, 98 96 enum access_coordinate_class access) 97 + { 98 + } 99 + 100 + static inline void node_update_perf_attrs(unsigned int nid, 101 + struct access_coordinate *coord, 102 + enum access_coordinate_class access) 99 103 { 100 104 } 101 105 #endif