Loading include/linux/sched.h +1 −0 Original line number Diff line number Diff line Loading @@ -618,6 +618,7 @@ struct walt_task_struct { int boost; bool wake_up_idle; bool misfit; bool rtg_high_prio; bool low_latency; u64 boost_period; u64 boost_expires; Loading include/linux/sched/sysctl.h +1 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ extern unsigned int __weak sysctl_sched_ravg_window_nr_ticks; extern unsigned int __weak sysctl_sched_many_wakeup_threshold; extern unsigned int __weak sysctl_sched_dynamic_ravg_window_enable; extern unsigned int sysctl_sched_prefer_spread; extern unsigned int sysctl_walt_rtg_cfs_boost_prio; extern int walt_proc_group_thresholds_handler(struct ctl_table *table, int write, Loading include/trace/events/sched.h +5 −2 Original line number Diff line number Diff line Loading @@ -927,6 +927,7 @@ TRACE_EVENT(sched_cpu_util, __field(int, isolated) __field(int, reserved) __field(int, high_irq_load) __field(unsigned int, nr_rtg_high_prio_tasks) ), TP_fast_assign( Loading @@ -943,14 +944,16 @@ TRACE_EVENT(sched_cpu_util, __entry->isolated = cpu_isolated(cpu); __entry->reserved = is_reserved(cpu); __entry->high_irq_load = sched_cpu_high_irqload(cpu); __entry->nr_rtg_high_prio_tasks = walt_nr_rtg_high_prio(cpu); ), TP_printk("cpu=%d nr_running=%d cpu_util=%ld cpu_util_cum=%ld capacity_curr=%u capacity=%u capacity_orig=%u idle_state=%d irqload=%llu online=%u, isolated=%u, reserved=%u, high_irq_load=%u", TP_printk("cpu=%d nr_running=%d cpu_util=%ld cpu_util_cum=%ld capacity_curr=%u capacity=%u capacity_orig=%u idle_state=%d irqload=%llu online=%u, isolated=%u, reserved=%u, high_irq_load=%u nr_rtg_hp=%u", __entry->cpu, __entry->nr_running, __entry->cpu_util, __entry->cpu_util_cum, __entry->capacity_curr, __entry->capacity, __entry->capacity_orig, __entry->idle_state, __entry->irqload, __entry->online, __entry->isolated, __entry->reserved, __entry->high_irq_load) __entry->isolated, __entry->reserved, __entry->high_irq_load, __entry->nr_rtg_high_prio_tasks) ); TRACE_EVENT(sched_compute_energy, Loading kernel/sched/fair.c +36 −3 Original line number Diff line number Diff line Loading @@ -133,6 +133,7 @@ unsigned int sched_capacity_margin_down[NR_CPUS] = { #ifdef CONFIG_SCHED_WALT __read_mostly unsigned int sysctl_sched_prefer_spread; unsigned int sysctl_walt_rtg_cfs_boost_prio = 99; /* disabled by default */ #endif unsigned int sched_small_task_threshold = 102; Loading Loading @@ -3936,6 +3937,12 @@ static inline void walt_adjust_cpus_for_packing(struct task_struct *p, if (prefer_spread_on_idle(*best_idle_cpu)) fbt_env->need_idle |= 2; if (task_rtg_high_prio(p) && walt_nr_rtg_high_prio(*target_cpu) > 0) { *target_cpu = -1; return; } if (fbt_env->need_idle || task_placement_boost_enabled(p) || fbt_env->boosted || shallowest_idle_cstate <= 0) { *target_cpu = -1; Loading Loading @@ -4066,6 +4073,11 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial) se->vruntime = min_vruntime(vruntime, se->vruntime); return; } else if (task_rtg_high_prio(task_of(se))) { vruntime -= thresh; se->vruntime = min_vruntime(vruntime, se->vruntime); return; } #endif } Loading Loading @@ -6543,6 +6555,8 @@ static void walt_find_best_target(struct sched_domain *sd, cpumask_t *cpus, int unisolated_candidate = -1; int order_index = fbt_env->order_index, end_index = fbt_env->end_index; int cluster; unsigned int target_nr_rtg_high_prio = UINT_MAX; bool rtg_high_prio_task = task_rtg_high_prio(p); /* Find start CPU based on boost value */ start_cpu = fbt_env->start_cpu; Loading Loading @@ -6690,11 +6704,30 @@ static void walt_find_best_target(struct sched_domain *sd, cpumask_t *cpus, if (p->state == TASK_RUNNING) continue; /* * Try to spread the rtg high prio tasks so that they * don't preempt each other. This is a optimisitc * check assuming rtg high prio can actually preempt * the current running task with the given vruntime * boost. */ if (rtg_high_prio_task) { if (walt_nr_rtg_high_prio(i) > target_nr_rtg_high_prio) continue; /* Favor CPUs with maximum spare capacity */ if (walt_nr_rtg_high_prio(i) == target_nr_rtg_high_prio && spare_cap < target_max_spare_cap) continue; } else { /* Favor CPUs with maximum spare capacity */ if (spare_cap < target_max_spare_cap) continue; } target_max_spare_cap = spare_cap; target_nr_rtg_high_prio = walt_nr_rtg_high_prio(i); target_cpu = i; } Loading kernel/sched/sched.h +7 −0 Original line number Diff line number Diff line Loading @@ -105,6 +105,7 @@ struct walt_sched_stats { int nr_big_tasks; u64 cumulative_runnable_avg_scaled; u64 pred_demands_sum_scaled; unsigned int nr_rtg_high_prio_tasks; }; struct walt_task_group { Loading Loading @@ -2991,6 +2992,12 @@ static inline bool task_in_related_thread_group(struct task_struct *p) return (rcu_access_pointer(p->wts.grp) != NULL); } static inline bool task_rtg_high_prio(struct task_struct *p) { return task_in_related_thread_group(p) && (p->prio <= sysctl_walt_rtg_cfs_boost_prio); } static inline struct walt_related_thread_group *task_related_thread_group(struct task_struct *p) { Loading Loading
include/linux/sched.h +1 −0 Original line number Diff line number Diff line Loading @@ -618,6 +618,7 @@ struct walt_task_struct { int boost; bool wake_up_idle; bool misfit; bool rtg_high_prio; bool low_latency; u64 boost_period; u64 boost_expires; Loading
include/linux/sched/sysctl.h +1 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ extern unsigned int __weak sysctl_sched_ravg_window_nr_ticks; extern unsigned int __weak sysctl_sched_many_wakeup_threshold; extern unsigned int __weak sysctl_sched_dynamic_ravg_window_enable; extern unsigned int sysctl_sched_prefer_spread; extern unsigned int sysctl_walt_rtg_cfs_boost_prio; extern int walt_proc_group_thresholds_handler(struct ctl_table *table, int write, Loading
include/trace/events/sched.h +5 −2 Original line number Diff line number Diff line Loading @@ -927,6 +927,7 @@ TRACE_EVENT(sched_cpu_util, __field(int, isolated) __field(int, reserved) __field(int, high_irq_load) __field(unsigned int, nr_rtg_high_prio_tasks) ), TP_fast_assign( Loading @@ -943,14 +944,16 @@ TRACE_EVENT(sched_cpu_util, __entry->isolated = cpu_isolated(cpu); __entry->reserved = is_reserved(cpu); __entry->high_irq_load = sched_cpu_high_irqload(cpu); __entry->nr_rtg_high_prio_tasks = walt_nr_rtg_high_prio(cpu); ), TP_printk("cpu=%d nr_running=%d cpu_util=%ld cpu_util_cum=%ld capacity_curr=%u capacity=%u capacity_orig=%u idle_state=%d irqload=%llu online=%u, isolated=%u, reserved=%u, high_irq_load=%u", TP_printk("cpu=%d nr_running=%d cpu_util=%ld cpu_util_cum=%ld capacity_curr=%u capacity=%u capacity_orig=%u idle_state=%d irqload=%llu online=%u, isolated=%u, reserved=%u, high_irq_load=%u nr_rtg_hp=%u", __entry->cpu, __entry->nr_running, __entry->cpu_util, __entry->cpu_util_cum, __entry->capacity_curr, __entry->capacity, __entry->capacity_orig, __entry->idle_state, __entry->irqload, __entry->online, __entry->isolated, __entry->reserved, __entry->high_irq_load) __entry->isolated, __entry->reserved, __entry->high_irq_load, __entry->nr_rtg_high_prio_tasks) ); TRACE_EVENT(sched_compute_energy, Loading
kernel/sched/fair.c +36 −3 Original line number Diff line number Diff line Loading @@ -133,6 +133,7 @@ unsigned int sched_capacity_margin_down[NR_CPUS] = { #ifdef CONFIG_SCHED_WALT __read_mostly unsigned int sysctl_sched_prefer_spread; unsigned int sysctl_walt_rtg_cfs_boost_prio = 99; /* disabled by default */ #endif unsigned int sched_small_task_threshold = 102; Loading Loading @@ -3936,6 +3937,12 @@ static inline void walt_adjust_cpus_for_packing(struct task_struct *p, if (prefer_spread_on_idle(*best_idle_cpu)) fbt_env->need_idle |= 2; if (task_rtg_high_prio(p) && walt_nr_rtg_high_prio(*target_cpu) > 0) { *target_cpu = -1; return; } if (fbt_env->need_idle || task_placement_boost_enabled(p) || fbt_env->boosted || shallowest_idle_cstate <= 0) { *target_cpu = -1; Loading Loading @@ -4066,6 +4073,11 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial) se->vruntime = min_vruntime(vruntime, se->vruntime); return; } else if (task_rtg_high_prio(task_of(se))) { vruntime -= thresh; se->vruntime = min_vruntime(vruntime, se->vruntime); return; } #endif } Loading Loading @@ -6543,6 +6555,8 @@ static void walt_find_best_target(struct sched_domain *sd, cpumask_t *cpus, int unisolated_candidate = -1; int order_index = fbt_env->order_index, end_index = fbt_env->end_index; int cluster; unsigned int target_nr_rtg_high_prio = UINT_MAX; bool rtg_high_prio_task = task_rtg_high_prio(p); /* Find start CPU based on boost value */ start_cpu = fbt_env->start_cpu; Loading Loading @@ -6690,11 +6704,30 @@ static void walt_find_best_target(struct sched_domain *sd, cpumask_t *cpus, if (p->state == TASK_RUNNING) continue; /* * Try to spread the rtg high prio tasks so that they * don't preempt each other. This is a optimisitc * check assuming rtg high prio can actually preempt * the current running task with the given vruntime * boost. */ if (rtg_high_prio_task) { if (walt_nr_rtg_high_prio(i) > target_nr_rtg_high_prio) continue; /* Favor CPUs with maximum spare capacity */ if (walt_nr_rtg_high_prio(i) == target_nr_rtg_high_prio && spare_cap < target_max_spare_cap) continue; } else { /* Favor CPUs with maximum spare capacity */ if (spare_cap < target_max_spare_cap) continue; } target_max_spare_cap = spare_cap; target_nr_rtg_high_prio = walt_nr_rtg_high_prio(i); target_cpu = i; } Loading
kernel/sched/sched.h +7 −0 Original line number Diff line number Diff line Loading @@ -105,6 +105,7 @@ struct walt_sched_stats { int nr_big_tasks; u64 cumulative_runnable_avg_scaled; u64 pred_demands_sum_scaled; unsigned int nr_rtg_high_prio_tasks; }; struct walt_task_group { Loading Loading @@ -2991,6 +2992,12 @@ static inline bool task_in_related_thread_group(struct task_struct *p) return (rcu_access_pointer(p->wts.grp) != NULL); } static inline bool task_rtg_high_prio(struct task_struct *p) { return task_in_related_thread_group(p) && (p->prio <= sysctl_walt_rtg_cfs_boost_prio); } static inline struct walt_related_thread_group *task_related_thread_group(struct task_struct *p) { Loading