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

Commit 11bb76e5 authored by Olav Haugan's avatar Olav Haugan Committed by Gerrit - the friendly Code Review server
Browse files

core_ctl: Add refcounting to boost api



More than one client may call the core_ctl_set_boost api. Add support
for this.
Also add a new trace event that is emitted when this api is called.

Change-Id: Ic8ed105e63b469695ad15589725f651825604f08
Signed-off-by: default avatarOlav Haugan <ohaugan@codeaurora.org>
Signed-off-by: default avatarSatya Durga Srinivasu Prabhala <satyap@codeaurora.org>
parent 908afaa2
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -888,6 +888,21 @@ TRACE_EVENT(core_ctl_set_busy,
		  __entry->is_busy)
);

TRACE_EVENT(core_ctl_set_boost,

	TP_PROTO(u32 refcount, s32 ret),
	TP_ARGS(refcount, ret),
	TP_STRUCT__entry(
		__field(u32, refcount)
		__field(s32, ret)
	),
	TP_fast_assign(
		__entry->refcount = refcount;
		__entry->ret = ret;
	),
	TP_printk("refcount=%u, ret=%d", __entry->refcount, __entry->ret)
);

/*
 * Tracepoint for schedtune_tasks_update
 */
+28 −5
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ struct cluster_data {
	bool nrrun_changed;
	struct task_struct *core_ctl_thread;
	unsigned int first_cpu;
	bool boost;
	unsigned int boost;
	struct kobject kobj;
};

@@ -652,17 +652,40 @@ static bool do_check(u64 wallclock)
	return do_check;
}

void core_ctl_set_boost(bool boost)
int core_ctl_set_boost(bool boost)
{
	unsigned int index = 0;
	struct cluster_data *cluster;
	unsigned long flags;
	int ret = 0;
	bool boost_state_changed = false;

	spin_lock_irqsave(&state_lock, flags);
	for_each_cluster(cluster, index) {
		if (cluster->is_big_cluster && cluster->boost != boost) {
			cluster->boost = boost;
			apply_need(cluster);
		if (cluster->is_big_cluster) {
			if (boost) {
				boost_state_changed = !cluster->boost;
				++cluster->boost;
			} else {
				if (!cluster->boost) {
					pr_err("Error turning off boost. Boost already turned off\n");
					ret = -EINVAL;
				} else {
					--cluster->boost;
					boost_state_changed = !cluster->boost;
				}
			}
			break;
		}
	}
	spin_unlock_irqrestore(&state_lock, flags);

	if (boost_state_changed)
		apply_need(cluster);

	trace_core_ctl_set_boost(cluster->boost, ret);

	return ret;
}

void core_ctl_check(u64 wallclock)
+5 −2
Original line number Diff line number Diff line
@@ -16,9 +16,12 @@

#ifdef CONFIG_SCHED_CORE_CTL
void core_ctl_check(u64 wallclock);
void core_ctl_set_boost(bool boost);
int core_ctl_set_boost(bool boost);
#else
static inline void core_ctl_check(u64 wallclock) {}
static inline void core_ctl_set_boost(bool boost) {}
static inline int core_ctl_set_boost(bool boost)
{
	return 0;
}
#endif
#endif