diff --git a/include/linux/sched/walt.h b/include/linux/sched/walt.h index 1684c50ef544..9f8d2d437c3e 100644 --- a/include/linux/sched/walt.h +++ b/include/linux/sched/walt.h @@ -7,8 +7,93 @@ #define _LINUX_SCHED_WALT_H #include +#include +#include #if IS_ENABLED(CONFIG_SCHED_WALT) + +#define WALT_NR_CPUS 8 +#define RAVG_HIST_SIZE_MAX 5 +#define NUM_BUSY_BUCKETS 10 + +struct walt_related_thread_group { + int id; + raw_spinlock_t lock; + struct list_head tasks; + struct list_head list; + bool skip_min; + struct rcu_head rcu; + u64 last_update; + u64 downmigrate_ts; + u64 start_ts; +}; + +struct walt_task_struct { + /* + * 'mark_start' marks the beginning of an event (task waking up, task + * starting to execute, task being preempted) within a window + * + * 'sum' represents how runnable a task has been within current + * window. It incorporates both running time and wait time and is + * frequency scaled. + * + * 'sum_history' keeps track of history of 'sum' seen over previous + * RAVG_HIST_SIZE windows. Windows where task was entirely sleeping are + * ignored. + * + * 'demand' represents maximum sum seen over previous + * sysctl_sched_ravg_hist_size windows. 'demand' could drive frequency + * demand for tasks. + * + * 'curr_window_cpu' represents task's contribution to cpu busy time on + * various CPUs in the current window + * + * 'prev_window_cpu' represents task's contribution to cpu busy time on + * various CPUs in the previous window + * + * 'curr_window' represents the sum of all entries in curr_window_cpu + * + * 'prev_window' represents the sum of all entries in prev_window_cpu + * + * 'pred_demand' represents task's current predicted cpu busy time + * + * 'busy_buckets' groups historical busy time into different buckets + * used for prediction + * + * 'demand_scaled' represents task's demand scaled to 1024 + */ + u64 mark_start; + u32 sum, demand; + u32 coloc_demand; + u32 sum_history[RAVG_HIST_SIZE_MAX]; + u32 curr_window_cpu[WALT_NR_CPUS]; + u32 prev_window_cpu[WALT_NR_CPUS]; + u32 curr_window, prev_window; + u32 pred_demand; + u8 busy_buckets[NUM_BUSY_BUCKETS]; + u16 demand_scaled; + u16 pred_demand_scaled; + u64 active_time; + u64 last_win_size; + int boost; + bool wake_up_idle; + bool misfit; + bool rtg_high_prio; + u8 low_latency; + u64 boost_period; + u64 boost_expires; + u64 last_sleep_ts; + u32 init_load_pct; + u32 unfilter; + u64 last_wake_ts; + u64 last_enqueued_ts; + struct walt_related_thread_group __rcu *grp; + struct list_head grp_list; + u64 cpu_cycles; + cpumask_t cpus_requested; + bool iowaited; +}; + extern int sched_lpm_disallowed_time(int cpu, u64 *timeout); extern int set_task_boost(int boost, u64 period); #else diff --git a/kernel/sched/walt/walt.h b/kernel/sched/walt/walt.h index 9f2c0f4c9c01..169095fb802c 100644 --- a/kernel/sched/walt/walt.h +++ b/kernel/sched/walt/walt.h @@ -8,6 +8,7 @@ #include "../../../kernel/sched/sched.h" #include "../../../fs/proc/internal.h" +#include #include #include @@ -57,79 +58,9 @@ enum task_boost_type { TASK_BOOST_END, }; -#define WALT_NR_CPUS 8 -#define RAVG_HIST_SIZE_MAX 5 -#define NUM_BUSY_BUCKETS 10 - #define WALT_LOW_LATENCY_PROCFS BIT(0) #define WALT_LOW_LATENCY_BINDER BIT(1) -struct walt_task_struct { - /* - * 'mark_start' marks the beginning of an event (task waking up, task - * starting to execute, task being preempted) within a window - * - * 'sum' represents how runnable a task has been within current - * window. It incorporates both running time and wait time and is - * frequency scaled. - * - * 'sum_history' keeps track of history of 'sum' seen over previous - * RAVG_HIST_SIZE windows. Windows where task was entirely sleeping are - * ignored. - * - * 'demand' represents maximum sum seen over previous - * sysctl_sched_ravg_hist_size windows. 'demand' could drive frequency - * demand for tasks. - * - * 'curr_window_cpu' represents task's contribution to cpu busy time on - * various CPUs in the current window - * - * 'prev_window_cpu' represents task's contribution to cpu busy time on - * various CPUs in the previous window - * - * 'curr_window' represents the sum of all entries in curr_window_cpu - * - * 'prev_window' represents the sum of all entries in prev_window_cpu - * - * 'pred_demand' represents task's current predicted cpu busy time - * - * 'busy_buckets' groups historical busy time into different buckets - * used for prediction - * - * 'demand_scaled' represents task's demand scaled to 1024 - */ - u64 mark_start; - u32 sum, demand; - u32 coloc_demand; - u32 sum_history[RAVG_HIST_SIZE_MAX]; - u32 curr_window_cpu[WALT_NR_CPUS]; - u32 prev_window_cpu[WALT_NR_CPUS]; - u32 curr_window, prev_window; - u32 pred_demand; - u8 busy_buckets[NUM_BUSY_BUCKETS]; - u16 demand_scaled; - u16 pred_demand_scaled; - u64 active_time; - u64 last_win_size; - int boost; - bool wake_up_idle; - bool misfit; - bool rtg_high_prio; - u8 low_latency; - u64 boost_period; - u64 boost_expires; - u64 last_sleep_ts; - u32 init_load_pct; - u32 unfilter; - u64 last_wake_ts; - u64 last_enqueued_ts; - struct walt_related_thread_group __rcu *grp; - struct list_head grp_list; - u64 cpu_cycles; - cpumask_t cpus_requested; - bool iowaited; -}; - struct walt_cpu_load { unsigned long nl; unsigned long pl; @@ -212,18 +143,6 @@ struct walt_sched_cluster { u64 aggr_grp_load; }; -struct walt_related_thread_group { - int id; - raw_spinlock_t lock; - struct list_head tasks; - struct list_head list; - bool skip_min; - struct rcu_head rcu; - u64 last_update; - u64 downmigrate_ts; - u64 start_ts; -}; - extern struct walt_sched_cluster *sched_cluster[WALT_NR_CPUS]; extern struct walt_sched_cluster *rq_cluster(struct rq *rq);