The acpi_map_pxm_to_online_node() helper is used to find the closest online node to a given proximity domain. This is used to map devices in a proximity domain with no online memory or cpus to the closest online node and populate a device's 'numa_node' property. The numa_node property allows applications to be migrated "close" to a resource. In preparation for providing a generic facility to optionally map an address range to its closest online node, or the node the range would represent were it to be onlined (target_node), up-level the core of acpi_map_pxm_to_online_node() to a generic mm/numa helper.
Showing the changes to include/linux (2 of 4 files). Show all
Unified · Split
| @@ -416,9 +416,30 @@ extern void acpi_osi_setup(char *str); · 415 unmodified lines | ||
| 416 | 416 | extern bool acpi_osi_is_win8(void); |
| 417 | 417 | |
| 418 | 418 | #ifdef CONFIG_ACPI_NUMA |
| 419 | −int acpi_map_pxm_to_online_node(int pxm); | |
| 420 | 419 | int acpi_map_pxm_to_node(int pxm); |
| 421 | 420 | int acpi_get_node(acpi_handle handle); |
| 421 | + | |
| 422 | +/** | |
| 423 | + * acpi_map_pxm_to_online_node - Map proximity ID to online node | |
| 424 | + * @pxm: ACPI proximity ID | |
| 425 | + * | |
| 426 | + * This is similar to acpi_map_pxm_to_node(), but always returns an online | |
| 427 | + * node. When the mapped node from a given proximity ID is offline, it | |
| 428 | + * looks up the node distance table and returns the nearest online node. | |
| 429 | + * | |
| 430 | + * ACPI device drivers, which are called after the NUMA initialization has | |
| 431 | + * completed in the kernel, can call this interface to obtain their device | |
| 432 | + * NUMA topology from ACPI tables. Such drivers do not have to deal with | |
| 433 | + * offline nodes. A node may be offline when a device proximity ID is | |
| 434 | + * unique, SRAT memory entry does not exist, or NUMA is disabled, ex. | |
| 435 | + * "numa=off" on x86. | |
| 436 | + */ | |
| 437 | +static inline int acpi_map_pxm_to_online_node(int pxm) | |
| 438 | +{ | |
| 439 | + int node = acpi_map_pxm_to_node(pxm); | |
| 440 | + | |
| 441 | + return numa_map_to_online_node(node); | |
| 442 | +} | |
| 422 | 443 | #else |
| 423 | 444 | static inline int acpi_map_pxm_to_online_node(int pxm) |
| 424 | 445 | { |
| @@ -13,4 +13,13 @@ · 12 unmodified lines | ||
| 13 | 13 | |
| 14 | 14 | #define NUMA_NO_NODE (-1) |
| 15 | 15 | |
| 16 | +#ifdef CONFIG_NUMA | |
| 17 | +int numa_map_to_online_node(int node); | |
| 18 | +#else | |
| 19 | +static inline int numa_map_to_online_node(int node) | |
| 20 | +{ | |
| 21 | + return NUMA_NO_NODE; | |
| 22 | +} | |
| 23 | +#endif | |
| 24 | + | |
| 16 | 25 | #endif /* _LINUX_NUMA_H */ |