Skip to content

Commit

Permalink
3.18-sched-bfs-460
Browse files Browse the repository at this point in the history
  • Loading branch information
ckolivas authored and kernelOfTruth committed Feb 15, 2015
1 parent bfa76d4 commit b994347
Show file tree
Hide file tree
Showing 29 changed files with 8,191 additions and 76 deletions.
347 changes: 347 additions & 0 deletions Documentation/scheduler/sched-BFS.txt

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions Documentation/sysctl/kernel.txt
Expand Up @@ -38,6 +38,7 @@ show up in /proc/sys/kernel:
- hung_task_timeout_secs
- hung_task_warnings
- kexec_load_disabled
- iso_cpu
- kptr_restrict
- kstack_depth_to_print [ X86 only ]
- l2cr [ PPC only ]
Expand Down Expand Up @@ -66,6 +67,7 @@ show up in /proc/sys/kernel:
- randomize_va_space
- real-root-dev ==> Documentation/initrd.txt
- reboot-cmd [ SPARC only ]
- rr_interval
- rtsig-max
- rtsig-nr
- sem
Expand Down Expand Up @@ -382,6 +384,16 @@ kernel stack.

==============================================================

iso_cpu: (BFS CPU scheduler only).

This sets the percentage cpu that the unprivileged SCHED_ISO tasks can
run effectively at realtime priority, averaged over a rolling five
seconds over the -whole- system, meaning all cpus.

Set to 70 (percent) by default.

==============================================================

l2cr: (PPC only)

This flag controls the L2 cache of G3 processor boards. If
Expand Down Expand Up @@ -714,6 +726,20 @@ rebooting. ???

==============================================================

rr_interval: (BFS CPU scheduler only)

This is the smallest duration that any cpu process scheduling unit
will run for. Increasing this value can increase throughput of cpu
bound tasks substantially but at the expense of increased latencies
overall. Conversely decreasing it will decrease average and maximum
latencies but at the expense of throughput. This value is in
milliseconds and the default value chosen depends on the number of
cpus available at scheduler initialisation with a minimum of 6.

Valid values are from 1-1000.

==============================================================

rtsig-max & rtsig-nr:

The file rtsig-max can be used to tune the maximum number
Expand Down
5 changes: 0 additions & 5 deletions arch/powerpc/platforms/cell/spufs/sched.c
Expand Up @@ -63,11 +63,6 @@ static struct task_struct *spusched_task;
static struct timer_list spusched_timer;
static struct timer_list spuloadavg_timer;

/*
* Priority of a normal, non-rt, non-niced'd process (aka nice level 0).
*/
#define NORMAL_PRIO 120

