Contents of /trunk/kernel26-magellan-server/patches-2.6.25-r4/0302-2.6.25-powertop-fixes.patch
Parent Directory | Revision Log
Revision 665 -
(show annotations)
(download)
Wed Jul 30 14:06:06 2008 UTC (16 years, 2 months ago) by niro
File size: 4595 byte(s)
Wed Jul 30 14:06:06 2008 UTC (16 years, 2 months ago) by niro
File size: 4595 byte(s)
-2.6.25-magellan-r4; updated to linux-2.6.25.10
1 | From e6f2ff1e4763212f1dcc945db76fb744b951ac53 Mon Sep 17 00:00:00 2001 |
2 | From: Josh Triplett <josh@freedesktop.org> |
3 | Date: Sun, 13 May 2007 15:21:39 -0700 |
4 | Subject: [PATCH] Lengthen and align background timers to decrease wakeups |
5 | |
6 | This patch changes a few background timers in the Linux kernel to |
7 | 1) be aligned to full seconds so that multiple timers get handled in one |
8 | processor wakeup |
9 | 2) have longer timeouts for those timers that can use such longer timeouts |
10 | |
11 | Some of these are a bit crude, but it's effective. |
12 | |
13 | Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> |
14 | [Josh: Updates for 2.6.22-rc1] |
15 | Signed-off-by: Josh Triplett <josh@kernel.org> |
16 | --- |
17 | kernel/time/clocksource.c | 10 ++++++++-- |
18 | mm/page-writeback.c | 8 ++++---- |
19 | mm/slab.c | 6 +++--- |
20 | net/core/neighbour.c | 4 ++-- |
21 | 4 files changed, 17 insertions(+), 11 deletions(-) |
22 | |
23 | diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c |
24 | index 3db5c3c..77308c4 100644 |
25 | --- a/kernel/time/clocksource.c |
26 | +++ b/kernel/time/clocksource.c |
27 | @@ -79,11 +79,17 @@ static int watchdog_resumed; |
28 | /* |
29 | * Interval: 0.5sec Threshold: 0.0625s |
30 | */ |
31 | -#define WATCHDOG_INTERVAL (HZ >> 1) |
32 | +#define WATCHDOG_INTERVAL (HZ*10) |
33 | #define WATCHDOG_THRESHOLD (NSEC_PER_SEC >> 4) |
34 | |
35 | +static int secondtime; |
36 | + |
37 | static void clocksource_ratewd(struct clocksource *cs, int64_t delta) |
38 | { |
39 | + if (!secondtime) { |
40 | + secondtime = 1; |
41 | + return; |
42 | + }; |
43 | if (delta > -WATCHDOG_THRESHOLD && delta < WATCHDOG_THRESHOLD) |
44 | return; |
45 | |
46 | @@ -145,7 +151,7 @@ static void clocksource_watchdog(unsigned long data) |
47 | |
48 | if (!list_empty(&watchdog_list)) { |
49 | __mod_timer(&watchdog_timer, |
50 | - watchdog_timer.expires + WATCHDOG_INTERVAL); |
51 | + round_jiffies(watchdog_timer.expires + WATCHDOG_INTERVAL)); |
52 | } |
53 | spin_unlock(&watchdog_lock); |
54 | } |
55 | diff --git a/mm/page-writeback.c b/mm/page-writeback.c |
56 | index eec1481..26318e5 100644 |
57 | --- a/mm/page-writeback.c |
58 | +++ b/mm/page-writeback.c |
59 | @@ -77,7 +77,7 @@ int vm_dirty_ratio = 10; |
60 | /* |
61 | * The interval between `kupdate'-style writebacks, in jiffies |
62 | */ |
63 | -int dirty_writeback_interval = 5 * HZ; |
64 | +int dirty_writeback_interval = 15 * HZ; |
65 | |
66 | /* |
67 | * The longest number of jiffies for which data is allowed to remain dirty |
68 | @@ -450,7 +450,7 @@ static void wb_kupdate(unsigned long arg) |
69 | |
70 | oldest_jif = jiffies - dirty_expire_interval; |
71 | start_jif = jiffies; |
72 | - next_jif = start_jif + dirty_writeback_interval; |
73 | + next_jif = round_jiffies(start_jif + dirty_writeback_interval); |
74 | nr_to_write = global_page_state(NR_FILE_DIRTY) + |
75 | global_page_state(NR_UNSTABLE_NFS) + |
76 | (inodes_stat.nr_inodes - inodes_stat.nr_unused); |
77 | @@ -467,7 +467,7 @@ static void wb_kupdate(unsigned long arg) |
78 | nr_to_write -= MAX_WRITEBACK_PAGES - wbc.nr_to_write; |
79 | } |
80 | if (time_before(next_jif, jiffies + HZ)) |
81 | - next_jif = jiffies + HZ; |
82 | + next_jif = round_jiffies(jiffies + HZ); |
83 | if (dirty_writeback_interval) |
84 | mod_timer(&wb_timer, next_jif); |
85 | } |
86 | @@ -491,7 +491,7 @@ int dirty_writeback_centisecs_handler(ctl_table *table, int write, |
87 | static void wb_timer_fn(unsigned long unused) |
88 | { |
89 | if (pdflush_operation(wb_kupdate, 0) < 0) |
90 | - mod_timer(&wb_timer, jiffies + HZ); /* delay 1 second */ |
91 | + mod_timer(&wb_timer, round_jiffies(jiffies + HZ)); /* delay 1 second */ |
92 | } |
93 | |
94 | static void laptop_flush(unsigned long unused) |
95 | diff --git a/mm/slab.c b/mm/slab.c |
96 | index 944b205..6003eef 100644 |
97 | --- a/mm/slab.c |
98 | +++ b/mm/slab.c |
99 | @@ -467,8 +467,8 @@ struct kmem_cache { |
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 | @@ -959,7 +959,7 @@ static void __devinit start_cpu_timer(int cpu) |
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 --git a/net/core/neighbour.c b/net/core/neighbour.c |
120 | index 6f3bb73..e6aaa9c 100644 |
121 | --- a/net/core/neighbour.c |
122 | +++ b/net/core/neighbour.c |
123 | @@ -696,10 +696,10 @@ next_elt: |
124 | if (!expire) |
125 | expire = 1; |
126 | |
127 | - if (expire>HZ) |
128 | + if (expire>4*HZ) |
129 | mod_timer(&tbl->gc_timer, round_jiffies(now + expire)); |
130 | else |
131 | - mod_timer(&tbl->gc_timer, now + expire); |
132 | + mod_timer(&tbl->gc_timer, round_jiffies(now + 4*HZ)); |
133 | |
134 | write_unlock(&tbl->lock); |
135 | } |
136 | -- |
137 | 1.5.2-rc2.GIT |
138 |