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

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

core_ctl: Implement not_preferred hint strictly



Don't isolate CPUs other than not_preferred CPUs unless limits
(max_cpus) condition is not met. All CPUs are eligible for
isolation when there is no preference. This policy allows
not_preferred tunable to be used to specify which CPUs need to
be kept active.

Change-Id: I8110811143c2854450901f76c0949f0349c4eb62
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: default avatarSatya Durga Srinivasu Prabhala <satyap@codeaurora.org>
parent 9c2c61ce
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ struct cluster_data {
	unsigned int active_cpus;
	unsigned int num_cpus;
	unsigned int nr_isolated_cpus;
	unsigned int nr_not_preferred_cpus;
#ifdef CONFIG_SCHED_CORE_ROTATE
	unsigned long set_max;
	unsigned long set_cur;
@@ -350,6 +351,7 @@ static ssize_t store_not_preferred(struct cluster_data *state,
	unsigned int val[MAX_CPUS_PER_CLUSTER];
	unsigned long flags;
	int ret;
	int not_preferred_count = 0;

	ret = sscanf(buf, "%u %u %u %u %u %u\n",
			&val[0], &val[1], &val[2], &val[3],
@@ -361,7 +363,9 @@ static ssize_t store_not_preferred(struct cluster_data *state,
	for (i = 0; i < state->num_cpus; i++) {
		c = &per_cpu(cpu_state, i + state->first_cpu);
		c->not_preferred = val[i];
		not_preferred_count += !!val[i];
	}
	state->nr_not_preferred_cpus = not_preferred_count;
	spin_unlock_irqrestore(&state_lock, flags);

	return count;
@@ -794,10 +798,18 @@ static void try_to_isolate(struct cluster_data *cluster, unsigned int need)
			continue;
		if (cluster->active_cpus == need)
			break;
		/* Don't offline busy CPUs. */
		/* Don't isolate busy CPUs. */
		if (c->is_busy)
			continue;

		/*
		 * We isolate only the not_preferred CPUs. If none
		 * of the CPUs are selected as not_preferred, then
		 * all CPUs are eligible for isolation.
		 */
		if (cluster->nr_not_preferred_cpus && !c->not_preferred)
			continue;

		if (!should_we_isolate(c->cpu, cluster))
			continue;

@@ -1110,6 +1122,7 @@ static int cluster_init(const struct cpumask *mask)
	cluster->set_cur = cluster->set_max - 1;
#endif
	cluster->enable = true;
	cluster->nr_not_preferred_cpus = 0;
	INIT_LIST_HEAD(&cluster->lru);
	spin_lock_init(&cluster->pending_lock);