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

Commit fd3fc28d authored by Morten Rasmussen's avatar Morten Rasmussen Committed by Chris Redpath
Browse files

ANDROID: sched: Add per-cpu max capacity to sched_group_capacity



struct sched_group_capacity currently represents the compute capacity
sum of all cpus in the sched_group. Unless it is divided by the
group_weight to get the average capacity per cpu it hides differences in
cpu capacity for mixed capacity systems (e.g. high RT/IRQ utilization or
ARM big.LITTLE). But even the average may not be sufficient if the group
covers cpus of different capacities. Instead, by extending struct
sched_group_capacity to indicate max per-cpu capacity in the group a
suitable group for a given task utilization can easily be found such
that cpus with reduced capacity can be avoided for tasks with high
utilization (not implemented by this patch).

Change-Id: I728335d721d14e0b1b1921cbf73734c9f75b9bf6
Signed-off-by: default avatarMorten Rasmussen <morten.rasmussen@arm.com>
Signed-off-by: default avatarChris Redpath <chris.redpath@arm.com>
parent f1f7125e
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -7722,7 +7722,7 @@ void update_group_capacity(struct sched_domain *sd, int cpu)
{
	struct sched_domain *child = sd->child;
	struct sched_group *group, *sdg = sd->groups;
	unsigned long capacity, min_capacity;
	unsigned long capacity, min_capacity, max_capacity;
	unsigned long interval;

	interval = msecs_to_jiffies(sd->balance_interval);
@@ -7736,6 +7736,7 @@ void update_group_capacity(struct sched_domain *sd, int cpu)

	capacity = 0;
	min_capacity = ULONG_MAX;
	max_capacity = 0;

	if (child->flags & SD_OVERLAP) {
		/*
@@ -7766,6 +7767,7 @@ void update_group_capacity(struct sched_domain *sd, int cpu)
			}

			min_capacity = min(capacity, min_capacity);
			max_capacity = max(capacity, max_capacity);
		}
	} else  {
		/*
@@ -7779,12 +7781,14 @@ void update_group_capacity(struct sched_domain *sd, int cpu)

			capacity += sgc->capacity;
			min_capacity = min(sgc->min_capacity, min_capacity);
			max_capacity = max(sgc->max_capacity, max_capacity);
			group = group->next;
		} while (group != child->groups);
	}

	sdg->sgc->capacity = capacity;
	sdg->sgc->min_capacity = min_capacity;
	sdg->sgc->max_capacity = max_capacity;
}

/*
+1 −0
Original line number Diff line number Diff line
@@ -1073,6 +1073,7 @@ struct sched_group_capacity {
	 */
	unsigned long capacity;
	unsigned long min_capacity; /* Min per-CPU capacity in group */
	unsigned long max_capacity; /* Max per-CPU capacity in group */
	unsigned long next_update;
	int imbalance; /* XXX unrelated to capacity but shared group state */

+1 −0
Original line number Diff line number Diff line
@@ -716,6 +716,7 @@ static void init_overlap_sched_group(struct sched_domain *sd,
	sg_span = sched_group_span(sg);
	sg->sgc->capacity = SCHED_CAPACITY_SCALE * cpumask_weight(sg_span);
	sg->sgc->min_capacity = SCHED_CAPACITY_SCALE;
	sg->sgc->max_capacity = SCHED_CAPACITY_SCALE;
}

static int