sched: add sysctl for controlling task migrations on wake

The PF_WAKE_UP_IDLE per-task flag made it impossible to enable
the old behavior of SD_SHARE_PKG_RESOURCES, where every task
migrates to an idle CPU on wakeup.

The sched_wake_to_idle sysctl value, when made nonzero, will cause
all tasks to migrate to an idle CPU if one is available when the
task is woken up. This is regardless of how PF_WAKE_UP_IDLE is
configured for tasks in the system. Similar to PF_WAKE_UP_IDLE,
the SD_SHARE_PKG_RESOURCES scheduler domain flag must be enabled
for the sysctl value to have an effect.

Change-Id: I23bed846d26502c7aed600bfcf1c13053a7e5f61
Signed-off-by: Steve Muckle <smuckle@codeaurora.org>
(cherry picked from commit 9d5b38dc0025d19df5b756b16024b4269e73f282)

Conflicts:

	kernel/sched/fair.c
This commit is contained in:
Steve Muckle 2012-10-24 15:00:20 -07:00 committed by Stephen Boyd
parent d282c8eea2
commit f79da145a4
3 changed files with 18 additions and 1 deletions

View File

@ -35,6 +35,7 @@ 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;
extern unsigned int sysctl_sched_wake_to_idle;
enum sched_tunable_scaling {
SCHED_TUNABLESCALING_NONE,

View File

@ -79,6 +79,14 @@ static unsigned int sched_nr_latency = 8;
*/
unsigned int sysctl_sched_child_runs_first __read_mostly;
/*
* Controls whether, when SD_SHARE_PKG_RESOURCES is on, if all
* tasks go to idle CPUs when woken. If this is off, note that the
* per-task flag PF_WAKE_ON_IDLE can still cause a task to go to an
* idle CPU upon being woken.
*/
unsigned int __read_mostly sysctl_sched_wake_to_idle;
/*
* SCHED_OTHER wake-up granularity.
* (default: 1 msec * (1 + ilog(ncpus)), units: nanoseconds)
@ -3287,7 +3295,8 @@ static int select_idle_sibling(struct task_struct *p, int target)
if (i != target && cpus_share_cache(i, target) && idle_cpu(i))
return i;
if (!(current->flags & PF_WAKE_UP_IDLE) &&
if (!sysctl_sched_wake_to_idle &&
!(current->flags & PF_WAKE_UP_IDLE) &&
!(p->flags & PF_WAKE_UP_IDLE))
return target;

View File

@ -280,6 +280,13 @@ static struct ctl_table kern_table[] = {
.mode = 0644,
.proc_handler = proc_dointvec,
},
{
.procname = "sched_wake_to_idle",
.data = &sysctl_sched_wake_to_idle,
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_dointvec,
},
#ifdef CONFIG_SCHED_DEBUG
{
.procname = "sched_min_granularity_ns",