numa.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #ifndef _ASM_X86_NUMA_H
  2. #define _ASM_X86_NUMA_H
  3. #include <linux/nodemask.h>
  4. #include <asm/topology.h>
  5. #include <asm/apicdef.h>
  6. #ifdef CONFIG_NUMA
  7. #define NR_NODE_MEMBLKS (MAX_NUMNODES*2)
  8. #define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT))
  9. /*
  10. * Too small node sizes may confuse the VM badly. Usually they
  11. * result from BIOS bugs. So dont recognize nodes as standalone
  12. * NUMA entities that have less than this amount of RAM listed:
  13. */
  14. #define NODE_MIN_SIZE (4*1024*1024)
  15. extern int numa_off;
  16. /*
  17. * __apicid_to_node[] stores the raw mapping between physical apicid and
  18. * node and is used to initialize cpu_to_node mapping.
  19. *
  20. * The mapping may be overridden by apic->numa_cpu_node() on 32bit and thus
  21. * should be accessed by the accessors - set_apicid_to_node() and
  22. * numa_cpu_node().
  23. */
  24. extern s16 __apicid_to_node[MAX_LOCAL_APIC];
  25. extern nodemask_t numa_nodes_parsed __initdata;
  26. extern int __init numa_add_memblk(int nodeid, u64 start, u64 end);
  27. extern void __init numa_set_distance(int from, int to, int distance);
  28. static inline void set_apicid_to_node(int apicid, s16 node)
  29. {
  30. __apicid_to_node[apicid] = node;
  31. }
  32. extern int __cpuinit numa_cpu_node(int cpu);
  33. #else /* CONFIG_NUMA */
  34. static inline void set_apicid_to_node(int apicid, s16 node)
  35. {
  36. }
  37. static inline int numa_cpu_node(int cpu)
  38. {
  39. return NUMA_NO_NODE;
  40. }
  41. #endif /* CONFIG_NUMA */
  42. #ifdef CONFIG_X86_32
  43. # include "numa_32.h"
  44. #else
  45. # include "numa_64.h"
  46. #endif
  47. #ifdef CONFIG_NUMA
  48. extern void __cpuinit numa_set_node(int cpu, int node);
  49. extern void __cpuinit numa_clear_node(int cpu);
  50. extern void __init init_cpu_to_node(void);
  51. extern void __cpuinit numa_add_cpu(int cpu);
  52. extern void __cpuinit numa_remove_cpu(int cpu);
  53. #else /* CONFIG_NUMA */
  54. static inline void numa_set_node(int cpu, int node) { }
  55. static inline void numa_clear_node(int cpu) { }
  56. static inline void init_cpu_to_node(void) { }
  57. static inline void numa_add_cpu(int cpu) { }
  58. static inline void numa_remove_cpu(int cpu) { }
  59. #endif /* CONFIG_NUMA */
  60. #ifdef CONFIG_DEBUG_PER_CPU_MAPS
  61. void debug_cpumask_set_cpu(int cpu, int node, bool enable);
  62. #endif
  63. #ifdef CONFIG_NUMA_EMU
  64. #define FAKE_NODE_MIN_SIZE ((u64)32 << 20)
  65. #define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL))
  66. void numa_emu_cmdline(char *);
  67. #endif /* CONFIG_NUMA_EMU */
  68. #endif /* _ASM_X86_NUMA_H */