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

Commit d7a8a676 authored by Satya Durga Srinivasu Prabhala's avatar Satya Durga Srinivasu Prabhala Committed by Gerrit - the friendly Code Review server
Browse files

sched: Add snapshot of sched_{up,down}migrate knobs



This snapshot is taken from msm-4.19 as of commit 89986132507b822
("sched: fair: Improve the scheduler").

Change-Id: I9a52e67862ee5086880884128102aa4f8efb04ce
Signed-off-by: default avatarSatya Durga Srinivasu Prabhala <satyap@codeaurora.org>
parent 201ea482
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -20,11 +20,17 @@ extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
enum { sysctl_hung_task_timeout_secs = 0 };
#endif

#define MAX_CLUSTERS 3
/* MAX_MARGIN_LEVELS should be one less than MAX_CLUSTERS */
#define MAX_MARGIN_LEVELS (MAX_CLUSTERS - 1)

extern unsigned int sysctl_sched_latency;
extern unsigned int sysctl_sched_min_granularity;
extern unsigned int sysctl_sched_wakeup_granularity;
extern unsigned int sysctl_sched_child_runs_first;
#ifdef CONFIG_SCHED_WALT
extern unsigned int __weak sysctl_sched_capacity_margin_up[MAX_MARGIN_LEVELS];
extern unsigned int __weak sysctl_sched_capacity_margin_down[MAX_MARGIN_LEVELS];
extern unsigned int __weak sysctl_sched_user_hint;
extern const int __weak sched_user_hint_max;
extern unsigned int __weak sysctl_sched_cpu_high_irqload;
@@ -55,6 +61,11 @@ walt_proc_user_hint_handler(struct ctl_table *table, int write,
			void __user *buffer, size_t *lenp,
			loff_t *ppos);

extern int __weak
sched_updown_migrate_handler(struct ctl_table *table, int write,
			void __user *buffer, size_t *lenp,
			loff_t *ppos);

extern int __weak
sched_ravg_window_handler(struct ctl_table *table, int write,
			void __user *buffer, size_t *lenp,
+3 −0
Original line number Diff line number Diff line
@@ -73,6 +73,9 @@ extern int proc_do_large_bitmap(struct ctl_table *, int,
extern int proc_do_static_key(struct ctl_table *table, int write,
			      void __user *buffer, size_t *lenp,
			      loff_t *ppos);
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);
+19 −4
Original line number Diff line number Diff line
@@ -125,6 +125,12 @@ int __weak arch_asym_cpu_priority(int cpu)
unsigned int sysctl_sched_cfs_bandwidth_slice		= 5000UL;
#endif

/* Migration margins */
unsigned int sched_capacity_margin_up[NR_CPUS] = {
			[0 ... NR_CPUS-1] = 1078}; /* ~5% margin */
unsigned int sched_capacity_margin_down[NR_CPUS] = {
			[0 ... NR_CPUS-1] = 1205}; /* ~15% margin */

unsigned int sched_small_task_threshold = 102;

static inline void update_load_add(struct load_weight *lw, unsigned long inc)
@@ -3810,9 +3816,18 @@ util_est_dequeue(struct cfs_rq *cfs_rq, struct task_struct *p, bool task_sleep)
	WRITE_ONCE(p->se.avg.util_est, ue);
}

static inline int task_fits_capacity(struct task_struct *p, long capacity)
static inline int task_fits_capacity(struct task_struct *p,
					long capacity,
					int cpu)
{
	return fits_capacity(task_util_est(p), capacity);
	unsigned int margin;

	if (capacity_orig_of(task_cpu(p)) > capacity_orig_of(cpu))
		margin = sched_capacity_margin_down[task_cpu(p)];
	else
		margin = sched_capacity_margin_up[task_cpu(p)];

	return capacity * 1024 > task_util_est(p) * margin;
}

static inline void update_misfit_status(struct task_struct *p, struct rq *rq)
@@ -3825,7 +3840,7 @@ static inline void update_misfit_status(struct task_struct *p, struct rq *rq)
		return;
	}

	if (task_fits_capacity(p, capacity_of(cpu_of(rq)))) {
	if (task_fits_capacity(p, capacity_of(cpu_of(rq)), cpu_of(rq))) {
		rq->misfit_task_load = 0;
		return;
	}
@@ -6208,7 +6223,7 @@ static int wake_cap(struct task_struct *p, int cpu, int prev_cpu)
	/* Bring task utilization in sync with prev_cpu */
	sync_entity_load_avg(&p->se);

	return !task_fits_capacity(p, min_cap);
	return !task_fits_capacity(p, min_cap, cpu);
}

/*
+2 −0
Original line number Diff line number Diff line
@@ -85,6 +85,8 @@ struct rq;
struct cpuidle_state;

extern __read_mostly bool sched_predl;
extern unsigned int sched_capacity_margin_up[NR_CPUS];
extern unsigned int sched_capacity_margin_down[NR_CPUS];

struct sched_walt_cpu_load {
	unsigned long prev_window_util;
+57 −0
Original line number Diff line number Diff line
@@ -504,6 +504,20 @@ static struct ctl_table kern_table[] = {
		.mode		= 0644,
		.proc_handler	= sched_ravg_window_handler,
	},
	{
		.procname	= "sched_upmigrate",
		.data		= &sysctl_sched_capacity_margin_up,
		.maxlen		= sizeof(unsigned int) * MAX_MARGIN_LEVELS,
		.mode		= 0644,
		.proc_handler	= sched_updown_migrate_handler,
	},
	{
		.procname	= "sched_downmigrate",
		.data		= &sysctl_sched_capacity_margin_down,
		.maxlen		= sizeof(unsigned int) * MAX_MARGIN_LEVELS,
		.mode		= 0644,
		.proc_handler	= sched_updown_migrate_handler,
	},
#endif
#ifdef CONFIG_SCHED_DEBUG
	{
@@ -3531,6 +3545,43 @@ int proc_do_large_bitmap(struct ctl_table *table, int write,
	return err;
}

static int do_proc_douintvec_capacity_conv(bool *negp, unsigned long *lvalp,
					int *valp, int write, void *data)
{
	if (write) {
		/*
		 * The sched_upmigrate/sched_downmigrate tunables are
		 * accepted in percentage. Limit them to 100.
		 */
		if (*negp || *lvalp == 0 || *lvalp > 100)
			return -EINVAL;
		*valp = SCHED_FIXEDPOINT_SCALE * 100 / *lvalp;
	} else {
		*negp = false;
		*lvalp = SCHED_FIXEDPOINT_SCALE * 100 / *valp;
	}

	return 0;
}

/**
 * proc_douintvec_capacity - read a vector of integers in percentage and convert
 *                         into sched capacity
 * @table: the sysctl table
 * @write: %TRUE if this is a write to the sysctl file
 * @buffer: the user buffer
 * @lenp: the size of the user buffer
 * @ppos: file position
 *
 * Returns 0 on success.
 */
int proc_douintvec_capacity(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_capacity_conv, NULL);
}

static int do_proc_douintvec_rwin(bool *negp, unsigned long *lvalp,
					int *valp, int write, void *data)
{
@@ -3629,6 +3680,12 @@ int proc_douintvec_ravg_window(struct ctl_table *table, int write,
	return -ENOSYS;
}

int proc_douintvec_capacity(struct ctl_table *table, int write,
			    void __user *buffer, size_t *lenp, loff_t *ppos)
{
	return -ENOSYS;
}

#endif /* CONFIG_PROC_SYSCTL */

#if defined(CONFIG_SYSCTL)