topology.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * Copyright (C) 2002, Erich Focht, NEC
  3. *
  4. * All rights reserved.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. */
  11. #ifndef _ASM_IA64_TOPOLOGY_H
  12. #define _ASM_IA64_TOPOLOGY_H
  13. #include <asm/acpi.h>
  14. #include <asm/numa.h>
  15. #include <asm/smp.h>
  16. #ifdef CONFIG_NUMA
  17. /* Nodes w/o CPUs are preferred for memory allocations, see build_zonelists */
  18. #define PENALTY_FOR_NODE_WITH_CPUS 255
  19. /*
  20. * Distance above which we begin to use zone reclaim
  21. */
  22. #define RECLAIM_DISTANCE 15
  23. /*
  24. * Returns the number of the node containing CPU 'cpu'
  25. */
  26. #define cpu_to_node(cpu) (int)(cpu_to_node_map[cpu])
  27. /*
  28. * Returns a bitmask of CPUs on Node 'node'.
  29. */
  30. #define node_to_cpumask(node) (node_to_cpu_mask[node])
  31. #define cpumask_of_node(node) (&node_to_cpu_mask[node])
  32. /*
  33. * Returns the number of the node containing Node 'nid'.
  34. * Not implemented here. Multi-level hierarchies detected with
  35. * the help of node_distance().
  36. */
  37. #define parent_node(nid) (nid)
  38. /*
  39. * Returns the number of the first CPU on Node 'node'.
  40. */
  41. #define node_to_first_cpu(node) (cpumask_first(cpumask_of_node(node)))
  42. /*
  43. * Determines the node for a given pci bus
  44. */
  45. #define pcibus_to_node(bus) PCI_CONTROLLER(bus)->node
  46. void build_cpu_to_node_map(void);
  47. #define SD_CPU_INIT (struct sched_domain) { \
  48. .parent = NULL, \
  49. .child = NULL, \
  50. .groups = NULL, \
  51. .min_interval = 1, \
  52. .max_interval = 4, \
  53. .busy_factor = 64, \
  54. .imbalance_pct = 125, \
  55. .cache_nice_tries = 2, \
  56. .busy_idx = 2, \
  57. .idle_idx = 1, \
  58. .newidle_idx = 2, \
  59. .wake_idx = 1, \
  60. .forkexec_idx = 1, \
  61. .flags = SD_LOAD_BALANCE \
  62. | SD_BALANCE_NEWIDLE \
  63. | SD_BALANCE_EXEC \
  64. | SD_WAKE_AFFINE, \
  65. .last_balance = jiffies, \
  66. .balance_interval = 1, \
  67. .nr_balance_failed = 0, \
  68. }
  69. /* sched_domains SD_NODE_INIT for IA64 NUMA machines */
  70. #define SD_NODE_INIT (struct sched_domain) { \
  71. .parent = NULL, \
  72. .child = NULL, \
  73. .groups = NULL, \
  74. .min_interval = 8, \
  75. .max_interval = 8*(min(num_online_cpus(), 32)), \
  76. .busy_factor = 64, \
  77. .imbalance_pct = 125, \
  78. .cache_nice_tries = 2, \
  79. .busy_idx = 3, \
  80. .idle_idx = 2, \
  81. .newidle_idx = 2, \
  82. .wake_idx = 1, \
  83. .forkexec_idx = 1, \
  84. .flags = SD_LOAD_BALANCE \
  85. | SD_BALANCE_EXEC \
  86. | SD_BALANCE_FORK \
  87. | SD_SERIALIZE \
  88. | SD_WAKE_BALANCE, \
  89. .last_balance = jiffies, \
  90. .balance_interval = 64, \
  91. .nr_balance_failed = 0, \
  92. }
  93. #endif /* CONFIG_NUMA */
  94. #ifdef CONFIG_SMP
  95. #define topology_physical_package_id(cpu) (cpu_data(cpu)->socket_id)
  96. #define topology_core_id(cpu) (cpu_data(cpu)->core_id)
  97. #define topology_core_siblings(cpu) (cpu_core_map[cpu])
  98. #define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu))
  99. #define topology_core_cpumask(cpu) (&cpu_core_map[cpu])
  100. #define topology_thread_cpumask(cpu) (&per_cpu(cpu_sibling_map, cpu))
  101. #define smt_capable() (smp_num_siblings > 1)
  102. #endif
  103. extern void arch_fix_phys_package_id(int num, u32 slot);
  104. #define pcibus_to_cpumask(bus) (pcibus_to_node(bus) == -1 ? \
  105. CPU_MASK_ALL : \
  106. node_to_cpumask(pcibus_to_node(bus)) \
  107. )
  108. #define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \
  109. cpu_all_mask : \
  110. cpumask_from_node(pcibus_to_node(bus)))
  111. #include <asm-generic/topology.h>
  112. #endif /* _ASM_IA64_TOPOLOGY_H */