xref: /linux-6.15/include/linux/numa.h (revision 82d00a93)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_NUMA_H
3 #define _LINUX_NUMA_H
4 #include <linux/types.h>
5 
6 #ifdef CONFIG_NODES_SHIFT
7 #define NODES_SHIFT     CONFIG_NODES_SHIFT
8 #else
9 #define NODES_SHIFT     0
10 #endif
11 
12 #define MAX_NUMNODES    (1 << NODES_SHIFT)
13 
14 #define	NUMA_NO_NODE	(-1)
15 
16 /* optionally keep NUMA memory info available post init */
17 #ifdef CONFIG_NUMA_KEEP_MEMINFO
18 #define __initdata_or_meminfo
19 #else
20 #define __initdata_or_meminfo __initdata
21 #endif
22 
23 #ifdef CONFIG_NUMA
24 /* Generic implementation available */
25 int numa_map_to_online_node(int node);
26 
27 /*
28  * Optional architecture specific implementation, users need a "depends
29  * on $ARCH"
30  */
31 int phys_to_target_node(phys_addr_t addr);
32 #else
33 static inline int numa_map_to_online_node(int node)
34 {
35 	return NUMA_NO_NODE;
36 }
37 
38 static inline int phys_to_target_node(phys_addr_t addr)
39 {
40 	return NUMA_NO_NODE;
41 }
42 #endif
43 
44 #endif /* _LINUX_NUMA_H */
45