Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e2c44d5b authored by Sai Harshini Nimmala's avatar Sai Harshini Nimmala
Browse files

sched/walt: Improve the scheduler



This change is for general scheduler improvement.

Change-Id: I8459bcf7b412a5f301566054c28c910567548485
Signed-off-by: default avatarSai Harshini Nimmala <snimmala@codeaurora.org>
parent dd8171dd
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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)
+4 −0
Original line number Diff line number Diff line
@@ -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 
+34 −0
Original line number Diff line number Diff line
@@ -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;
}
+36 −0
Original line number Diff line number Diff line
@@ -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 */

/*