mirror of
https://github.com/torvalds/linux.git
synced 2026-08-01 20:22:08 +02:00
sched/walt: Implement sched_lpm_disallowed_time() API
LPM governor can query the scheduler preference about the CPU's c-state via sched_lpm_disallowed_time() API. It returns 0 when shallowest c-state is preferred and associated timeout is set. Change-Id: Ie8246aa9ec4638730d3442468aa9dc1969a90369 Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
This commit is contained in:
parent
899a181942
commit
09445f02e8
20
include/linux/sched/walt.h
Normal file
20
include/linux/sched/walt.h
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_SCHED_WALT_H
|
||||
#define _LINUX_SCHED_WALT_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#if IS_ENABLED(CONFIG_SCHED_WALT)
|
||||
extern int sched_lpm_disallowed_time(int cpu, u64 *timeout);
|
||||
#else
|
||||
static inline int sched_lpm_disallowed_time(int cpu, u64 *timeout)
|
||||
{
|
||||
return INT_MAX;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _LINUX_SCHED_WALT_H */
|
||||
|
|
@ -237,14 +237,21 @@ unsigned int sched_get_cpu_util(int cpu)
|
|||
return busy;
|
||||
}
|
||||
|
||||
u64 sched_lpm_disallowed_time(int cpu)
|
||||
int sched_lpm_disallowed_time(int cpu, u64 *timeout)
|
||||
{
|
||||
u64 now = sched_clock();
|
||||
u64 bias_end_time = atomic64_read(&per_cpu(busy_hyst_end_time, cpu));
|
||||
|
||||
if (now < bias_end_time)
|
||||
return bias_end_time - now;
|
||||
if (unlikely(is_reserved(cpu))) {
|
||||
*timeout = 10 * NSEC_PER_MSEC;
|
||||
return 0; /* shallowest c-state */
|
||||
}
|
||||
|
||||
return 0;
|
||||
if (now < bias_end_time) {
|
||||
*timeout = bias_end_time - now;
|
||||
return 0; /* shallowest c-state */
|
||||
}
|
||||
|
||||
return INT_MAX; /* don't care */
|
||||
}
|
||||
EXPORT_SYMBOL(sched_lpm_disallowed_time);
|
||||
|
|
|
|||
|
|
@ -278,7 +278,6 @@ extern int sched_unpause_cpus(struct cpumask *unpause_cpus);
|
|||
|
||||
extern unsigned int sched_get_cpu_util(int cpu);
|
||||
extern void sched_update_hyst_times(void);
|
||||
extern u64 sched_lpm_disallowed_time(int cpu);
|
||||
extern int
|
||||
sched_updown_migrate_handler(struct ctl_table *table, int write,
|
||||
void __user *buffer, size_t *lenp, loff_t *ppos);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user