All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] remove exessive timer updates (3/4)
@ 2002-06-06 12:24 Martin Josefsson
  2002-06-08  7:37 ` Harald Welte
  2002-06-11  7:59 ` Harald Welte
  0 siblings, 2 replies; 10+ messages in thread
From: Martin Josefsson @ 2002-06-06 12:24 UTC (permalink / raw)
  To: Netfilter-devel

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

Here's the patch that lead up to the first patch (the renaming of
death_by_timeout and exporting it).

This patch adds a check to ip_ct_refresh() so it doesn't update the
timer of a connection unless it's been >HZ ticks since the last update.
both del_timer() and add_timer() disables interrupts while
removing/inserting the timer, no reason to do this for each packet.

-- 
/Martin

Never argue with an idiot. They drag you down to their level, then beat
you with experience.

[-- Attachment #2: ip_conntrack_core.c-timer-diff --]
[-- Type: text/plain, Size: 736 bytes --]

--- linux-2.4.19-pre9/net/ipv4/netfilter/ip_conntrack_core.c.orig	Mon Jun  3 20:32:28 2002
+++ linux-2.4.19-pre9/net/ipv4/netfilter/ip_conntrack_core.c	Mon Jun  3 20:48:13 2002
@@ -1091,8 +1091,10 @@
 	if (!is_confirmed(ct))
 		ct->timeout.expires = extra_jiffies;
 	else {
-		/* Need del_timer for race avoidance (may already be dying). */
-		if (del_timer(&ct->timeout)) {
+		/* Don't update timer for each packet, only if it's been >HZ
+		 * ticks since last update.
+		 * Need del_timer for race avoidance (may already be dying). */
+		if (time_after(jiffies, ct->timeout.expires - extra_jiffies + HZ) && del_timer(&ct->timeout)) {
 			ct->timeout.expires = jiffies + extra_jiffies;
 			add_timer(&ct->timeout);
 		}

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

end of thread, other threads:[~2002-06-13 16:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-06 12:24 [PATCH] remove exessive timer updates (3/4) Martin Josefsson
2002-06-08  7:37 ` Harald Welte
2002-06-08 15:03   ` Martin Josefsson
2002-06-09 17:17     ` Harald Welte
2002-06-11  7:59 ` Harald Welte
2002-06-11 22:21   ` Henrik Nordstrom
2002-06-12  9:10     ` Martin Josefsson
2002-06-12 19:02       ` Martin Josefsson
2002-06-13 12:07         ` Henrik Nordstrom
2002-06-13 16:17           ` Martin Josefsson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.