topology.h
上传用户:szlgq88
上传日期:2009-04-28
资源大小:48287k
文件大小:5k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /*
  2.  * include/linux/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 _LINUX_TOPOLOGY_H
  28. #define _LINUX_TOPOLOGY_H
  29. #include <linux/cpumask.h>
  30. #include <linux/bitops.h>
  31. #include <linux/mmzone.h>
  32. #include <linux/smp.h>
  33. #include <asm/topology.h>
  34. #ifndef node_has_online_mem
  35. #define node_has_online_mem(nid) (1)
  36. #endif
  37. #ifndef nr_cpus_node
  38. #define nr_cpus_node(node)
  39. ({
  40. cpumask_t __tmp__;
  41. __tmp__ = node_to_cpumask(node);
  42. cpus_weight(__tmp__);
  43. })
  44. #endif
  45. #define for_each_node_with_cpus(node)
  46. for_each_online_node(node)
  47. if (nr_cpus_node(node))
  48. #ifndef node_distance
  49. /* Conform to ACPI 2.0 SLIT distance definitions */
  50. #define LOCAL_DISTANCE 10
  51. #define REMOTE_DISTANCE 20
  52. #define node_distance(from,to) ((from) == (to) ? LOCAL_DISTANCE : REMOTE_DISTANCE)
  53. #endif
  54. #ifndef PENALTY_FOR_NODE_WITH_CPUS
  55. #define PENALTY_FOR_NODE_WITH_CPUS (1)
  56. #endif
  57. /*
  58.  * Below are the 3 major initializers used in building sched_domains:
  59.  * SD_SIBLING_INIT, for SMT domains
  60.  * SD_CPU_INIT, for SMP domains
  61.  * SD_NODE_INIT, for NUMA domains
  62.  *
  63.  * Any architecture that cares to do any tuning to these values should do so
  64.  * by defining their own arch-specific initializer in include/asm/topology.h.
  65.  * A definition there will automagically override these default initializers
  66.  * and allow arch-specific performance tuning of sched_domains.
  67.  */
  68. #ifdef CONFIG_SCHED_SMT
  69. /* MCD - Do we really need this?  It is always on if CONFIG_SCHED_SMT is,
  70.  * so can't we drop this in favor of CONFIG_SCHED_SMT?
  71.  */
  72. #define ARCH_HAS_SCHED_WAKE_IDLE
  73. /* Common values for SMT siblings */
  74. #ifndef SD_SIBLING_INIT
  75. #define SD_SIBLING_INIT (struct sched_domain) {
  76. .span = CPU_MASK_NONE,
  77. .parent = NULL,
  78. .groups = NULL,
  79. .min_interval = 1,
  80. .max_interval = 2,
  81. .busy_factor = 8,
  82. .imbalance_pct = 110,
  83. .cache_hot_time = 0,
  84. .cache_nice_tries = 0,
  85. .per_cpu_gain = 25,
  86. .busy_idx = 0,
  87. .idle_idx = 0,
  88. .newidle_idx = 1,
  89. .wake_idx = 0,
  90. .forkexec_idx = 0,
  91. .flags = SD_LOAD_BALANCE
  92. | SD_BALANCE_NEWIDLE
  93. | SD_BALANCE_EXEC
  94. | SD_WAKE_AFFINE
  95. | SD_WAKE_IDLE
  96. | SD_SHARE_CPUPOWER,
  97. .last_balance = jiffies,
  98. .balance_interval = 1,
  99. .nr_balance_failed = 0,
  100. }
  101. #endif
  102. #endif /* CONFIG_SCHED_SMT */
  103. /* Common values for CPUs */
  104. #ifndef SD_CPU_INIT
  105. #define SD_CPU_INIT (struct sched_domain) {
  106. .span = CPU_MASK_NONE,
  107. .parent = NULL,
  108. .groups = NULL,
  109. .min_interval = 1,
  110. .max_interval = 4,
  111. .busy_factor = 64,
  112. .imbalance_pct = 125,
  113. .cache_hot_time = (5*1000000/2),
  114. .cache_nice_tries = 1,
  115. .per_cpu_gain = 100,
  116. .busy_idx = 2,
  117. .idle_idx = 1,
  118. .newidle_idx = 2,
  119. .wake_idx = 1,
  120. .forkexec_idx = 1,
  121. .flags = SD_LOAD_BALANCE
  122. | SD_BALANCE_NEWIDLE
  123. | SD_BALANCE_EXEC
  124. | SD_WAKE_AFFINE,
  125. .last_balance = jiffies,
  126. .balance_interval = 1,
  127. .nr_balance_failed = 0,
  128. }
  129. #endif
  130. /* sched_domains SD_ALLNODES_INIT for NUMA machines */
  131. #define SD_ALLNODES_INIT (struct sched_domain) {
  132. .span = CPU_MASK_NONE,
  133. .parent = NULL,
  134. .groups = NULL,
  135. .min_interval = 64,
  136. .max_interval = 64*num_online_cpus(),
  137. .busy_factor = 128,
  138. .imbalance_pct = 133,
  139. .cache_hot_time = (10*1000000),
  140. .cache_nice_tries = 1,
  141. .busy_idx = 3,
  142. .idle_idx = 3,
  143. .newidle_idx = 0, /* unused */
  144. .wake_idx = 0, /* unused */
  145. .forkexec_idx = 0, /* unused */
  146. .per_cpu_gain = 100,
  147. .flags = SD_LOAD_BALANCE,
  148. .last_balance = jiffies,
  149. .balance_interval = 64,
  150. .nr_balance_failed = 0,
  151. }
  152. #ifdef CONFIG_NUMA
  153. #ifndef SD_NODE_INIT
  154. #error Please define an appropriate SD_NODE_INIT in include/asm/topology.h!!!
  155. #endif
  156. #endif /* CONFIG_NUMA */
  157. #endif /* _LINUX_TOPOLOGY_H */