public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@linux-foundation.org>
To: parag.warudkar@gmail.com
Cc: David Miller <davem@davemloft.net>,
	netdev@vger.kernel.org, akpm@linux-foundation.org
Subject: [PATCH 2/2] net: neighbor timer power saving
Date: Tue, 18 Dec 2007 18:18:45 -0800	[thread overview]
Message-ID: <20071218181845.2f1b539a@shemminger-laptop> (raw)
In-Reply-To: <20071218174120.4b0ef6dd@shemminger-laptop>

The neighbor GC timer runs once a second, but it doesn't need to wake
up the machine.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/net/core/neighbour.c	2007-12-18 07:46:07.000000000 -0800
+++ b/net/core/neighbour.c	2007-12-18 07:47:36.000000000 -0800
@@ -270,7 +270,7 @@ static struct neighbour *neigh_alloc(str
 	n->nud_state	  = NUD_NONE;
 	n->output	  = neigh_blackhole;
 	n->parms	  = neigh_parms_clone(&tbl->parms);
-	init_timer(&n->timer);
+	init_timer_deferrable(&n->timer);
 	n->timer.function = neigh_timer_handler;
 	n->timer.data	  = (unsigned long)n;
 
@@ -740,7 +740,7 @@ static void neigh_timer_handler(unsigned
 
 	state = neigh->nud_state;
 	now = jiffies;
-	next = now + HZ;
+	next = round_jiffies(now + HZ);
 
 	if (!(state & NUD_IN_TIMER)) {
 #ifndef CONFIG_SMP
@@ -1372,7 +1372,7 @@ void neigh_table_init_no_netlink(struct 
 	get_random_bytes(&tbl->hash_rnd, sizeof(tbl->hash_rnd));
 
 	rwlock_init(&tbl->lock);
-	init_timer(&tbl->gc_timer);
+	init_timer_deferrable(&tbl->gc_timer);
 	tbl->gc_timer.data     = (unsigned long)tbl;
 	tbl->gc_timer.function = neigh_periodic_timer;
 	tbl->gc_timer.expires  = now + 1;

  parent reply	other threads:[~2007-12-19  2:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-19  1:04 [PATCH] sch_generic.c: Make dev_watchdog use deferrable timer Parag Warudkar
2007-12-19  2:18 ` [PATCH 1/2] net: flow hash timer power saving Stephen Hemminger
     [not found] ` <20071218174120.4b0ef6dd@shemminger-laptop>
2007-12-19  2:18   ` Stephen Hemminger [this message]
2007-12-19  7:23     ` [PATCH 2/2] net: neighbor " Eric Dumazet
2007-12-20 17:10       ` Stephen Hemminger
2007-12-20 18:16         ` Parag Warudkar
2007-12-20 23:28       ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071218181845.2f1b539a@shemminger-laptop \
    --to=shemminger@linux-foundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=parag.warudkar@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox