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

Showing the changes to kernel (2 of 2 files). Show all

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
6649 6649
6650 rcu_read_lock();6650 rcu_read_lock();
6651 for_each_domain(cpu, tmp) {6651 for_each_domain(cpu, tmp) {
6652 if (!(tmp->flags & SD_LOAD_BALANCE))
6653 break;
6654
6655 /*6652 /*
6656 * If both 'cpu' and 'prev_cpu' are part of this domain,6653 * If both 'cpu' and 'prev_cpu' are part of this domain,
6657 * cpu is a valid SD_WAKE_AFFINE target.6654 * cpu is a valid SD_WAKE_AFFINE target.
@@ -9790,9 +9787,8 @@ static int active_load_balance_cpu_stop(void *data) · 3132 unmodified lines
9790 /* Search for an sd spanning us and the target CPU. */9787 /* Search for an sd spanning us and the target CPU. */
9791 rcu_read_lock();9788 rcu_read_lock();
9792 for_each_domain(target_cpu, sd) {9789 for_each_domain(target_cpu, sd) {
9793 if ((sd->flags & SD_LOAD_BALANCE) &&9790 if (cpumask_test_cpu(busiest_cpu, sched_domain_span(sd)))
9794 cpumask_test_cpu(busiest_cpu, sched_domain_span(sd)))9791 break;
9795 break;
9796 }9792 }
9797 9793
9798 if (likely(sd)) {9794 if (likely(sd)) {
@@ -9881,9 +9877,6 @@ static void rebalance_domains(struct rq *rq, enum cpu_idle_type idle) · 82 unmodified lines
9881 }9877 }
9882 max_cost += sd->max_newidle_lb_cost;9878 max_cost += sd->max_newidle_lb_cost;
9883 9879
9884 if (!(sd->flags & SD_LOAD_BALANCE))
9885 continue;
9886
9887 /*9880 /*
9888 * Stop the load balance at this level. There is another9881 * Stop the load balance at this level. There is another
9889 * CPU in our sched group which is doing load balancing more9882 * 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
10472 int continue_balancing = 1;10465 int continue_balancing = 1;
10473 u64 t0, domain_cost;10466 u64 t0, domain_cost;
10474 10467
10475 if (!(sd->flags & SD_LOAD_BALANCE))
10476 continue;
10477
10478 if (this_rq->avg_idle < curr_cost + sd->max_newidle_lb_cost) {10468 if (this_rq->avg_idle < curr_cost + sd->max_newidle_lb_cost) {
10479 update_next_balance(sd, &next_balance);10469 update_next_balance(sd, &next_balance);
10480 break;10470 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
33 cpumask_clear(groupmask);33 cpumask_clear(groupmask);
34 34
35 printk(KERN_DEBUG "%*s domain-%d: ", level, "", level);35 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
44 printk(KERN_CONT "span=%*pbl level=%s\n",36 printk(KERN_CONT "span=%*pbl level=%s\n",
45 cpumask_pr_args(sched_domain_span(sd)), sd->name);37 cpumask_pr_args(sched_domain_span(sd)), sd->name);
46 38
@@ -151,8 +143,7 @@ static int sd_degenerate(struct sched_domain *sd) · 104 unmodified lines
151 return 1;143 return 1;
152 144
153 /* Following flags need at least 2 groups */145 /* Following flags need at least 2 groups */
154 if (sd->flags & (SD_LOAD_BALANCE |146 if (sd->flags & (SD_BALANCE_NEWIDLE |
155 SD_BALANCE_NEWIDLE |
156 SD_BALANCE_FORK |147 SD_BALANCE_FORK |
157 SD_BALANCE_EXEC |148 SD_BALANCE_EXEC |
158 SD_SHARE_CPUCAPACITY |149 SD_SHARE_CPUCAPACITY |
@@ -183,15 +174,14 @@ sd_parent_degenerate(struct sched_domain *sd, struct sched_domain *parent) · 24 unmodified lines
183 174
184 /* Flags needing groups don't count if only 1 group in parent */175 /* Flags needing groups don't count if only 1 group in parent */
185 if (parent->groups == parent->groups->next) {176 if (parent->groups == parent->groups->next) {
186 pflags &= ~(SD_LOAD_BALANCE |177 pflags &= ~(SD_BALANCE_NEWIDLE |
187 SD_BALANCE_NEWIDLE |178 SD_BALANCE_FORK |
188 SD_BALANCE_FORK |179 SD_BALANCE_EXEC |
189 SD_BALANCE_EXEC |180 SD_ASYM_CPUCAPACITY |
190 SD_ASYM_CPUCAPACITY |181 SD_SHARE_CPUCAPACITY |
191 SD_SHARE_CPUCAPACITY |182 SD_SHARE_PKG_RESOURCES |
192 SD_SHARE_PKG_RESOURCES |183 SD_PREFER_SIBLING |
193 SD_PREFER_SIBLING |184 SD_SHARE_POWERDOMAIN);
194 SD_SHARE_POWERDOMAIN);
195 if (nr_node_ids == 1)185 if (nr_node_ids == 1)
196 pflags &= ~SD_SERIALIZE;186 pflags &= ~SD_SERIALIZE;
197 }187 }

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