topology.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * linux/include/asm-i386/topology.h
  3. *
  4. * Written by: Matthew Dobson, IBM Corporation
  5. *
  6. * Copyright (C) 2002, IBM Corp.
  7. *
  8. * All rights reserved.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful, but
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  18. * NON INFRINGEMENT. See the GNU General Public License for more
  19. * details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24. *
  25. * Send feedback to <colpatch@us.ibm.com>
  26. */
  27. #ifndef _ASM_I386_TOPOLOGY_H
  28. #define _ASM_I386_TOPOLOGY_H
  29. #ifdef CONFIG_NUMA
  30. #include <asm/mpspec.h>
  31. #include <linux/cpumask.h>
  32. /* Mappings between logical cpu number and node number */
  33. extern cpumask_t node_2_cpu_mask[];
  34. extern int cpu_2_node[];
  35. /* Returns the number of the node containing CPU 'cpu' */
  36. static inline int cpu_to_node(int cpu)
  37. {
  38. return cpu_2_node[cpu];
  39. }
  40. /* Returns the number of the node containing Node 'node'. This architecture is flat,
  41. so it is a pretty simple function! */
  42. #define parent_node(node) (node)
  43. /* Returns a bitmask of CPUs on Node 'node'. */
  44. static inline cpumask_t node_to_cpumask(int node)
  45. {
  46. return node_2_cpu_mask[node];
  47. }
  48. /* Returns the number of the first CPU on Node 'node'. */
  49. static inline int node_to_first_cpu(int node)
  50. {
  51. cpumask_t mask = node_to_cpumask(node);
  52. return first_cpu(mask);
  53. }
  54. /* Returns the number of the node containing PCI bus number 'busnr' */
  55. static inline cpumask_t __pcibus_to_cpumask(int busnr)
  56. {
  57. return node_to_cpumask(mp_bus_id_to_node[busnr]);
  58. }
  59. #define pcibus_to_cpumask(bus) __pcibus_to_cpumask(bus->number)
  60. /* sched_domains SD_NODE_INIT for NUMAQ machines */
  61. #define SD_NODE_INIT (struct sched_domain) { \
  62. .span = CPU_MASK_NONE, \
  63. .parent = NULL, \
  64. .groups = NULL, \
  65. .min_interval = 8, \
  66. .max_interval = 32, \
  67. .busy_factor = 32, \
  68. .imbalance_pct = 125, \
  69. .cache_hot_time = (10*1000000), \
  70. .cache_nice_tries = 1, \
  71. .per_cpu_gain = 100, \
  72. .flags = SD_LOAD_BALANCE \
  73. | SD_BALANCE_EXEC \
  74. | SD_BALANCE_NEWIDLE \
  75. | SD_WAKE_IDLE \
  76. | SD_WAKE_BALANCE, \
  77. .last_balance = jiffies, \
  78. .balance_interval = 1, \
  79. .nr_balance_failed = 0, \
  80. }
  81. extern unsigned long node_start_pfn[];
  82. extern unsigned long node_end_pfn[];
  83. extern unsigned long node_remap_size[];
  84. #define node_has_online_mem(nid) (node_start_pfn[nid] != node_end_pfn[nid])
  85. #else /* !CONFIG_NUMA */
  86. /*
  87. * Other i386 platforms should define their own version of the
  88. * above macros here.
  89. */
  90. #include <asm-generic/topology.h>
  91. #endif /* CONFIG_NUMA */
  92. #endif /* _ASM_I386_TOPOLOGY_H */