topology.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. /*
  32. * Returns the number of the node containing Node 'nid'.
  33. * Not implemented here. Multi-level hierarchies detected with
  34. * the help of node_distance().
  35. */
  36. #define parent_node(nid) (nid)
  37. /*
  38. * Returns the number of the first CPU on Node 'node'.
  39. */
  40. #define node_to_first_cpu(node) (first_cpu(node_to_cpumask(node)))
  41. /*
  42. * Determines the node for a given pci bus
  43. */
  44. #define pcibus_to_node(bus) PCI_CONTROLLER(bus)->node
  45. void build_cpu_to_node_map(void);
  46. #define SD_CPU_INIT (struct sched_domain) { \
  47. .span = CPU_MASK_NONE, \
  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. .span = CPU_MASK_NONE, \
  72. .parent = NULL, \
  73. .child = NULL, \
  74. .groups = NULL, \
  75. .min_interval = 8, \
  76. .max_interval = 8*(min(num_online_cpus(), 32)), \
  77. .busy_factor = 64, \
  78. .imbalance_pct = 125, \
  79. .cache_nice_tries = 2, \
  80. .busy_idx = 3, \
  81. .idle_idx = 2, \
  82. .newidle_idx = 2, \
  83. .wake_idx = 1, \
  84. .forkexec_idx = 1, \
  85. .flags = SD_LOAD_BALANCE \
  86. | SD_BALANCE_EXEC \
  87. | SD_BALANCE_FORK \
  88. | SD_SERIALIZE \
  89. | SD_WAKE_BALANCE, \
  90. .last_balance = jiffies, \
  91. .balance_interval = 64, \
  92. .nr_balance_failed = 0, \
  93. }
  94. #endif /* CONFIG_NUMA */
  95. #ifdef CONFIG_SMP
  96. #define topology_physical_package_id(cpu) (cpu_data(cpu)->socket_id)
  97. #define topology_core_id(cpu) (cpu_data(cpu)->core_id)
  98. #define topology_core_siblings(cpu) (cpu_core_map[cpu])
  99. #define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu))
  100. #define smt_capable() (smp_num_siblings > 1)
  101. #endif
  102. extern void arch_fix_phys_package_id(int num, u32 slot);
  103. #define pcibus_to_cpumask(bus) (pcibus_to_node(bus) == -1 ? \
  104. CPU_MASK_ALL : \
  105. node_to_cpumask(pcibus_to_node(bus)) \
  106. )
  107. #include <asm-generic/topology.h>
  108. #endif /* _ASM_IA64_TOPOLOGY_H */