Skip to content

Commit fd7a6d2

Browse files
committed
Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull scheduler fixes from Ingo Molnar: "Misc fixes: a (rare) PSI crash fix, a CPU affinity related balancing fix, and a toning down of active migration attempts" * 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: sched/cfs: fix spurious active migration sched/fair: Fix find_idlest_group() to handle CPU affinity psi: Fix a division error in psi poll() sched/psi: Fix sampling error and rare div0 crashes with cgroups and high uptime
2 parents c4ff10e + 6cf82d5 commit fd7a6d2

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

kernel/sched/fair.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7328,7 +7328,14 @@ static int detach_tasks(struct lb_env *env)
73287328
load < 16 && !env->sd->nr_balance_failed)
73297329
goto next;
73307330

7331-
if (load/2 > env->imbalance)
7331+
/*
7332+
* Make sure that we don't migrate too much load.
7333+
* Nevertheless, let relax the constraint if
7334+
* scheduler fails to find a good waiting task to
7335+
* migrate.
7336+
*/
7337+
if (load/2 > env->imbalance &&
7338+
env->sd->nr_balance_failed <= env->sd->cache_nice_tries)
73327339
goto next;
73337340

73347341
env->imbalance -= load;
@@ -8417,6 +8424,10 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p,
84178424
if (!idlest)
84188425
return NULL;
84198426

8427+
/* The local group has been skipped because of CPU affinity */
8428+
if (!local)
8429+
return idlest;
8430+
84208431
/*
84218432
* If the local group is idler than the selected idlest group
84228433
* don't try and push the task.

kernel/sched/psi.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ static void group_init(struct psi_group *group)
185185

186186
for_each_possible_cpu(cpu)
187187
seqcount_init(&per_cpu_ptr(group->pcpu, cpu)->seq);
188-
group->avg_next_update = sched_clock() + psi_period;
188+
group->avg_last_update = sched_clock();
189+
group->avg_next_update = group->avg_last_update + psi_period;
189190
INIT_DELAYED_WORK(&group->avgs_work, psi_avgs_work);
190191
mutex_init(&group->avgs_lock);
191192
/* Init trigger-related members */
@@ -481,7 +482,7 @@ static u64 window_update(struct psi_window *win, u64 now, u64 value)
481482
u32 remaining;
482483

483484
remaining = win->size - elapsed;
484-
growth += div_u64(win->prev_growth * remaining, win->size);
485+
growth += div64_u64(win->prev_growth * remaining, win->size);
485486
}
486487

487488
return growth;

0 commit comments

Comments
 (0)