sched/walt: Improve the scheduler

This change is for general scheduler improvement.

Change-Id: If03bf5f104740adf09d854837ae9b141dc97cbc6
Signed-off-by: Tengfei Fan <tengfeif@codeaurora.org>
[pkondeti@codeaurora: Added tunable based on priority]
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
This commit is contained in:
Tengfei Fan 2020-04-21 09:01:51 +08:00 • committed by Pavankumar Kondeti
commit 7a8045dfd3
4 changed files with 31 additions and 0 deletions

View file

@ -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,

View file

@ -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;
@ -4066,6 +4067,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
}

View file

@ -2991,6 +2991,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)
{

View file

@ -150,6 +150,15 @@ const int sched_user_hint_max = 1000;
static unsigned int ns_per_sec = NSEC_PER_SEC;
static unsigned int one_hundred_thousand = 100000;
static unsigned int two_hundred_million = 200000000;
/*
* CFS task prio range is [100 ... 139]
* 120 is the default prio.
* RTG boost range is [100 ... 119] because giving
* boost for [120 .. 139] does not make sense.
* 99 means disabled and it is the default value.
*/
static unsigned int min_cfs_boost_prio = 99;
static unsigned int max_cfs_boost_prio = 119;
#endif
/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
@ -545,6 +554,15 @@ static struct ctl_table kern_table[] = {
.extra1 = SYSCTL_ZERO,
.extra2 = &two,
},
{
.procname = "walt_rtg_cfs_boost_prio",
.data = &sysctl_walt_rtg_cfs_boost_prio,
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = &min_cfs_boost_prio,
.extra2 = &max_cfs_boost_prio,
},
#endif
#ifdef CONFIG_SCHED_DEBUG
{