netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Network stack timer hacks for power saving
@ 2009-05-19  8:13 Tero.Kristo
  2009-05-19  9:04 ` Eric Dumazet
  0 siblings, 1 reply; 4+ messages in thread
From: Tero.Kristo @ 2009-05-19  8:13 UTC (permalink / raw)
  To: netdev

[-- Attachment #1: Type: text/plain, Size: 514 bytes --]

Hi,

I have been looking at network stack timer optimization for 
power saving in embedded ARM environment, basically trying to 
avoid as many wakeups as possible. I have changed several 
timers in the network stack into deferred ones, i.e. they do 
not wake up the device from low power modes but instead they 
are deferred until next wakeup from some other source, like 
another (non-deferred) timer or some I/O. Attached a patch 
about the changes I've done, is something like this safe to do?

-Tero

[-- Attachment #2: 0001-Network-stack-timer-optimizations-for-power-saving.patch --]
[-- Type: application/octet-stream, Size: 2685 bytes --]

From 92856356359fd3dd4e859119676a5fa7aee3ba79 Mon Sep 17 00:00:00 2001
From: Tero Kristo <tero.kristo@nokia.com>
Date: Wed, 13 May 2009 15:39:00 +0300
Subject: [PATCH] Network stack timer optimizations for power saving

Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
---
 net/core/flow.c          |    1 +
 net/core/neighbour.c     |    1 +
 net/ipv4/inet_fragment.c |    1 +
 net/ipv4/inetpeer.c      |    1 +
 net/ipv4/route.c         |    1 +
 5 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/net/core/flow.c b/net/core/flow.c
index 5cf8105..44d963c 100644
--- a/net/core/flow.c
+++ b/net/core/flow.c
@@ -352,6 +352,7 @@ static int __init flow_cache_init(void)
 	flow_hwm = 4 * flow_hash_size;
 
 	setup_timer(&flow_hash_rnd_timer, flow_cache_new_hashrnd, 0);
+	init_timer_deferrable(&flow_hash_rnd_timer);
 	flow_hash_rnd_timer.expires = jiffies + FLOW_HASH_RND_PERIOD;
 	add_timer(&flow_hash_rnd_timer);
 
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 1dc728b..c9217d7 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1445,6 +1445,7 @@ void neigh_table_init_no_netlink(struct neigh_table *tbl)
 
 	rwlock_init(&tbl->lock);
 	setup_timer(&tbl->gc_timer, neigh_periodic_timer, (unsigned long)tbl);
+	init_timer_deferrable(&tbl->gc_timer);
 	tbl->gc_timer.expires  = now + 1;
 	add_timer(&tbl->gc_timer);
 
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index 6c52e08..91a099f 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -64,6 +64,7 @@ void inet_frags_init(struct inet_frags *f)
 
 	setup_timer(&f->secret_timer, inet_frag_secret_rebuild,
 			(unsigned long)f);
+	init_timer_deferrable(&f->secret_timer);
 	f->secret_timer.expires = jiffies + f->secret_interval;
 	add_timer(&f->secret_timer);
 }
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index a456cee..19eea7c 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -125,6 +125,7 @@ void __init inet_initpeers(void)
 	/* All the timers, started at system startup tend
 	   to synchronize. Perturb it a bit.
 	 */
+	init_timer_deferrable(&peer_periodic_timer);
 	peer_periodic_timer.expires = jiffies
 		+ net_random() % inet_peer_gc_maxtime
 		+ inet_peer_gc_maxtime;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 2ea6dcc..792bd7e 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -3288,6 +3288,7 @@ int __init ip_rt_init(void)
 	/* All the timers, started at system startup tend
 	   to synchronize. Perturb it a bit.
 	 */
+	INIT_DELAYED_WORK_DEFERRABLE(&expires_work, rt_worker_func);
 	schedule_delayed_work(&expires_work,
 		net_random() % ip_rt_gc_interval + ip_rt_gc_interval);
 
-- 
1.5.4.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-05-19 18:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-19  8:13 Network stack timer hacks for power saving Tero.Kristo
2009-05-19  9:04 ` Eric Dumazet
2009-05-19  9:46   ` Tero.Kristo
2009-05-19 18:56     ` [PATCH] net: use a deferred timer in rt_check_expire Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).