sched/walt: Improve the scheduler
This change is for general scheduler improvement. Change-Id: I8459bcf7b412a5f301566054c28c910567548485 Signed-off-by: Sai Harshini Nimmala <snimmala@codeaurora.org>
This commit is contained in:
parent
dd8171dd87
commit
e2c44d5b41
4 changed files with 80 additions and 0 deletions
|
@ -53,6 +53,7 @@ extern unsigned int sysctl_sched_coloc_busy_hyst_enable_cpus;
|
|||
extern unsigned int sysctl_sched_coloc_busy_hyst;
|
||||
extern unsigned int sysctl_sched_coloc_busy_hyst_max_ms;
|
||||
extern unsigned int sysctl_sched_window_stats_policy;
|
||||
extern unsigned int sysctl_sched_ravg_window_nr_ticks;
|
||||
|
||||
extern int
|
||||
walt_proc_group_thresholds_handler(struct ctl_table *table, int write,
|
||||
|
@ -63,6 +64,11 @@ walt_proc_user_hint_handler(struct ctl_table *table, int write,
|
|||
void __user *buffer, size_t *lenp,
|
||||
loff_t *ppos);
|
||||
|
||||
extern int
|
||||
sched_ravg_window_handler(struct ctl_table *table, int write,
|
||||
void __user *buffer, size_t *lenp,
|
||||
loff_t *ppos);
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_PREEMPT_TRACER) || defined(CONFIG_DEBUG_PREEMPT)
|
||||
|
|
|
@ -67,6 +67,10 @@ extern int proc_douintvec_capacity(struct ctl_table *table, int write,
|
|||
void __user *buffer, size_t *lenp,
|
||||
loff_t *ppos);
|
||||
|
||||
extern int proc_douintvec_ravg_window(struct ctl_table *table, int write,
|
||||
void __user *buffer, size_t *lenp,
|
||||
loff_t *ppos);
|
||||
|
||||
/*
|
||||
* Register a set of sysctl names by calling register_sysctl_table
|
||||
* with an initialised array of struct ctl_table's. An entry with
|
||||
|
|
|
@ -108,6 +108,8 @@ static void release_rq_locks_irqrestore(const cpumask_t *cpus,
|
|||
/* Max window size (in ns) = 1s */
|
||||
#define MAX_SCHED_RAVG_WINDOW 1000000000
|
||||
|
||||
#define NR_WINDOWS_PER_SEC (NSEC_PER_SEC / MIN_SCHED_RAVG_WINDOW)
|
||||
|
||||
__read_mostly unsigned int sysctl_sched_cpu_high_irqload = (10 * NSEC_PER_MSEC);
|
||||
|
||||
unsigned int sysctl_sched_walt_rotate_big_tasks;
|
||||
|
@ -121,6 +123,9 @@ static __read_mostly unsigned int sched_io_is_busy = 1;
|
|||
__read_mostly unsigned int sysctl_sched_window_stats_policy =
|
||||
WINDOW_STATS_MAX_RECENT_AVG;
|
||||
|
||||
__read_mostly unsigned int sysctl_sched_ravg_window_nr_ticks =
|
||||
(HZ / NR_WINDOWS_PER_SEC);
|
||||
|
||||
/* Window size (in ns) */
|
||||
__read_mostly unsigned int sched_ravg_window = MIN_SCHED_RAVG_WINDOW;
|
||||
__read_mostly unsigned int new_sched_ravg_window = MIN_SCHED_RAVG_WINDOW;
|
||||
|
@ -3552,3 +3557,32 @@ int walt_proc_user_hint_handler(struct ctl_table *table,
|
|||
mutex_unlock(&mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline void sched_window_nr_ticks_change(int new_nr_ticks)
|
||||
{
|
||||
new_sched_ravg_window = new_nr_ticks * (NSEC_PER_SEC / HZ);
|
||||
}
|
||||
|
||||
int sched_ravg_window_handler(struct ctl_table *table,
|
||||
int write, void __user *buffer, size_t *lenp,
|
||||
loff_t *ppos)
|
||||
{
|
||||
int ret;
|
||||
static DEFINE_MUTEX(mutex);
|
||||
unsigned int prev_value;
|
||||
|
||||
mutex_lock(&mutex);
|
||||
|
||||
prev_value = sysctl_sched_ravg_window_nr_ticks;
|
||||
ret = proc_douintvec_ravg_window(table, write, buffer, lenp, ppos);
|
||||
if (ret || !write ||
|
||||
(prev_value == sysctl_sched_ravg_window_nr_ticks) ||
|
||||
(sysctl_sched_ravg_window_nr_ticks == 0))
|
||||
goto unlock;
|
||||
|
||||
sched_window_nr_ticks_change(sysctl_sched_ravg_window_nr_ticks);
|
||||
|
||||
unlock:
|
||||
mutex_unlock(&mutex);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -511,6 +511,13 @@ static struct ctl_table kern_table[] = {
|
|||
.extra1 = &zero,
|
||||
.extra2 = &one_hundred_thousand,
|
||||
},
|
||||
{
|
||||
.procname = "sched_ravg_window_nr_ticks",
|
||||
.data = &sysctl_sched_ravg_window_nr_ticks,
|
||||
.maxlen = sizeof(unsigned int),
|
||||
.mode = 0644,
|
||||
.proc_handler = sched_ravg_window_handler,
|
||||
},
|
||||
#endif
|
||||
#ifdef CONFIG_SMP
|
||||
{
|
||||
|
@ -3544,6 +3551,29 @@ int proc_douintvec_capacity(struct ctl_table *table, int write,
|
|||
do_proc_douintvec_capacity_conv, NULL);
|
||||
}
|
||||
|
||||
static int do_proc_douintvec_rwin(bool *negp, unsigned long *lvalp,
|
||||
int *valp, int write, void *data)
|
||||
{
|
||||
if (write) {
|
||||
if (*lvalp == 0 || *lvalp == 2 || *lvalp == 5)
|
||||
*valp = *lvalp;
|
||||
else
|
||||
return -EINVAL;
|
||||
} else {
|
||||
*negp = false;
|
||||
*lvalp = *valp;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int proc_douintvec_ravg_window(struct ctl_table *table, int write,
|
||||
void __user *buffer, size_t *lenp, loff_t *ppos)
|
||||
{
|
||||
return do_proc_dointvec(table, write, buffer, lenp, ppos,
|
||||
do_proc_douintvec_rwin, NULL);
|
||||
}
|
||||
|
||||
#else /* CONFIG_PROC_SYSCTL */
|
||||
|
||||
int proc_dostring(struct ctl_table *table, int write,
|
||||
|
@ -3613,6 +3643,12 @@ int proc_douintvec_capacity(struct ctl_table *table, int write,
|
|||
return -ENOSYS;
|
||||
}
|
||||
|
||||
int proc_douintvec_ravg_window(struct ctl_table *table, int write,
|
||||
void __user *buffer, size_t *lenp, loff_t *ppos)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_PROC_SYSCTL */
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue