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

Commit f91de123 authored by Rohit Gupta's avatar Rohit Gupta
Browse files

sched: Call the notify_on_migrate notifier chain for wakeups as well



Add a change to send notify_on_migrate hints on wakeups of
foreground tasks from scheduler if their load is above
wakeup_load_thresholds (default value is 60).
These hints can be used to choose an appropriate CPU frequency
corresponding to the load of the task being woken up.

Change-Id: Ieca413c1a8bd2b14a15a7591e8e15d22925c42ca
Signed-off-by: default avatarRohit Gupta <rohgup@codeaurora.org>
parent 1f25d291
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ extern unsigned int sysctl_sched_wakeup_granularity;
extern unsigned int sysctl_sched_child_runs_first;
extern unsigned int sysctl_sched_wake_to_idle;
extern unsigned int sysctl_sched_ravg_window;
extern unsigned int sysctl_sched_wakeup_load_threshold;

enum sched_tunable_scaling {
	SCHED_TUNABLESCALING_NONE,
+12 −2
Original line number Diff line number Diff line
@@ -1592,6 +1592,7 @@ static void ttwu_queue(struct task_struct *p, int cpu)
	raw_spin_unlock(&rq->lock);
}

__read_mostly unsigned int sysctl_sched_wakeup_load_threshold = 60;
/**
 * try_to_wake_up - wake up a thread
 * @p: the thread to be awakened
@@ -1658,7 +1659,7 @@ stat:
out:
	raw_spin_unlock_irqrestore(&p->pi_lock, flags);

	if (src_cpu != cpu && task_notify_on_migrate(p)) {
	if (task_notify_on_migrate(p)) {
		struct migration_notify_data mnd;

		mnd.src_cpu = src_cpu;
@@ -1668,6 +1669,15 @@ out:
				(u64)(sysctl_sched_ravg_window));
		else
			mnd.load = 0;
		/*
		 * Call the migration notifier with mnd for foreground task
		 * migrations as well as for wakeups if their load is above
		 * sysctl_sched_wakeup_load_threshold. This would prompt the
		 * cpu-boost to boost the CPU frequency on wake up of a heavy
		 * weight foreground task
		 */
		if ((src_cpu != cpu) || (mnd.load >
					sysctl_sched_wakeup_load_threshold))
			atomic_notifier_call_chain(&migration_notifier_head,
					   0, (void *)&mnd);
	}
+7 −0
Original line number Diff line number Diff line
@@ -296,6 +296,13 @@ static struct ctl_table kern_table[] = {
		.mode		= 0644,
		.proc_handler	= proc_dointvec,
	},
	{
		.procname	= "sched_wakeup_load_threshold",
		.data		= &sysctl_sched_wakeup_load_threshold,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec,
	},
#ifdef CONFIG_SCHED_DEBUG
	{
		.procname	= "sched_min_granularity_ns",