aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2007-10-15 11:00:02 -0400
committerIngo Molnar <mingo@elte.hu>2007-10-15 11:00:02 -0400
commit2bd8e6d422a4f44c0994f909317eba80b0fe08a1 (patch)
tree3548dd01c056e3f7c3c04fd85cc4726b95677c15
parent38ad464d410dadceda1563f36bdb0be7fe4c8938 (diff)
sched: use constants if !CONFIG_SCHED_DEBUG
use constants if !CONFIG_SCHED_DEBUG. this speeds up the code and reduces code-size: text data bss dec hex filename 27464 3014 16 30494 771e sched.o.before 26929 3010 20 29959 7507 sched.o.after Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Mike Galbraith <efault@gmx.de> Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--include/linux/sched.h5
-rw-r--r--kernel/sched.c6
-rw-r--r--kernel/sched_fair.c28
3 files changed, 24 insertions, 15 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 9761b165d563..befca3f9364a 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1402,15 +1402,18 @@ static inline void idle_task_exit(void) {}
1402 1402
1403extern void sched_idle_next(void); 1403extern void sched_idle_next(void);
1404 1404
1405#ifdef CONFIG_SCHED_DEBUG
1405extern unsigned int sysctl_sched_latency; 1406extern unsigned int sysctl_sched_latency;
1406extern unsigned int sysctl_sched_min_granularity; 1407extern unsigned int sysctl_sched_min_granularity;
1407extern unsigned int sysctl_sched_wakeup_granularity; 1408extern unsigned int sysctl_sched_wakeup_granularity;
1408extern unsigned int sysctl_sched_batch_wakeup_granularity; 1409extern unsigned int sysctl_sched_batch_wakeup_granularity;
1409extern unsigned int sysctl_sched_stat_granularity; 1410extern unsigned int sysctl_sched_stat_granularity;
1410extern unsigned int sysctl_sched_runtime_limit; 1411extern unsigned int sysctl_sched_runtime_limit;
1411extern unsigned int sysctl_sched_compat_yield;
1412extern unsigned int sysctl_sched_child_runs_first; 1412extern unsigned int sysctl_sched_child_runs_first;
1413extern unsigned int sysctl_sched_features; 1413extern unsigned int sysctl_sched_features;
1414#endif
1415
1416extern unsigned int sysctl_sched_compat_yield;
1414 1417
1415#ifdef CONFIG_RT_MUTEXES 1418#ifdef CONFIG_RT_MUTEXES
1416extern int rt_mutex_getprio(struct task_struct *p); 1419extern int rt_mutex_getprio(struct task_struct *p);
diff --git a/kernel/sched.c b/kernel/sched.c
index 2520923a0c3b..ae1544f0a20d 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1659,12 +1659,6 @@ void sched_fork(struct task_struct *p, int clone_flags)
1659} 1659}
1660 1660
1661/* 1661/*
1662 * After fork, child runs first. (default) If set to 0 then
1663 * parent will (try to) run first.
1664 */
1665unsigned int __read_mostly sysctl_sched_child_runs_first = 1;
1666
1667/*
1668 * wake_up_new_task - wake up a newly created task for the first time. 1662 * wake_up_new_task - wake up a newly created task for the first time.
1669 * 1663 *
1670 * This function will do some initial scheduler statistics housekeeping 1664 * This function will do some initial scheduler statistics housekeeping
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 5c15d8ae92cb..2e84aaffe425 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -21,6 +21,15 @@
21 */ 21 */
22 22
23/* 23/*
24 * Tunables that become constants when CONFIG_SCHED_DEBUG is off:
25 */
26#ifdef CONFIG_SCHED_DEBUG
27# define const_debug __read_mostly
28#else
29# define const_debug static const
30#endif
31
32/*
24 * Targeted preemption latency for CPU-bound tasks: 33 * Targeted preemption latency for CPU-bound tasks:
25 * (default: 20ms, units: nanoseconds) 34 * (default: 20ms, units: nanoseconds)
26 * 35 *
@@ -34,7 +43,13 @@
34 * systems, 4x on 8-way systems, 5x on 16-way systems, etc.) 43 * systems, 4x on 8-way systems, 5x on 16-way systems, etc.)
35 * Targeted preemption latency for CPU-bound tasks: 44 * Targeted preemption latency for CPU-bound tasks:
36 */ 45 */
37unsigned int sysctl_sched_latency __read_mostly = 20000000ULL; 46const_debug unsigned int sysctl_sched_latency = 20000000ULL;
47
48/*
49 * After fork, child runs first. (default) If set to 0 then
50 * parent will (try to) run first.
51 */
52const_debug unsigned int sysctl_sched_child_runs_first = 1;
38 53
39/* 54/*
40 * Minimal preemption granularity for CPU-bound tasks: 55 * Minimal preemption granularity for CPU-bound tasks:
@@ -58,7 +73,7 @@ unsigned int __read_mostly sysctl_sched_compat_yield;
58 * and reduces their over-scheduling. Synchronous workloads will still 73 * and reduces their over-scheduling. Synchronous workloads will still
59 * have immediate wakeup/sleep latencies. 74 * have immediate wakeup/sleep latencies.
60 */ 75 */
61unsigned int sysctl_sched_batch_wakeup_granularity __read_mostly = 25000000UL; 76const_debug unsigned int sysctl_sched_batch_wakeup_granularity = 25000000UL;
62 77
63/* 78/*
64 * SCHED_OTHER wake-up granularity. 79 * SCHED_OTHER wake-up granularity.
@@ -68,13 +83,10 @@ unsigned int sysctl_sched_batch_wakeup_granularity __read_mostly = 25000000UL;
68 * and reduces their over-scheduling. Synchronous workloads will still 83 * and reduces their over-scheduling. Synchronous workloads will still
69 * have immediate wakeup/sleep latencies. 84 * have immediate wakeup/sleep latencies.
70 */ 85 */
71unsigned int sysctl_sched_wakeup_granularity __read_mostly = 1000000UL; 86const_debug unsigned int sysctl_sched_wakeup_granularity = 1000000UL;
72 87
73unsigned int sysctl_sched_stat_granularity __read_mostly; 88const_debug unsigned int sysctl_sched_stat_granularity;
74 89
75/*
76 * Initialized in sched_init_granularity() [to 5 times the base granularity]:
77 */
78unsigned int sysctl_sched_runtime_limit __read_mostly; 90unsigned int sysctl_sched_runtime_limit __read_mostly;
79 91
80/* 92/*
@@ -89,7 +101,7 @@ enum {
89 SCHED_FEAT_SKIP_INITIAL = 32, 101 SCHED_FEAT_SKIP_INITIAL = 32,
90}; 102};
91 103
92unsigned int sysctl_sched_features __read_mostly = 104const_debug unsigned int sysctl_sched_features =
93 SCHED_FEAT_FAIR_SLEEPERS *1 | 105 SCHED_FEAT_FAIR_SLEEPERS *1 |
94 SCHED_FEAT_SLEEPER_AVG *0 | 106 SCHED_FEAT_SLEEPER_AVG *0 |
95 SCHED_FEAT_SLEEPER_LOAD_AVG *1 | 107 SCHED_FEAT_SLEEPER_LOAD_AVG *1 |