topology.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. * Copyright 2010 Tilera Corporation. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation, version 2.
  7. *
  8. * This program is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  11. * NON INFRINGEMENT. See the GNU General Public License for
  12. * more details.
  13. */
  14. #ifndef _ASM_TILE_TOPOLOGY_H
  15. #define _ASM_TILE_TOPOLOGY_H
  16. #ifdef CONFIG_NUMA
  17. #include <linux/cpumask.h>
  18. /* Mappings between logical cpu number and node number. */
  19. extern struct cpumask node_2_cpu_mask[];
  20. extern char cpu_2_node[];
  21. /* Returns the number of the node containing CPU 'cpu'. */
  22. static inline int cpu_to_node(int cpu)
  23. {
  24. return cpu_2_node[cpu];
  25. }
  26. /*
  27. * Returns the number of the node containing Node 'node'.
  28. * This architecture is flat, so it is a pretty simple function!
  29. */
  30. #define parent_node(node) (node)
  31. /* Returns a bitmask of CPUs on Node 'node'. */
  32. static inline const struct cpumask *cpumask_of_node(int node)
  33. {
  34. return &node_2_cpu_mask[node];
  35. }
  36. /* For now, use numa node -1 for global allocation. */
  37. #define pcibus_to_node(bus) ((void)(bus), -1)
  38. /*
  39. * TILE architecture has many cores integrated in one processor, so we need
  40. * setup bigger balance_interval for both CPU/NODE scheduling domains to
  41. * reduce process scheduling costs.
  42. */
  43. /* sched_domains SD_CPU_INIT for TILE architecture */
  44. #define SD_CPU_INIT (struct sched_domain) { \
  45. .min_interval = 4, \
  46. .max_interval = 128, \
  47. .busy_factor = 64, \
  48. .imbalance_pct = 125, \
  49. .cache_nice_tries = 1, \
  50. .busy_idx = 2, \
  51. .idle_idx = 1, \
  52. .newidle_idx = 0, \
  53. .wake_idx = 0, \
  54. .forkexec_idx = 0, \
  55. \
  56. .flags = 1*SD_LOAD_BALANCE \
  57. | 1*SD_BALANCE_NEWIDLE \
  58. | 1*SD_BALANCE_EXEC \
  59. | 1*SD_BALANCE_FORK \
  60. | 0*SD_BALANCE_WAKE \
  61. | 0*SD_WAKE_AFFINE \
  62. | 0*SD_PREFER_LOCAL \
  63. | 0*SD_SHARE_CPUPOWER \
  64. | 0*SD_SHARE_PKG_RESOURCES \
  65. | 0*SD_SERIALIZE \
  66. , \
  67. .last_balance = jiffies, \
  68. .balance_interval = 32, \
  69. }
  70. /* sched_domains SD_NODE_INIT for TILE architecture */
  71. #define SD_NODE_INIT (struct sched_domain) { \
  72. .min_interval = 16, \
  73. .max_interval = 512, \
  74. .busy_factor = 32, \
  75. .imbalance_pct = 125, \
  76. .cache_nice_tries = 1, \
  77. .busy_idx = 3, \
  78. .idle_idx = 1, \
  79. .newidle_idx = 2, \
  80. .wake_idx = 1, \
  81. .flags = 1*SD_LOAD_BALANCE \
  82. | 1*SD_BALANCE_NEWIDLE \
  83. | 1*SD_BALANCE_EXEC \
  84. | 1*SD_BALANCE_FORK \
  85. | 0*SD_BALANCE_WAKE \
  86. | 0*SD_WAKE_AFFINE \
  87. | 0*SD_PREFER_LOCAL \
  88. | 0*SD_SHARE_CPUPOWER \
  89. | 0*SD_SHARE_PKG_RESOURCES \
  90. | 1*SD_SERIALIZE \
  91. , \
  92. .last_balance = jiffies, \
  93. .balance_interval = 128, \
  94. }
  95. /* By definition, we create nodes based on online memory. */
  96. #define node_has_online_mem(nid) 1
  97. #endif /* CONFIG_NUMA */
  98. #include <asm-generic/topology.h>
  99. #ifdef CONFIG_SMP
  100. #define topology_physical_package_id(cpu) ((void)(cpu), 0)
  101. #define topology_core_id(cpu) (cpu)
  102. #define topology_core_cpumask(cpu) ((void)(cpu), cpu_online_mask)
  103. #define topology_thread_cpumask(cpu) cpumask_of(cpu)
  104. /* indicates that pointers to the topology struct cpumask maps are valid */
  105. #define arch_provides_topology_pointers yes
  106. #endif
  107. #endif /* _ASM_TILE_TOPOLOGY_H */