topology.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef _ASM_X86_64_TOPOLOGY_H
  2. #define _ASM_X86_64_TOPOLOGY_H
  3. #ifdef CONFIG_NUMA
  4. #include <asm/mpspec.h>
  5. #include <asm/bitops.h>
  6. extern cpumask_t cpu_online_map;
  7. extern unsigned char cpu_to_node[];
  8. extern cpumask_t node_to_cpumask[];
  9. #ifdef CONFIG_ACPI_NUMA
  10. extern int __node_distance(int, int);
  11. #define node_distance(a,b) __node_distance(a,b)
  12. /* #else fallback version */
  13. #endif
  14. #define cpu_to_node(cpu) (cpu_to_node[cpu])
  15. #define parent_node(node) (node)
  16. #define node_to_first_cpu(node) (first_cpu(node_to_cpumask[node]))
  17. #define node_to_cpumask(node) (node_to_cpumask[node])
  18. #define pcibus_to_node(bus) ((long)(bus->sysdata))
  19. #define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus));
  20. #define numa_node_id() read_pda(nodenumber)
  21. /* sched_domains SD_NODE_INIT for x86_64 machines */
  22. #define SD_NODE_INIT (struct sched_domain) { \
  23. .span = CPU_MASK_NONE, \
  24. .parent = NULL, \
  25. .child = NULL, \
  26. .groups = NULL, \
  27. .min_interval = 8, \
  28. .max_interval = 32, \
  29. .busy_factor = 32, \
  30. .imbalance_pct = 125, \
  31. .cache_nice_tries = 2, \
  32. .busy_idx = 3, \
  33. .idle_idx = 2, \
  34. .newidle_idx = 0, \
  35. .wake_idx = 1, \
  36. .forkexec_idx = 1, \
  37. .per_cpu_gain = 100, \
  38. .flags = SD_LOAD_BALANCE \
  39. | SD_BALANCE_FORK \
  40. | SD_BALANCE_EXEC \
  41. | SD_WAKE_BALANCE, \
  42. .last_balance = jiffies, \
  43. .balance_interval = 1, \
  44. .nr_balance_failed = 0, \
  45. }
  46. #endif
  47. #ifdef CONFIG_SMP
  48. #define topology_physical_package_id(cpu) (cpu_data[cpu].phys_proc_id)
  49. #define topology_core_id(cpu) (cpu_data[cpu].cpu_core_id)
  50. #define topology_core_siblings(cpu) (cpu_core_map[cpu])
  51. #define topology_thread_siblings(cpu) (cpu_sibling_map[cpu])
  52. #define mc_capable() (boot_cpu_data.x86_max_cores > 1)
  53. #define smt_capable() (smp_num_siblings > 1)
  54. #endif
  55. #include <asm-generic/topology.h>
  56. extern cpumask_t cpu_coregroup_map(int cpu);
  57. #endif