History

sched/fair: Don't set LBF_ALL_PINNED unnecessarily

Setting LBF_ALL_PINNED during active load balance is only valid when there is only 1 running task on the rq otherwise this ends up increasing the balance interval whereas other tasks could migrate after the next interval once they become cache-cold as an example. LBF_ALL_PINNED flag is now always set it by default. It is then cleared when we find one task that can be pulled when calling detach_tasks() or during active migration.

Vincent Guittot committed 5 years ago

Commit 8a41dfc1 parent fc488ff1 file · +5 −2Browse files

Unified · Split

kernel/sched/fair.c+5−2
@@ -9639,6 +9639,8 @@ redo: · 9638 unmodified lines
96399639 env.src_rq = busiest;
96409640
96419641 ld_moved = 0;
9642+ /* Clear this flag as soon as we find a pullable task */
9643+ env.flags |= LBF_ALL_PINNED;
96429644 if (busiest->nr_running > 1) {
96439645 /*
96449646 * Attempt to move tasks. If find_busiest_group has found
@@ -9646,7 +9648,6 @@ redo: · 1 unmodified line
96469648 * still unbalanced. ld_moved simply stays zero, so it is
96479649 * correctly treated as an imbalance.
96489650 */
9649− env.flags |= LBF_ALL_PINNED;
96509651 env.loop_max = min(sysctl_sched_nr_migrate, busiest->nr_running);
96519652
96529653 more_balance:
@@ -9772,10 +9773,12 @@ more_balance: · 119 unmodified lines
97729773 if (!cpumask_test_cpu(this_cpu, busiest->curr->cpus_ptr)) {
97739774 raw_spin_unlock_irqrestore(&busiest->lock,
97749775 flags);
9775− env.flags |= LBF_ALL_PINNED;
97769776 goto out_one_pinned;
97779777 }
97789778
9779+ /* Record that we found at least one task that could run on this_cpu */
9780+ env.flags &= ~LBF_ALL_PINNED;
9781+
97799782 /*
97809783 * ->active_balance synchronizes accesses to
97819784 * ->active_balance_work. Once set, it's cleared

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