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

Commit 6bdecf57 authored by Amir Vajid's avatar Amir Vajid
Browse files

cpuidle: lpm-levels: get bias time from scheduler



Update lpm_disallowed() to receive bias_time directly
from the scheduler.

Change-Id: I756c4f5e545083b455041af5ad8ddf7ee7986365
Signed-off-by: default avatarAmir Vajid <avajid@codeaurora.org>
parent 773b595b
Loading
Loading
Loading
Loading
+7 −24
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@
#define SCLK_HZ (32768)
#define PSCI_POWER_STATE(reset) (reset << 30)
#define PSCI_AFFINITY_LEVEL(lvl) ((lvl & 0x3) << 24)
#define BIAS_HYST (bias_hyst * NSEC_PER_MSEC)

enum {
	MSM_LPM_LVL_DBG_SUSPEND_LIMITS = BIT(0),
@@ -83,9 +82,6 @@ struct lpm_cluster *lpm_root_node;
static bool lpm_prediction = true;
module_param_named(lpm_prediction, lpm_prediction, bool, 0664);

static uint32_t bias_hyst;
module_param_named(bias_hyst, bias_hyst, uint, 0664);

struct lpm_history {
	uint32_t resi[MAXSAMPLES];
	int mode[MAXSAMPLES];
@@ -617,36 +613,23 @@ static void clear_predict_history(void)

static void update_history(struct cpuidle_device *dev, int idx);

static inline bool is_cpu_biased(int cpu, uint64_t *bias_time)
{
	u64 now = sched_clock();
	u64 last = sched_get_cpu_last_busy_time(cpu);
	u64 diff = 0;

	if (!last)
		return false;

	diff = now - last;
	if (diff < BIAS_HYST) {
		*bias_time = BIAS_HYST - diff;
		return true;
	}

	return false;
}

static inline bool lpm_disallowed(s64 sleep_us, int cpu, struct lpm_cpu *pm_cpu)
{
	uint64_t bias_time = 0;

	if (sleep_disabled && !cpu_isolated(cpu))
	if (cpu_isolated(cpu))
		goto out;

	if (sleep_disabled)
		return true;

	if (is_cpu_biased(cpu, &bias_time) && (!cpu_isolated(cpu))) {
	bias_time = sched_lpm_disallowed_time(cpu);
	if (bias_time) {
		pm_cpu->bias = bias_time;
		return true;
	}

out:
	if (sleep_us < 0)
		return true;

+5 −0
Original line number Diff line number Diff line
@@ -40,6 +40,11 @@ static inline u64 sched_get_cpu_last_busy_time(int cpu)
}
#endif

static inline u64 sched_lpm_disallowed_time(int cpu)
{
	return 0;
}

static inline int sched_info_on(void)
{
#ifdef CONFIG_SCHEDSTATS