topology.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. #include <asm/mmzone.h>
  17. static inline int cpu_to_node(int cpu)
  18. {
  19. return numa_cpu_lookup_table[cpu];
  20. }
  21. #define parent_node(node) (node)
  22. #define cpumask_of_node(node) ((node) == -1 ? \
  23. cpu_all_mask : \
  24. &numa_cpumask_lookup_table[node])
  25. int of_node_to_nid(struct device_node *device);
  26. struct pci_bus;
  27. #ifdef CONFIG_PCI
  28. extern int pcibus_to_node(struct pci_bus *bus);
  29. #else
  30. static inline int pcibus_to_node(struct pci_bus *bus)
  31. {
  32. return -1;
  33. }
  34. #endif
  35. #define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \
  36. cpu_all_mask : \
  37. cpumask_of_node(pcibus_to_node(bus)))
  38. /* sched_domains SD_NODE_INIT for PPC64 machines */
  39. #define SD_NODE_INIT (struct sched_domain) { \
  40. .min_interval = 8, \
  41. .max_interval = 32, \
  42. .busy_factor = 32, \
  43. .imbalance_pct = 125, \
  44. .cache_nice_tries = 1, \
  45. .busy_idx = 3, \
  46. .idle_idx = 1, \
  47. .newidle_idx = 0, \
  48. .wake_idx = 0, \
  49. .forkexec_idx = 0, \
  50. \
  51. .flags = 1*SD_LOAD_BALANCE \
  52. | 1*SD_BALANCE_NEWIDLE \
  53. | 1*SD_BALANCE_EXEC \
  54. | 1*SD_BALANCE_FORK \
  55. | 0*SD_BALANCE_WAKE \
  56. | 0*SD_WAKE_AFFINE \
  57. | 0*SD_PREFER_LOCAL \
  58. | 0*SD_SHARE_CPUPOWER \
  59. | 0*SD_POWERSAVINGS_BALANCE \
  60. | 0*SD_SHARE_PKG_RESOURCES \
  61. | 1*SD_SERIALIZE \
  62. | 0*SD_PREFER_SIBLING \
  63. , \
  64. .last_balance = jiffies, \
  65. .balance_interval = 1, \
  66. }
  67. extern void __init dump_numa_cpu_topology(void);
  68. extern int sysfs_add_device_to_node(struct sys_device *dev, int nid);
  69. extern void sysfs_remove_device_from_node(struct sys_device *dev, int nid);
  70. #else
  71. static inline int of_node_to_nid(struct device_node *device)
  72. {
  73. return 0;
  74. }
  75. static inline void dump_numa_cpu_topology(void) {}
  76. static inline int sysfs_add_device_to_node(struct sys_device *dev, int nid)
  77. {
  78. return 0;
  79. }
  80. static inline void sysfs_remove_device_from_node(struct sys_device *dev,
  81. int nid)
  82. {
  83. }
  84. #endif /* CONFIG_NUMA */
  85. #include <asm-generic/topology.h>
  86. #ifdef CONFIG_SMP
  87. #include <asm/cputable.h>
  88. #define smt_capable() (cpu_has_feature(CPU_FTR_SMT))
  89. #ifdef CONFIG_PPC64
  90. #include <asm/smp.h>
  91. #define topology_thread_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu))
  92. #define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu))
  93. #define topology_core_id(cpu) (cpu_to_core_id(cpu))
  94. #endif
  95. #endif
  96. #endif /* __KERNEL__ */
  97. #endif /* _ASM_POWERPC_TOPOLOGY_H */