numa.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_GENERIC_NUMA_H
  3. #define __ASM_GENERIC_NUMA_H
  4. #ifdef CONFIG_NUMA
  5. #define NR_NODE_MEMBLKS (MAX_NUMNODES * 2)
  6. int __node_distance(int from, int to);
  7. #define node_distance(a, b) __node_distance(a, b)
  8. extern nodemask_t numa_nodes_parsed __initdata;
  9. extern bool numa_off;
  10. /* Mappings between node number and cpus on that node. */
  11. extern cpumask_var_t node_to_cpumask_map[MAX_NUMNODES];
  12. void numa_clear_node(unsigned int cpu);
  13. #ifdef CONFIG_DEBUG_PER_CPU_MAPS
  14. const struct cpumask *cpumask_of_node(int node);
  15. #else
  16. /* Returns a pointer to the cpumask of CPUs on Node 'node'. */
  17. static inline const struct cpumask *cpumask_of_node(int node)
  18. {
  19. if (node == NUMA_NO_NODE)
  20. return cpu_all_mask;
  21. return node_to_cpumask_map[node];
  22. }
  23. #endif
  24. void __init arch_numa_init(void);
  25. int __init numa_add_memblk(int nodeid, u64 start, u64 end);
  26. void __init numa_set_distance(int from, int to, int distance);
  27. void __init numa_free_distance(void);
  28. void __init early_map_cpu_to_node(unsigned int cpu, int nid);
  29. void numa_store_cpu_info(unsigned int cpu);
  30. void numa_add_cpu(unsigned int cpu);
  31. void numa_remove_cpu(unsigned int cpu);
  32. #else /* CONFIG_NUMA */
  33. static inline void numa_store_cpu_info(unsigned int cpu) { }
  34. static inline void numa_add_cpu(unsigned int cpu) { }
  35. static inline void numa_remove_cpu(unsigned int cpu) { }
  36. static inline void arch_numa_init(void) { }
  37. static inline void early_map_cpu_to_node(unsigned int cpu, int nid) { }
  38. #endif /* CONFIG_NUMA */
  39. #endif /* __ASM_GENERIC_NUMA_H */