Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a428455e authored by Pavankumar Kondeti's avatar Pavankumar Kondeti Committed by Gerrit - the friendly Code Review server
Browse files

sched/fair: Add timeout for detach_tasks() in load balance



When the busy CPU has thousands of tasks, the current loop break
of 32 does not scale nicely. Because each task deactivation may
take ~5 msec. Since this all happens from interrupts disabled
(from softirq also), it is resulting in watchdog bark. Hence
add 5 msec timeout in detach_tasks() to abort the load balance.

Change-Id: I290f75076f13a44d866dc4fe5fe6653733d28fbc
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
parent 3a5a6747
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -8848,17 +8848,21 @@ static int detach_tasks(struct lb_env *env)
	unsigned long load = 0;
	int detached = 0;
	int orig_loop = env->loop;
	u64 start_t = rq_clock(env->src_rq);

	lockdep_assert_held(&env->src_rq->lock);

	if (env->imbalance <= 0)
		return 0;

	if (env->src_rq->nr_running < 32) {
		if (!same_cluster(env->dst_cpu, env->src_cpu))
			env->flags |= LBF_IGNORE_PREFERRED_CLUSTER_TASKS;

	if (capacity_orig_of(env->dst_cpu) < capacity_orig_of(env->src_cpu))
		if (capacity_orig_of(env->dst_cpu) <
				capacity_orig_of(env->src_cpu))
			env->flags |= LBF_IGNORE_BIG_TASKS;
	}

redo:
	while (!list_empty(tasks)) {
@@ -8876,6 +8880,10 @@ static int detach_tasks(struct lb_env *env)
		if (env->loop > env->loop_max)
			break;

		/* Abort the loop, if we spent more than 5 msec */
		if (rq_clock(env->src_rq) - start_t > 5000000)
			break;

		/* take a breather every nr_migrate tasks */
		if (env->loop > env->loop_break) {
			env->loop_break += sched_nr_migrate_break;