]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/suse-2.6.27.39/patches.fixes/cpufreq_ondemand_performance_optimise_default_settings.patch
Fix oinkmaster patch.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.fixes / cpufreq_ondemand_performance_optimise_default_settings.patch
1 From: Thomas Renninger <trenn@suse.de>
2 Subject: CPUFREQ: ondemand: Limit default sampling rate to 300ms max.
3 References: bnc#464461
4 Patch-Mainline: never, SLE11 only
5
6 HW cpufreq drivers (e.g. all non-acpi AMD) may report too high latency values.
7 The default sampling rate (how often the ondemand/conservative governor
8 checks for frequency adjustments) may therefore be much too high,
9 resulting in performance loss.
10
11 Restrict default sampling rate to 300ms. 333ms sampling rate is field
12 tested with userspace governors, 300ms should be a fine maximum default
13 value for the ondemand kernel governor for all HW out there.
14
15 Set default up_threshold to 40 on multi core systems.
16 This should avoid effects where two CPU intensive threads are waiting on
17 each other on separate cores. On a single core machine these would all be
18 processed on one core resulting in higher utilization of the one core.
19
20 ---
21 drivers/cpufreq/cpufreq_ondemand.c | 26 ++++++++++++++++++++++++++
22 1 file changed, 26 insertions(+)
23
24 Index: linux-2.6.27/drivers/cpufreq/cpufreq_ondemand.c
25 ===================================================================
26 --- linux-2.6.27.orig/drivers/cpufreq/cpufreq_ondemand.c
27 +++ linux-2.6.27/drivers/cpufreq/cpufreq_ondemand.c
28 @@ -58,6 +58,7 @@ static unsigned int def_sampling_rate;
29 #define MAX_SAMPLING_RATE (500 * def_sampling_rate)
30 #define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000)
31 #define TRANSITION_LATENCY_LIMIT (10 * 1000 * 1000)
32 +#define MAX_DEFAULT_SAMPLING_RATE (300 * 1000)
33
34 static void do_dbs_timer(struct work_struct *work);
35
36 @@ -558,6 +559,31 @@ static int cpufreq_governor_dbs(struct c
37 if (def_sampling_rate < MIN_STAT_SAMPLING_RATE)
38 def_sampling_rate = MIN_STAT_SAMPLING_RATE;
39
40 + /*
41 + * Cut def_sampling rate to 300ms if it was above,
42 + * still consider to not set it above latency
43 + * transition * 100
44 + */
45 + if (def_sampling_rate > MAX_DEFAULT_SAMPLING_RATE) {
46 + def_sampling_rate =
47 + (MAX_DEFAULT_SAMPLING_RATE < MINIMUM_SAMPLING_RATE)
48 + ? MINIMUM_SAMPLING_RATE : MAX_DEFAULT_SAMPLING_RATE;
49 + printk(KERN_INFO "CPUFREQ: ondemand sampling "
50 + "rate set to %d ms\n",
51 + def_sampling_rate / 1000);
52 + }
53 + /*
54 + * Be conservative in respect to performance.
55 + * If an application calculates using two threads
56 + * depending on each other, they will be run on several
57 + * CPU cores resulting on 50% load on both.
58 + * SLED might still want to prefer 80% up_threshold
59 + * by default, but we cannot differ that here.
60 + */
61 + if (num_online_cpus() > 1)
62 + dbs_tuners_ins.up_threshold =
63 + DEF_FREQUENCY_UP_THRESHOLD / 2;
64 +
65 dbs_tuners_ins.sampling_rate = def_sampling_rate;
66 }
67 dbs_timer_init(this_dbs_info);