diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2007-08-25 12:41:53 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2007-08-25 12:41:53 -0400 |
commit | 218050855ece4e923106ab614ac65afa0f618df3 (patch) | |
tree | f7b1234ce9e8ad0bc5d5af949949251240ec6a2c /kernel/sched.c | |
parent | 1fc84aaae3bae9646dd4c7798b8c0ff934338909 (diff) |
sched: adaptive scheduler granularity
Instead of specifying the preemption granularity, specify the wanted
latency. By fixing the granlarity to a constany the wakeup latency
it a function of the number of running tasks on the rq.
Invert this relation.
sysctl_sched_granularity becomes a minimum for the dynamic granularity
computed from the new sysctl_sched_latency.
Then use this latency to do more intelligent granularity decisions: if
there are fewer tasks running then we can schedule coarser. This helps
performance while still always keeping the latency target.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 6798328a2e0e..da26f46d50d7 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -4911,14 +4911,18 @@ cpumask_t nohz_cpu_mask = CPU_MASK_NONE; | |||
4911 | static inline void sched_init_granularity(void) | 4911 | static inline void sched_init_granularity(void) |
4912 | { | 4912 | { |
4913 | unsigned int factor = 1 + ilog2(num_online_cpus()); | 4913 | unsigned int factor = 1 + ilog2(num_online_cpus()); |
4914 | const unsigned long gran_limit = 100000000; | 4914 | const unsigned long limit = 100000000; |
4915 | 4915 | ||
4916 | sysctl_sched_granularity *= factor; | 4916 | sysctl_sched_granularity *= factor; |
4917 | if (sysctl_sched_granularity > gran_limit) | 4917 | if (sysctl_sched_granularity > limit) |
4918 | sysctl_sched_granularity = gran_limit; | 4918 | sysctl_sched_granularity = limit; |
4919 | 4919 | ||
4920 | sysctl_sched_runtime_limit = sysctl_sched_granularity * 5; | 4920 | sysctl_sched_latency *= factor; |
4921 | sysctl_sched_wakeup_granularity = sysctl_sched_granularity / 2; | 4921 | if (sysctl_sched_latency > limit) |
4922 | sysctl_sched_latency = limit; | ||
4923 | |||
4924 | sysctl_sched_runtime_limit = sysctl_sched_latency * 5; | ||
4925 | sysctl_sched_wakeup_granularity = sysctl_sched_latency / 2; | ||
4922 | } | 4926 | } |
4923 | 4927 | ||
4924 | #ifdef CONFIG_SMP | 4928 | #ifdef CONFIG_SMP |