sd_flags.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * sched-domains (multiprocessor balancing) flag declarations.
  4. */
  5. #ifndef SD_FLAG
  6. # error "Incorrect import of SD flags definitions"
  7. #endif
  8. /*
  9. * Hierarchical metaflags
  10. *
  11. * SHARED_CHILD: These flags are meant to be set from the base domain upwards.
  12. * If a domain has this flag set, all of its children should have it set. This
  13. * is usually because the flag describes some shared resource (all CPUs in that
  14. * domain share the same resource), or because they are tied to a scheduling
  15. * behaviour that we want to disable at some point in the hierarchy for
  16. * scalability reasons.
  17. *
  18. * In those cases it doesn't make sense to have the flag set for a domain but
  19. * not have it in (some of) its children: sched domains ALWAYS span their child
  20. * domains, so operations done with parent domains will cover CPUs in the lower
  21. * child domains.
  22. *
  23. *
  24. * SHARED_PARENT: These flags are meant to be set from the highest domain
  25. * downwards. If a domain has this flag set, all of its parents should have it
  26. * set. This is usually for topology properties that start to appear above a
  27. * certain level (e.g. domain starts spanning CPUs outside of the base CPU's
  28. * socket).
  29. */
  30. #define SDF_SHARED_CHILD 0x1
  31. #define SDF_SHARED_PARENT 0x2
  32. /*
  33. * Behavioural metaflags
  34. *
  35. * NEEDS_GROUPS: These flags are only relevant if the domain they are set on has
  36. * more than one group. This is usually for balancing flags (load balancing
  37. * involves equalizing a metric between groups), or for flags describing some
  38. * shared resource (which would be shared between groups).
  39. */
  40. #define SDF_NEEDS_GROUPS 0x4
  41. /*
  42. * Balance when about to become idle
  43. *
  44. * SHARED_CHILD: Set from the base domain up to cpuset.sched_relax_domain_level.
  45. * NEEDS_GROUPS: Load balancing flag.
  46. */
  47. SD_FLAG(SD_BALANCE_NEWIDLE, SDF_SHARED_CHILD | SDF_NEEDS_GROUPS)
  48. /*
  49. * Balance on exec
  50. *
  51. * SHARED_CHILD: Set from the base domain up to the NUMA reclaim level.
  52. * NEEDS_GROUPS: Load balancing flag.
  53. */
  54. SD_FLAG(SD_BALANCE_EXEC, SDF_SHARED_CHILD | SDF_NEEDS_GROUPS)
  55. /*
  56. * Balance on fork, clone
  57. *
  58. * SHARED_CHILD: Set from the base domain up to the NUMA reclaim level.
  59. * NEEDS_GROUPS: Load balancing flag.
  60. */
  61. SD_FLAG(SD_BALANCE_FORK, SDF_SHARED_CHILD | SDF_NEEDS_GROUPS)
  62. /*
  63. * Balance on wakeup
  64. *
  65. * SHARED_CHILD: Set from the base domain up to cpuset.sched_relax_domain_level.
  66. * NEEDS_GROUPS: Load balancing flag.
  67. */
  68. SD_FLAG(SD_BALANCE_WAKE, SDF_SHARED_CHILD | SDF_NEEDS_GROUPS)
  69. /*
  70. * Consider waking task on waking CPU.
  71. *
  72. * SHARED_CHILD: Set from the base domain up to the NUMA reclaim level.
  73. */
  74. SD_FLAG(SD_WAKE_AFFINE, SDF_SHARED_CHILD)
  75. /*
  76. * Domain members have different CPU capacities
  77. *
  78. * SHARED_PARENT: Set from the topmost domain down to the first domain where
  79. * asymmetry is detected.
  80. * NEEDS_GROUPS: Per-CPU capacity is asymmetric between groups.
  81. */
  82. SD_FLAG(SD_ASYM_CPUCAPACITY, SDF_SHARED_PARENT | SDF_NEEDS_GROUPS)
  83. /*
  84. * Domain members share CPU capacity (i.e. SMT)
  85. *
  86. * SHARED_CHILD: Set from the base domain up until spanned CPUs no longer share
  87. * CPU capacity.
  88. * NEEDS_GROUPS: Capacity is shared between groups.
  89. */
  90. SD_FLAG(SD_SHARE_CPUCAPACITY, SDF_SHARED_CHILD | SDF_NEEDS_GROUPS)
  91. /*
  92. * Domain members share CPU package resources (i.e. caches)
  93. *
  94. * SHARED_CHILD: Set from the base domain up until spanned CPUs no longer share
  95. * the same cache(s).
  96. * NEEDS_GROUPS: Caches are shared between groups.
  97. */
  98. SD_FLAG(SD_SHARE_PKG_RESOURCES, SDF_SHARED_CHILD | SDF_NEEDS_GROUPS)
  99. /*
  100. * Only a single load balancing instance
  101. *
  102. * SHARED_PARENT: Set for all NUMA levels above NODE. Could be set from a
  103. * different level upwards, but it doesn't change that if a
  104. * domain has this flag set, then all of its parents need to have
  105. * it too (otherwise the serialization doesn't make sense).
  106. * NEEDS_GROUPS: No point in preserving domain if it has a single group.
  107. */
  108. SD_FLAG(SD_SERIALIZE, SDF_SHARED_PARENT | SDF_NEEDS_GROUPS)
  109. /*
  110. * Place busy tasks earlier in the domain
  111. *
  112. * SHARED_CHILD: Usually set on the SMT level. Technically could be set further
  113. * up, but currently assumed to be set from the base domain
  114. * upwards (see update_top_cache_domain()).
  115. * NEEDS_GROUPS: Load balancing flag.
  116. */
  117. SD_FLAG(SD_ASYM_PACKING, SDF_SHARED_CHILD | SDF_NEEDS_GROUPS)
  118. /*
  119. * Prefer to place tasks in a sibling domain
  120. *
  121. * Set up until domains start spanning NUMA nodes. Close to being a SHARED_CHILD
  122. * flag, but cleared below domains with SD_ASYM_CPUCAPACITY.
  123. *
  124. * NEEDS_GROUPS: Load balancing flag.
  125. */
  126. SD_FLAG(SD_PREFER_SIBLING, SDF_NEEDS_GROUPS)
  127. /*
  128. * sched_groups of this level overlap
  129. *
  130. * SHARED_PARENT: Set for all NUMA levels above NODE.
  131. * NEEDS_GROUPS: Overlaps can only exist with more than one group.
  132. */
  133. SD_FLAG(SD_OVERLAP, SDF_SHARED_PARENT | SDF_NEEDS_GROUPS)
  134. /*
  135. * Cross-node balancing
  136. *
  137. * SHARED_PARENT: Set for all NUMA levels above NODE.
  138. * NEEDS_GROUPS: No point in preserving domain if it has a single group.
  139. */
  140. SD_FLAG(SD_NUMA, SDF_SHARED_PARENT | SDF_NEEDS_GROUPS)