Commit f5a6e01c authored by Arjan van de Ven's avatar Arjan van de Ven Committed by David S. Miller

[NET]: user of the jiffies rounding code: Networking

This patch introduces users of the round_jiffies() function in the
networking code.

These timers all were of the "about once a second" or "about once
every X seconds" variety and several showed up in the "what wakes the
cpu up" profiles that the tickless patches provide.  Some timers are
highly dynamic based on network load; but even on low activity systems
they still show up so the rounding is done only in cases of low
activity, allowing higher frequency timers in the high activity case.

The various hardware watchdogs are an obvious case; they run every 2
seconds but aren't otherwise specific of exactly when they need to
run.
Signed-off-by: default avatarArjan van de Ven <arjan@linux.intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 104439a8
...@@ -99,7 +99,14 @@ static void dst_run_gc(unsigned long dummy) ...@@ -99,7 +99,14 @@ static void dst_run_gc(unsigned long dummy)
printk("dst_total: %d/%d %ld\n", printk("dst_total: %d/%d %ld\n",
atomic_read(&dst_total), delayed, dst_gc_timer_expires); atomic_read(&dst_total), delayed, dst_gc_timer_expires);
#endif #endif
mod_timer(&dst_gc_timer, jiffies + dst_gc_timer_expires); /* if the next desired timer is more than 4 seconds in the future
* then round the timer to whole seconds
*/
if (dst_gc_timer_expires > 4*HZ)
mod_timer(&dst_gc_timer,
round_jiffies(jiffies + dst_gc_timer_expires));
else
mod_timer(&dst_gc_timer, jiffies + dst_gc_timer_expires);
out: out:
spin_unlock(&dst_lock); spin_unlock(&dst_lock);
......
...@@ -696,7 +696,10 @@ static void neigh_periodic_timer(unsigned long arg) ...@@ -696,7 +696,10 @@ static void neigh_periodic_timer(unsigned long arg)
if (!expire) if (!expire)
expire = 1; expire = 1;
mod_timer(&tbl->gc_timer, now + expire); if (expire>HZ)
mod_timer(&tbl->gc_timer, round_jiffies(now + expire));
else
mod_timer(&tbl->gc_timer, now + expire);
write_unlock(&tbl->lock); write_unlock(&tbl->lock);
} }
......
...@@ -209,7 +209,7 @@ static void dev_watchdog(unsigned long arg) ...@@ -209,7 +209,7 @@ static void dev_watchdog(unsigned long arg)
dev->name); dev->name);
dev->tx_timeout(dev); dev->tx_timeout(dev);
} }
if (!mod_timer(&dev->watchdog_timer, jiffies + dev->watchdog_timeo)) if (!mod_timer(&dev->watchdog_timer, round_jiffies(jiffies + dev->watchdog_timeo)))
dev_hold(dev); dev_hold(dev);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment