Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * sched-domains (multiprocessor balancing) flag declarations.
0004  */
0005 
0006 #ifndef SD_FLAG
0007 # error "Incorrect import of SD flags definitions"
0008 #endif
0009 
0010 /*
0011  * Hierarchical metaflags
0012  *
0013  * SHARED_CHILD: These flags are meant to be set from the base domain upwards.
0014  * If a domain has this flag set, all of its children should have it set. This
0015  * is usually because the flag describes some shared resource (all CPUs in that
0016  * domain share the same resource), or because they are tied to a scheduling
0017  * behaviour that we want to disable at some point in the hierarchy for
0018  * scalability reasons.
0019  *
0020  * In those cases it doesn't make sense to have the flag set for a domain but
0021  * not have it in (some of) its children: sched domains ALWAYS span their child
0022  * domains, so operations done with parent domains will cover CPUs in the lower
0023  * child domains.
0024  *
0025  *
0026  * SHARED_PARENT: These flags are meant to be set from the highest domain
0027  * downwards. If a domain has this flag set, all of its parents should have it
0028  * set. This is usually for topology properties that start to appear above a
0029  * certain level (e.g. domain starts spanning CPUs outside of the base CPU's
0030  * socket).
0031  */
0032 #define SDF_SHARED_CHILD       0x1
0033 #define SDF_SHARED_PARENT      0x2
0034 
0035 /*
0036  * Behavioural metaflags
0037  *
0038  * NEEDS_GROUPS: These flags are only relevant if the domain they are set on has
0039  * more than one group. This is usually for balancing flags (load balancing
0040  * involves equalizing a metric between groups), or for flags describing some
0041  * shared resource (which would be shared between groups).
0042  */
0043 #define SDF_NEEDS_GROUPS       0x4
0044 
0045 /*
0046  * Balance when about to become idle
0047  *
0048  * SHARED_CHILD: Set from the base domain up to cpuset.sched_relax_domain_level.
0049  * NEEDS_GROUPS: Load balancing flag.
0050  */
0051 SD_FLAG(SD_BALANCE_NEWIDLE, SDF_SHARED_CHILD | SDF_NEEDS_GROUPS)
0052 
0053 /*
0054  * Balance on exec
0055  *
0056  * SHARED_CHILD: Set from the base domain up to the NUMA reclaim level.
0057  * NEEDS_GROUPS: Load balancing flag.
0058  */
0059 SD_FLAG(SD_BALANCE_EXEC, SDF_SHARED_CHILD | SDF_NEEDS_GROUPS)
0060 
0061 /*
0062  * Balance on fork, clone
0063  *
0064  * SHARED_CHILD: Set from the base domain up to the NUMA reclaim level.
0065  * NEEDS_GROUPS: Load balancing flag.
0066  */
0067 SD_FLAG(SD_BALANCE_FORK, SDF_SHARED_CHILD | SDF_NEEDS_GROUPS)
0068 
0069 /*
0070  * Balance on wakeup
0071  *
0072  * SHARED_CHILD: Set from the base domain up to cpuset.sched_relax_domain_level.
0073  * NEEDS_GROUPS: Load balancing flag.
0074  */
0075 SD_FLAG(SD_BALANCE_WAKE, SDF_SHARED_CHILD | SDF_NEEDS_GROUPS)
0076 
0077 /*
0078  * Consider waking task on waking CPU.
0079  *
0080  * SHARED_CHILD: Set from the base domain up to the NUMA reclaim level.
0081  */
0082 SD_FLAG(SD_WAKE_AFFINE, SDF_SHARED_CHILD)
0083 
0084 /*
0085  * Domain members have different CPU capacities
0086  *
0087  * SHARED_PARENT: Set from the topmost domain down to the first domain where
0088  *                asymmetry is detected.
0089  * NEEDS_GROUPS: Per-CPU capacity is asymmetric between groups.
0090  */
0091 SD_FLAG(SD_ASYM_CPUCAPACITY, SDF_SHARED_PARENT | SDF_NEEDS_GROUPS)
0092 
0093 /*
0094  * Domain members have different CPU capacities spanning all unique CPU
0095  * capacity values.
0096  *
0097  * SHARED_PARENT: Set from the topmost domain down to the first domain where
0098  *        all available CPU capacities are visible
0099  * NEEDS_GROUPS: Per-CPU capacity is asymmetric between groups.
0100  */
0101 SD_FLAG(SD_ASYM_CPUCAPACITY_FULL, SDF_SHARED_PARENT | SDF_NEEDS_GROUPS)
0102 
0103 /*
0104  * Domain members share CPU capacity (i.e. SMT)
0105  *
0106  * SHARED_CHILD: Set from the base domain up until spanned CPUs no longer share
0107  *               CPU capacity.
0108  * NEEDS_GROUPS: Capacity is shared between groups.
0109  */
0110 SD_FLAG(SD_SHARE_CPUCAPACITY, SDF_SHARED_CHILD | SDF_NEEDS_GROUPS)
0111 
0112 /*
0113  * Domain members share CPU package resources (i.e. caches)
0114  *
0115  * SHARED_CHILD: Set from the base domain up until spanned CPUs no longer share
0116  *               the same cache(s).
0117  * NEEDS_GROUPS: Caches are shared between groups.
0118  */
0119 SD_FLAG(SD_SHARE_PKG_RESOURCES, SDF_SHARED_CHILD | SDF_NEEDS_GROUPS)
0120 
0121 /*
0122  * Only a single load balancing instance
0123  *
0124  * SHARED_PARENT: Set for all NUMA levels above NODE. Could be set from a
0125  *                different level upwards, but it doesn't change that if a
0126  *                domain has this flag set, then all of its parents need to have
0127  *                it too (otherwise the serialization doesn't make sense).
0128  * NEEDS_GROUPS: No point in preserving domain if it has a single group.
0129  */
0130 SD_FLAG(SD_SERIALIZE, SDF_SHARED_PARENT | SDF_NEEDS_GROUPS)
0131 
0132 /*
0133  * Place busy tasks earlier in the domain
0134  *
0135  * SHARED_CHILD: Usually set on the SMT level. Technically could be set further
0136  *               up, but currently assumed to be set from the base domain
0137  *               upwards (see update_top_cache_domain()).
0138  * NEEDS_GROUPS: Load balancing flag.
0139  */
0140 SD_FLAG(SD_ASYM_PACKING, SDF_SHARED_CHILD | SDF_NEEDS_GROUPS)
0141 
0142 /*
0143  * Prefer to place tasks in a sibling domain
0144  *
0145  * Set up until domains start spanning NUMA nodes. Close to being a SHARED_CHILD
0146  * flag, but cleared below domains with SD_ASYM_CPUCAPACITY.
0147  *
0148  * NEEDS_GROUPS: Load balancing flag.
0149  */
0150 SD_FLAG(SD_PREFER_SIBLING, SDF_NEEDS_GROUPS)
0151 
0152 /*
0153  * sched_groups of this level overlap
0154  *
0155  * SHARED_PARENT: Set for all NUMA levels above NODE.
0156  * NEEDS_GROUPS: Overlaps can only exist with more than one group.
0157  */
0158 SD_FLAG(SD_OVERLAP, SDF_SHARED_PARENT | SDF_NEEDS_GROUPS)
0159 
0160 /*
0161  * Cross-node balancing
0162  *
0163  * SHARED_PARENT: Set for all NUMA levels above NODE.
0164  * NEEDS_GROUPS: No point in preserving domain if it has a single group.
0165  */
0166 SD_FLAG(SD_NUMA, SDF_SHARED_PARENT | SDF_NEEDS_GROUPS)