aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2007-10-15 11:00:12 -0400
committerIngo Molnar <mingo@elte.hu>2007-10-15 11:00:12 -0400
commit5f6d858ecca78f71755859a346d845e302973cd1 (patch)
tree5422f6ff9aa7ffab4c708432de84a79e52e503d9 /kernel
parentb0ffd246ea947a037746e725bd461bb7e809a4b3 (diff)
sched: speed up and simplify vslice calculations
speed up and simplify vslice calculations. [ From: Mike Galbraith <efault@gmx.de>: build fix ] Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched_debug.c2
-rw-r--r--kernel/sched_fair.c15
-rw-r--r--kernel/sysctl.c9
3 files changed, 13 insertions, 13 deletions
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index be79cd6d9e80..995bbd384a97 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -210,7 +210,7 @@ static int sched_debug_show(struct seq_file *m, void *v)
210#define PN(x) \ 210#define PN(x) \
211 SEQ_printf(m, " .%-40s: %Ld.%06ld\n", #x, SPLIT_NS(x)) 211 SEQ_printf(m, " .%-40s: %Ld.%06ld\n", #x, SPLIT_NS(x))
212 PN(sysctl_sched_latency); 212 PN(sysctl_sched_latency);
213 PN(sysctl_sched_min_granularity); 213 PN(sysctl_sched_nr_latency);
214 PN(sysctl_sched_wakeup_granularity); 214 PN(sysctl_sched_wakeup_granularity);
215 PN(sysctl_sched_batch_wakeup_granularity); 215 PN(sysctl_sched_batch_wakeup_granularity);
216 PN(sysctl_sched_child_runs_first); 216 PN(sysctl_sched_child_runs_first);
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index ec0569e59e24..ae2d4b08e782 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -46,7 +46,7 @@ const_debug unsigned int sysctl_sched_child_runs_first = 1;
46 * Minimal preemption granularity for CPU-bound tasks: 46 * Minimal preemption granularity for CPU-bound tasks:
47 * (default: 2 msec, units: nanoseconds) 47 * (default: 2 msec, units: nanoseconds)
48 */ 48 */
49unsigned int sysctl_sched_min_granularity __read_mostly = 2000000ULL; 49const_debug unsigned int sysctl_sched_nr_latency = 20;
50 50
51/* 51/*
52 * sys_sched_yield() compat mode 52 * sys_sched_yield() compat mode
@@ -222,8 +222,7 @@ static inline struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq)
222static u64 __sched_period(unsigned long nr_running) 222static u64 __sched_period(unsigned long nr_running)
223{ 223{
224 u64 period = sysctl_sched_latency; 224 u64 period = sysctl_sched_latency;
225 unsigned long nr_latency = 225 unsigned long nr_latency = sysctl_sched_nr_latency;
226 sysctl_sched_latency / sysctl_sched_min_granularity;
227 226
228 if (unlikely(nr_running > nr_latency)) { 227 if (unlikely(nr_running > nr_latency)) {
229 period *= nr_running; 228 period *= nr_running;
@@ -245,11 +244,15 @@ static u64 sched_slice(struct cfs_rq *cfs_rq, struct sched_entity *se)
245 244
246static u64 __sched_vslice(unsigned long nr_running) 245static u64 __sched_vslice(unsigned long nr_running)
247{ 246{
248 u64 period = __sched_period(nr_running); 247 unsigned long period = sysctl_sched_latency;
248 unsigned long nr_latency = sysctl_sched_nr_latency;
249 249
250 do_div(period, nr_running); 250 if (unlikely(nr_running > nr_latency))
251 nr_running = nr_latency;
251 252
252 return period; 253 period /= nr_running;
254
255 return (u64)period;
253} 256}
254 257
255/* 258/*
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 97b15c27407f..230ca4eb57fe 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -222,14 +222,11 @@ static ctl_table kern_table[] = {
222#ifdef CONFIG_SCHED_DEBUG 222#ifdef CONFIG_SCHED_DEBUG
223 { 223 {
224 .ctl_name = CTL_UNNUMBERED, 224 .ctl_name = CTL_UNNUMBERED,
225 .procname = "sched_min_granularity_ns", 225 .procname = "sched_nr_latency",
226 .data = &sysctl_sched_min_granularity, 226 .data = &sysctl_sched_nr_latency,
227 .maxlen = sizeof(unsigned int), 227 .maxlen = sizeof(unsigned int),
228 .mode = 0644, 228 .mode = 0644,
229 .proc_handler = &proc_dointvec_minmax, 229 .proc_handler = &proc_dointvec,
230 .strategy = &sysctl_intvec,
231 .extra1 = &min_sched_granularity_ns,
232 .extra2 = &max_sched_granularity_ns,
233 }, 230 },
234 { 231 {
235 .ctl_name = CTL_UNNUMBERED, 232 .ctl_name = CTL_UNNUMBERED,