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

Commit c47d00b5 authored by Chris Redpath's avatar Chris Redpath Committed by Andres Oportus
Browse files

sched/tune: don't use schedtune before it is ready



When EAS is enabled during boot, we have to be careful not to use
schedtune from fair.c before it is ready or it will warn us and we'll
get a traceback in the console.

Change-Id: I1a5cf29b18af626545c636c51219f9ed497c19fa
Signed-off-by: default avatarChris Redpath <chris.redpath@arm.com>
parent 9e3c04be
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -5597,7 +5597,7 @@ static inline int __energy_diff(struct energy_env *eenv)
#ifdef CONFIG_SCHED_TUNE

struct target_nrg schedtune_target_nrg;

extern bool schedtune_initialized;
/*
 * System energy normalization
 * Returns the normalized value, in the range [0..SCHED_CAPACITY_SCALE],
@@ -5607,13 +5607,20 @@ static inline int
normalize_energy(int energy_diff)
{
	u32 normalized_nrg;

	/* during early setup, we don't know the extents */
	if (unlikely(!schedtune_initialized))
		return energy_diff < 0 ? -1 : 1 ;

#ifdef CONFIG_SCHED_DEBUG
	{
	int max_delta;

	/* Check for boundaries */
	max_delta  = schedtune_target_nrg.max_power;
	max_delta -= schedtune_target_nrg.min_power;
	WARN_ON(abs(energy_diff) >= max_delta);
	}
#endif

	/* Do scaling using positive numbers to increase the range */
+7 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@
#include "tune.h"

#ifdef CONFIG_CGROUP_SCHEDTUNE
static bool schedtune_initialized = false;
bool schedtune_initialized = false;
#endif

unsigned int sysctl_sched_cfs_boost __read_mostly;
@@ -527,6 +527,9 @@ int schedtune_task_boost(struct task_struct *p)
	struct schedtune *st;
	int task_boost;

	if (!unlikely(schedtune_initialized))
		return 0;

	/* Get task boost value */
	rcu_read_lock();
	st = task_schedtune(p);
@@ -541,6 +544,9 @@ int schedtune_prefer_idle(struct task_struct *p)
	struct schedtune *st;
	int prefer_idle;

	if (!unlikely(schedtune_initialized))
		return 0;

	/* Get prefer_idle value */
	rcu_read_lock();
	st = task_schedtune(p);