Magellan Linux

Contents of /trunk/kernel26-alx/patches-2.6.26-r1/0302-2.6.26-powertop-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 681 - (show annotations) (download)
Wed Sep 17 19:42:13 2008 UTC (15 years, 7 months ago) by niro
File size: 4567 byte(s)
-2.6.26-alx-r1

1 Original Note:
2
3 From e6f2ff1e4763212f1dcc945db76fb744b951ac53 Mon Sep 17 00:00:00 2001
4 From: Josh Triplett <josh@freedesktop.org>
5 Date: Sun, 13 May 2007 15:21:39 -0700
6 Subject: [PATCH] Lengthen and align background timers to decrease wakeups
7
8 This patch changes a few background timers in the Linux kernel to
9 1) be aligned to full seconds so that multiple timers get handled in one
10 processor wakeup
11 2) have longer timeouts for those timers that can use such longer timeouts
12
13 Some of these are a bit crude, but it's effective.
14
15 Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
16 [Josh: Updates for 2.6.22-rc1]
17 Signed-off-by: Josh Triplett <josh@kernel.org>
18 ---
19 kernel/time/clocksource.c | 10 ++++++++--
20 mm/page-writeback.c | 8 ++++----
21 mm/slab.c | 6 +++---
22 net/core/neighbour.c | 4 ++--
23 4 files changed, 17 insertions(+), 11 deletions(-)
24
25
26 diff -Naur linux-2.6.26/kernel/time/clocksource.c linux-2.6.26-magellan/kernel/time/clocksource.c
27 --- linux-2.6.26/kernel/time/clocksource.c 2008-07-13 23:51:29.000000000 +0200
28 +++ linux-2.6.26-magellan/kernel/time/clocksource.c 2008-08-24 20:11:45.000000000 +0200
29 @@ -79,11 +79,17 @@
30 /*
31 * Interval: 0.5sec Threshold: 0.0625s
32 */
33 -#define WATCHDOG_INTERVAL (HZ >> 1)
34 +#define WATCHDOG_INTERVAL (HZ*10)
35 #define WATCHDOG_THRESHOLD (NSEC_PER_SEC >> 4)
36
37 +static int secondtime;
38 +
39 static void clocksource_ratewd(struct clocksource *cs, int64_t delta)
40 {
41 + if (!secondtime) {
42 + secondtime = 1;
43 + return;
44 + };
45 if (delta > -WATCHDOG_THRESHOLD && delta < WATCHDOG_THRESHOLD)
46 return;
47
48 @@ -149,7 +155,7 @@
49
50 if (next_cpu >= NR_CPUS)
51 next_cpu = first_cpu(cpu_online_map);
52 - watchdog_timer.expires += WATCHDOG_INTERVAL;
53 + round_jiffies(watchdog_timer.expires + WATCHDOG_INTERVAL);
54 add_timer_on(&watchdog_timer, next_cpu);
55 }
56 spin_unlock(&watchdog_lock);
57 diff -Naur linux-2.6.26/mm/page-writeback.c linux-2.6.26-magellan/mm/page-writeback.c
58 --- linux-2.6.26/mm/page-writeback.c 2008-07-13 23:51:29.000000000 +0200
59 +++ linux-2.6.26-magellan/mm/page-writeback.c 2008-08-24 20:13:16.000000000 +0200
60 @@ -82,7 +82,7 @@
61 /*
62 * The interval between `kupdate'-style writebacks, in jiffies
63 */
64 -int dirty_writeback_interval = 5 * HZ;
65 +int dirty_writeback_interval = 15 * HZ;
66
67 /*
68 * The longest number of jiffies for which data is allowed to remain dirty
69 @@ -702,7 +702,7 @@
70
71 oldest_jif = jiffies - dirty_expire_interval;
72 start_jif = jiffies;
73 - next_jif = start_jif + dirty_writeback_interval;
74 + next_jif = round_jiffies(start_jif + dirty_writeback_interval);
75 nr_to_write = global_page_state(NR_FILE_DIRTY) +
76 global_page_state(NR_UNSTABLE_NFS) +
77 (inodes_stat.nr_inodes - inodes_stat.nr_unused);
78 @@ -720,7 +720,7 @@
79 nr_to_write -= MAX_WRITEBACK_PAGES - wbc.nr_to_write;
80 }
81 if (time_before(next_jif, jiffies + HZ))
82 - next_jif = jiffies + HZ;
83 + next_jif = round_jiffies(jiffies + HZ);
84 if (dirty_writeback_interval)
85 mod_timer(&wb_timer, next_jif);
86 }
87 @@ -742,7 +742,7 @@
88 static void wb_timer_fn(unsigned long unused)
89 {
90 if (pdflush_operation(wb_kupdate, 0) < 0)
91 - mod_timer(&wb_timer, jiffies + HZ); /* delay 1 second */
92 + mod_timer(&wb_timer, round_jiffies(jiffies + HZ)); /* delay 1 second */
93 }
94
95 static void laptop_flush(unsigned long unused)
96 diff -Naur linux-2.6.26/mm/slab.c linux-2.6.26-magellan/mm/slab.c
97 --- linux-2.6.26/mm/slab.c 2008-07-13 23:51:29.000000000 +0200
98 +++ linux-2.6.26-magellan/mm/slab.c 2008-08-24 20:14:42.000000000 +0200
99 @@ -463,8 +463,8 @@
100 * OTOH the cpuarrays can contain lots of objects,
101 * which could lock up otherwise freeable slabs.
102 */
103 -#define REAPTIMEOUT_CPUC (2*HZ)
104 -#define REAPTIMEOUT_LIST3 (4*HZ)
105 +#define REAPTIMEOUT_CPUC (12*HZ)
106 +#define REAPTIMEOUT_LIST3 (20*HZ)
107
108 #if STATS
109 #define STATS_INC_ACTIVE(x) ((x)->num_active++)
110 @@ -943,7 +943,7 @@
111 init_reap_node(cpu);
112 INIT_DELAYED_WORK(reap_work, cache_reap);
113 schedule_delayed_work_on(cpu, reap_work,
114 - __round_jiffies_relative(HZ, cpu));
115 + __round_jiffies_relative(HZ*4, cpu));
116 }
117 }
118
119 diff -Naur linux-2.6.26/net/core/neighbour.c linux-2.6.26-magellan/net/core/neighbour.c
120 --- linux-2.6.26/net/core/neighbour.c 2008-07-13 23:51:29.000000000 +0200
121 +++ linux-2.6.26-magellan/net/core/neighbour.c 2008-08-24 20:15:41.000000000 +0200
122 @@ -757,10 +757,10 @@
123 if (!expire)
124 expire = 1;
125
126 - if (expire>HZ)
127 + if (expire>4*HZ)
128 mod_timer(&tbl->gc_timer, round_jiffies(now + expire));
129 else
130 - mod_timer(&tbl->gc_timer, now + expire);
131 + mod_timer(&tbl->gc_timer, round_jiffies(now + 4*HZ));
132
133 write_unlock(&tbl->lock);
134 }