All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Josefsson <gandalf@wlug.westbo.se>
To: Netfilter-devel <netfilter-devel@lists.samba.org>
Subject: [PATCH] remove exessive timer updates (3/4)
Date: 06 Jun 2002 14:24:04 +0200	[thread overview]
Message-ID: <1023365846.845.26.camel@tux> (raw)

[-- 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);
 		}

             reply	other threads:[~2002-06-06 12:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-06 12:24 Martin Josefsson [this message]
2002-06-08  7:37 ` [PATCH] remove exessive timer updates (3/4) 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

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=1023365846.845.26.camel@tux \
    --to=gandalf@wlug.westbo.se \
    --cc=netfilter-devel@lists.samba.org \
    /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 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.