History

sched: Remove checks against SD_LOAD_BALANCE

The SD_LOAD_BALANCE flag is set unconditionally for all domains in sd_init(). By making the sched_domain->flags syctl interface read-only, we have removed the last piece of code that could clear that flag - as such, it will now be always present. Rather than to keep carrying it along, we can work towards getting rid of it entirely. cpusets don't need it because they can make CPUs be attached to the NULL domain (e.g. cpuset with sched_load_balance=0), or to a partitioned root_domain, i.e. a sched_domain hierarchy that doesn't span the entire system (e.g. root cpuset with sched_load_balance=0 and sibling cpusets with sched_load_balance=1). isolcpus apply the same "trick": isolated CPUs are explicitly taken out of the sched_domain rebuild (using housekeeping_cpumask()), so they get the NULL domain treatment as well. Remove the checks against SD_LOAD_BALANCE.

Valentin Schneider committed 6 years ago

Commit e669ac81 parent 98184272 files · +11 −31Browse files

Unified · Split

2 files
  1. kernel/sched/fair.c +2 −12
  2. kernel/sched/topology.c +9 −19
kernel/sched/fair.c+2−12
@@ -6649,9 +6649,6 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f · 6648 unmodified lines
66496649
66506650 rcu_read_lock();
66516651 for_each_domain(cpu, tmp) {
6652− if (!(tmp->flags & SD_LOAD_BALANCE))
6653− break;
6654−
66556652 /*
66566653 * If both 'cpu' and 'prev_cpu' are part of this domain,
66576654 * cpu is a valid SD_WAKE_AFFINE target.
@@ -9790,9 +9787,8 @@ static int active_load_balance_cpu_stop(void *data) · 3132 unmodified lines
97909787 /* Search for an sd spanning us and the target CPU. */
97919788 rcu_read_lock();
97929789 for_each_domain(target_cpu, sd) {
9793− if ((sd->flags & SD_LOAD_BALANCE) &&
9794− cpumask_test_cpu(busiest_cpu, sched_domain_span(sd)))
9795− break;
9790+ if (cpumask_test_cpu(busiest_cpu, sched_domain_span(sd)))
9791+ break;
97969792 }
97979793
97989794 if (likely(sd)) {
@@ -9881,9 +9877,6 @@ static void rebalance_domains(struct rq *rq, enum cpu_idle_type idle) · 82 unmodified lines
98819877 }
98829878 max_cost += sd->max_newidle_lb_cost;
98839879
9884− if (!(sd->flags & SD_LOAD_BALANCE))
9885− continue;
9886−
98879880 /*
98889881 * Stop the load balance at this level. There is another
98899882 * CPU in our sched group which is doing load balancing more
@@ -10472,9 +10465,6 @@ int newidle_balance(struct rq *this_rq, struct rq_flags *rf) · 582 unmodified lines
1047210465 int continue_balancing = 1;
1047310466 u64 t0, domain_cost;
1047410467
10475− if (!(sd->flags & SD_LOAD_BALANCE))
10476− continue;
10477−
1047810468 if (this_rq->avg_idle < curr_cost + sd->max_newidle_lb_cost) {
1047910469 update_next_balance(sd, &next_balance);
1048010470 break;
kernel/sched/topology.c+9−19
@@ -33,14 +33,6 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level, · 32 unmodified lines
3333 cpumask_clear(groupmask);
3434
3535 printk(KERN_DEBUG "%*s domain-%d: ", level, "", level);
36−
37− if (!(sd->flags & SD_LOAD_BALANCE)) {
38− printk("does not load-balance\n");
39− if (sd->parent)
40− printk(KERN_ERR "ERROR: !SD_LOAD_BALANCE domain has parent");
41− return -1;
42− }
43−
4436 printk(KERN_CONT "span=%*pbl level=%s\n",
4537 cpumask_pr_args(sched_domain_span(sd)), sd->name);
4638
@@ -151,8 +143,7 @@ static int sd_degenerate(struct sched_domain *sd) · 104 unmodified lines
151143 return 1;
152144
153145 /* Following flags need at least 2 groups */
154− if (sd->flags & (SD_LOAD_BALANCE |
155− SD_BALANCE_NEWIDLE |
146+ if (sd->flags & (SD_BALANCE_NEWIDLE |
156147 SD_BALANCE_FORK |
157148 SD_BALANCE_EXEC |
158149 SD_SHARE_CPUCAPACITY |
@@ -183,15 +174,14 @@ sd_parent_degenerate(struct sched_domain *sd, struct sched_domain *parent) · 24 unmodified lines
183174
184175 /* Flags needing groups don't count if only 1 group in parent */
185176 if (parent->groups == parent->groups->next) {
186− pflags &= ~(SD_LOAD_BALANCE |
187− SD_BALANCE_NEWIDLE |
188− SD_BALANCE_FORK |
189− SD_BALANCE_EXEC |
190− SD_ASYM_CPUCAPACITY |
191− SD_SHARE_CPUCAPACITY |
192− SD_SHARE_PKG_RESOURCES |
193− SD_PREFER_SIBLING |
194− SD_SHARE_POWERDOMAIN);
177+ pflags &= ~(SD_BALANCE_NEWIDLE |
178+ SD_BALANCE_FORK |
179+ SD_BALANCE_EXEC |
180+ SD_ASYM_CPUCAPACITY |
181+ SD_SHARE_CPUCAPACITY |
182+ SD_SHARE_PKG_RESOURCES |
183+ SD_PREFER_SIBLING |
184+ SD_SHARE_POWERDOMAIN);
195185 if (nr_node_ids == 1)
196186 pflags &= ~SD_SERIALIZE;
197187 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t