/*
* Frequency of the spu scheduler tick. By default we do one SPU scheduler
* tick for every 10 CPU scheduler ticks.
Expand Down
22 changes: 19 additions & 3 deletions arch/x86/Kconfig
Expand Up @@ -840,10 +840,26 @@ config SCHED_SMT
depends on X86_HT
---help---
SMT scheduler support improves the CPU scheduler's decision making
when dealing with Intel Pentium 4 chips with HyperThreading at a
when dealing with Intel P4/Core 2 chips with HyperThreading at a
cost of slightly increased overhead in some places. If unsure say
N here.

config SMT_NICE
bool "SMT (Hyperthreading) aware nice priority and policy support"
depends on X86_HT && SCHED_BFS && SCHED_SMT
default y
---help---
Enabling Hyperthreading on Intel CPUs decreases the effectiveness
of the use of 'nice' levels and different scheduling policies
(e.g. realtime) due to sharing of CPU power between hyperthreads.
SMT nice support makes each logical CPU aware of what is running on
its hyperthread siblings, maintaining appropriate distribution of
CPU according to nice levels and scheduling policies at the expense
of slightly increased overhead.

If unsure say Y here.


config SCHED_MC
def_bool y
prompt "Multi-core scheduler support"
Expand Down Expand Up @@ -1903,7 +1919,7 @@ config HOTPLUG_CPU
config BOOTPARAM_HOTPLUG_CPU0
bool "Set default setting of cpu0_hotpluggable"
default n
depends on HOTPLUG_CPU
depends on HOTPLUG_CPU && !SCHED_BFS
---help---
Set whether default state of cpu0_hotpluggable is on or off.

Expand Down Expand Up @@ -1932,7 +1948,7 @@ config BOOTPARAM_HOTPLUG_CPU0
config DEBUG_HOTPLUG_CPU0
def_bool n
prompt "Debug CPU0 hotplug"
depends on HOTPLUG_CPU
depends on HOTPLUG_CPU && !SCHED_BFS
---help---
Enabling this option offlines CPU0 (if CPU0 can be offlined) as
soon as possible and boots up userspace with CPU0 offlined. User
Expand Down
7 changes: 7 additions & 0 deletions drivers/cpufreq/cpufreq.c
Expand Up @@ -25,6 +25,7 @@
#include <linux/kernel_stat.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/suspend.h>
#include <linux/tick.h>
Expand Down Expand Up @@ -1986,6 +1987,12 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
}

out:
if (likely(retval != -EINVAL)) {
if (target_freq == policy->max)
cpu_nonscaling(policy->cpu);
else
cpu_scaling(policy->cpu);
}
return retval;
}
EXPORT_SYMBOL_GPL(__cpufreq_driver_target);
Expand Down
4 changes: 2 additions & 2 deletions drivers/cpufreq/cpufreq_conservative.c
Expand Up @@ -15,8 +15,8 @@
#include "cpufreq_governor.h"

/* Conservative governor macros */
#define DEF_FREQUENCY_UP_THRESHOLD (80)
#define DEF_FREQUENCY_DOWN_THRESHOLD (20)
#define DEF_FREQUENCY_UP_THRESHOLD (63)
#define DEF_FREQUENCY_DOWN_THRESHOLD (26)
#define DEF_FREQUENCY_STEP (5)
#define DEF_SAMPLING_DOWN_FACTOR (1)
#define MAX_SAMPLING_DOWN_FACTOR (10)
Expand Down
4 changes: 2 additions & 2 deletions drivers/cpufreq/cpufreq_ondemand.c
Expand Up @@ -19,7 +19,7 @@
#include "cpufreq_governor.h"

/* On-demand governor macros */
#define DEF_FREQUENCY_UP_THRESHOLD (80)
#define DEF_FREQUENCY_UP_THRESHOLD (63)
#define DEF_SAMPLING_DOWN_FACTOR (1)
#define MAX_SAMPLING_DOWN_FACTOR (100000)
#define MICRO_FREQUENCY_UP_THRESHOLD (95)
Expand Down Expand Up @@ -148,7 +148,7 @@ static void dbs_freq_increase(struct cpufreq_policy *policy, unsigned int freq)
}

/*
* Every sampling_rate, we check, if current idle time is less than 20%
* Every sampling_rate, we check, if current idle time is less than 37%
* (default), then we try to increase frequency. Else, we adjust the frequency
* proportional to load.
*/
Expand Down
9 changes: 7 additions & 2 deletions drivers/cpufreq/intel_pstate.c
Expand Up @@ -492,8 +492,13 @@ static void byt_set_pstate(struct cpudata *cpudata, int pstate)
vid_fp = clamp_t(int32_t, vid_fp, cpudata->vid.min, cpudata->vid.max);
vid = ceiling_fp(vid_fp);

if (pstate > cpudata->pstate.max_pstate)
vid = cpudata->vid.turbo;
if (pstate < cpudata->pstate.max_pstate)
cpu_scaling(cpudata->cpu);
else {
if (pstate > cpudata->pstate.max_pstate)
vid = cpudata->vid.turbo;
cpu_nonscaling(cpudata->cpu);
}

val |= vid;

Expand Down
2 changes: 1 addition & 1 deletion fs/proc/base.c
Expand Up @@ -310,7 +310,7 @@ static int proc_pid_schedstat(struct seq_file *m, struct pid_namespace *ns,
struct pid *pid, struct task_struct *task)
{
return seq_printf(m, "%llu %llu %lu\n",
(unsigned long long)task->se.sum_exec_runtime,
(unsigned long long)tsk_seruntime(task),
(unsigned long long)task->sched_info.run_delay,
task->sched_info.pcount);
}
Expand Down
66 changes: 63 additions & 3 deletions include/linux/init_task.h
Expand Up @@ -156,8 +156,6 @@ extern struct task_group root_task_group;
# define INIT_VTIME(tsk)
#endif

#define INIT_TASK_COMM "swapper"

