topology.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. #ifndef _ASM_POWERPC_TOPOLOGY_H
  2. #define _ASM_POWERPC_TOPOLOGY_H
  3. #ifdef __KERNEL__
  4. struct sys_device;
  5. struct device_node;
  6. #ifdef CONFIG_NUMA
  7. /*
  8. * Before going off node we want the VM to try and reclaim from the local
  9. * node. It does this if the remote distance is larger than RECLAIM_DISTANCE.
  10. * With the default REMOTE_DISTANCE of 20 and the default RECLAIM_DISTANCE of
  11. * 20, we never reclaim and go off node straight away.
  12. *
  13. * To fix this we choose a smaller value of RECLAIM_DISTANCE.
  14. */
  15. #define RECLAIM_DISTANCE 10
  16. /*
  17. * Before going off node we want the VM to try and reclaim from the local
  18. * node. It does this if the remote distance is larger than RECLAIM_DISTANCE.
  19. * With the default REMOTE_DISTANCE of 20 and the default RECLAIM_DISTANCE of
  20. * 20, we never reclaim and go off node straight away.
  21. *
  22. * To fix this we choose a smaller value of RECLAIM_DISTANCE.
  23. */
  24. #define RECLAIM_DISTANCE 10
  25. #include <asm/mmzone.h>
  26. static inline int cpu_to_node(int cpu)
  27. {
  28. return numa_cpu_lookup_table[cpu];
  29. }
  30. #define parent_node(node) (node)
  31. #define cpumask_of_node(node) ((node) == -1 ? \
  32. cpu_all_mask : \
  33. node_to_cpumask_map[node])
  34. struct pci_bus;
  35. #ifdef CONFIG_PCI
  36. extern int pcibus_to_node(struct pci_bus *bus);
  37. #else
  38. static inline int pcibus_to_node(struct pci_bus *bus)
  39. {
  40. return -1;
  41. }
  42. #endif
  43. #define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \
  44. cpu_all_mask : \
  45. cpumask_of_node(pcibus_to_node(bus)))
  46. /* sched_domains SD_NODE_INIT for PPC64 machines */
  47. #define SD_NODE_INIT (struct sched_domain) { \
  48. .min_interval = 8, \
  49. .max_interval = 32, \
  50. .busy_factor = 32, \
  51. .imbalance_pct = 125, \
  52. .cache_nice_tries = 1, \
  53. .busy_idx = 3, \
  54. .idle_idx = 1, \
  55. .newidle_idx = 0, \
  56. .wake_idx = 0, \
  57. .forkexec_idx = 0, \
  58. \
  59. .flags = 1*SD_LOAD_BALANCE \
  60. | 1*SD_BALANCE_NEWIDLE \
  61. | 1*SD_BALANCE_EXEC \
  62. | 1*SD_BALANCE_FORK \
  63. | 0*SD_BALANCE_WAKE \
  64. | 0*SD_WAKE_AFFINE \
  65. | 0*SD_PREFER_LOCAL \
  66. | 0*SD_SHARE_CPUPOWER \
  67. | 0*SD_POWERSAVINGS_BALANCE \
  68. | 0*SD_SHARE_PKG_RESOURCES \
  69. | 1*SD_SERIALIZE \
  70. | 0*SD_PREFER_SIBLING \
  71. , \
  72. .last_balance = jiffies, \
  73. .balance_interval = 1, \
  74. }
  75. extern int __node_distance(int, int);
  76. #define node_distance(a, b) __node_distance(a, b)
  77. extern void __init dump_numa_cpu_topology(void);
  78. extern int sysfs_add_device_to_node(struct sys_device *dev, int nid);
  79. extern void sysfs_remove_device_from_node(struct sys_device *dev, int nid);
  80. #else
  81. static inline void dump_numa_cpu_topology(void) {}
  82. static inline int sysfs_add_device_to_node(struct sys_device *dev, int nid)
  83. {
  84. return 0;
  85. }
  86. static inline void sysfs_remove_device_from_node(struct sys_device *dev,
  87. int nid)
  88. {
  89. }
  90. #endif /* CONFIG_NUMA */
  91. #include <asm-generic/topology.h>
  92. #ifdef CONFIG_SMP
  93. #include <asm/cputable.h>
  94. #define smt_capable() (cpu_has_feature(CPU_FTR_SMT))
  95. #ifdef CONFIG_PPC64
  96. #include <asm/smp.h>
  97. #define topology_thread_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu))
  98. #define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu))
  99. #define topology_core_id(cpu) (cpu_to_core_id(cpu))
  100. #endif
  101. #endif
  102. #endif /* __KERNEL__ */
  103. #endif /* _ASM_POWERPC_TOPOLOGY_H */