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

Commit f3e2e286 authored by Srivatsa Vaddagiri's avatar Srivatsa Vaddagiri Committed by Pavankumar Kondeti
Browse files

sched: Avoid packing tasks with low sleep time



Low sleep time can be an indication that waking tasks will not receive
any vruntime bonus and hence would suffer from latency when packed.
short-burst tasks sleeping on an average more than sched_short_sleep_ns
are not eligible for packing. This policy covers the case where a
task runs in short bursts and sleeping for smaller duration in between.

Change-Id: Ib81fa37809b85c267949cd433bc6115dd89f100e
Signed-off-by: default avatarSrivatsa Vaddagiri <vatsa@codeaurora.org>
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
parent c0a8f9e8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ extern unsigned int sysctl_sched_enable_thread_grouping;
extern unsigned int sysctl_sched_freq_aggregate_threshold_pct;
extern unsigned int sysctl_sched_prefer_sync_wakee_to_waker;
extern unsigned int sysctl_sched_short_burst;
extern unsigned int sysctl_sched_short_sleep;

#else /* CONFIG_SCHED_HMP */

+4 −1
Original line number Diff line number Diff line
@@ -959,9 +959,12 @@ unsigned int __read_mostly sysctl_sched_restrict_cluster_spill;
/*
 * Scheduler tries to avoid waking up idle CPUs for tasks running
 * in short bursts. If the task average burst is less than
 * sysctl_sched_short_burst nanoseconds, it is eligible for packing.
 * sysctl_sched_short_burst nanoseconds and it sleeps on an average
 * for more than sysctl_sched_short_sleep nanoseconds, then the
 * task is eligible for packing.
 */
unsigned int __read_mostly sysctl_sched_short_burst;
unsigned int __read_mostly sysctl_sched_short_sleep = 1 * NSEC_PER_MSEC;

static void
_update_up_down_migrate(unsigned int *up_migrate, unsigned int *down_migrate)
+2 −1
Original line number Diff line number Diff line
@@ -1420,7 +1420,8 @@ static inline u64 cpu_cravg_sync(int cpu, int sync)

static inline bool is_short_burst_task(struct task_struct *p)
{
	return p->ravg.avg_burst < sysctl_sched_short_burst;
	return p->ravg.avg_burst < sysctl_sched_short_burst &&
	       p->ravg.avg_sleep_time > sysctl_sched_short_sleep;
}

extern void check_for_migration(struct rq *rq, struct task_struct *p);
+7 −0
Original line number Diff line number Diff line
@@ -514,6 +514,13 @@ static struct ctl_table kern_table[] = {
		.mode		= 0644,
		.proc_handler	= proc_dointvec,
	},
	{
		.procname       = "sched_short_sleep_ns",
		.data           = &sysctl_sched_short_sleep,
		.maxlen         = sizeof(unsigned int),
		.mode           = 0644,
		.proc_handler   = proc_dointvec,
	},
#endif	/* CONFIG_SCHED_HMP */
#ifdef CONFIG_SCHED_DEBUG
	{