#ifdef CONFIG_RT_MUTEXES
# define INIT_RT_MUTEXES(tsk) \
.pi_waiters = RB_ROOT, \
Expand All @@ -179,6 +177,68 @@ extern struct task_group root_task_group;
* INIT_TASK is used to set up the first task table, touch at
* your own risk!. Base=0, limit=0x1fffff (=2MB)
*/
#ifdef CONFIG_SCHED_BFS
#define INIT_TASK_COMM "BFS"
#define INIT_TASK(tsk) \
{ \
.state = 0, \
.stack = &init_thread_info, \
.usage = ATOMIC_INIT(2), \
.flags = PF_KTHREAD, \
.prio = NORMAL_PRIO, \
.static_prio = MAX_PRIO-20, \
.normal_prio = NORMAL_PRIO, \
.deadline = 0, \
.policy = SCHED_NORMAL, \
.cpus_allowed = CPU_MASK_ALL, \
.mm = NULL, \
.active_mm = &init_mm, \
.run_list = LIST_HEAD_INIT(tsk.run_list), \
.time_slice = HZ, \
.tasks = LIST_HEAD_INIT(tsk.tasks), \
INIT_PUSHABLE_TASKS(tsk) \
.ptraced = LIST_HEAD_INIT(tsk.ptraced), \
.ptrace_entry = LIST_HEAD_INIT(tsk.ptrace_entry), \
.real_parent = &tsk, \
.parent = &tsk, \
.children = LIST_HEAD_INIT(tsk.children), \
.sibling = LIST_HEAD_INIT(tsk.sibling), \
.group_leader = &tsk, \
RCU_POINTER_INITIALIZER(real_cred, &init_cred), \
RCU_POINTER_INITIALIZER(cred, &init_cred), \
.comm = INIT_TASK_COMM, \
.thread = INIT_THREAD, \
.fs = &init_fs, \
.files = &init_files, \
.signal = &init_signals, \
.sighand = &init_sighand, \
.nsproxy = &init_nsproxy, \
.pending = { \
.list = LIST_HEAD_INIT(tsk.pending.list), \
.signal = {{0}}}, \
.blocked = {{0}}, \
.alloc_lock = __SPIN_LOCK_UNLOCKED(tsk.alloc_lock), \
.journal_info = NULL, \
.cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \
.pi_lock = __RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock), \
.timer_slack_ns = 50000, /* 50 usec default slack */ \
.pids = { \
[PIDTYPE_PID] = INIT_PID_LINK(PIDTYPE_PID), \
[PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID), \
[PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \
}, \
.thread_group = LIST_HEAD_INIT(tsk.thread_group), \
.thread_node = LIST_HEAD_INIT(init_signals.thread_head), \
INIT_IDS \
INIT_PERF_EVENTS(tsk) \
INIT_TRACE_IRQFLAGS \
INIT_LOCKDEP \
INIT_FTRACE_GRAPH \
INIT_TRACE_RECURSION \
INIT_TASK_RCU_PREEMPT(tsk) \
}
#else /* CONFIG_SCHED_BFS */
#define INIT_TASK_COMM "swapper"
#define INIT_TASK(tsk) \
{ \
.state = 0, \
Expand Down Expand Up @@ -248,7 +308,7 @@ extern struct task_group root_task_group;
INIT_VTIME(tsk) \
INIT_NUMA_BALANCING(tsk) \
}

#endif /* CONFIG_SCHED_BFS */

#define INIT_CPU_TIMERS(cpu_timers) \
{ \
Expand Down
2 changes: 2 additions & 0 deletions include/linux/ioprio.h
Expand Up @@ -52,6 +52,8 @@ enum {
*/
static inline int task_nice_ioprio(struct task_struct *task)
{
if (iso_task(task))
return 0;
return (task_nice(task) + 20) / 5;
}

Expand Down
2 changes: 1 addition & 1 deletion include/linux/jiffies.h
Expand Up @@ -163,7 +163,7 @@ static inline u64 get_jiffies_64(void)
* Have the 32 bit jiffies value wrap 5 minutes after boot
* so jiffies wrap bugs show up earlier.
*/
#define INITIAL_JIFFIES ((unsigned long)(unsigned int) (-300*HZ))
#define INITIAL_JIFFIES ((unsigned long)(unsigned int) (-10*HZ))

/*
* Change timeval to jiffies, trying to avoid the
Expand Down

0 comments on commit b994347

Please sign in to comment.