All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: jdb@comx.dk
Cc: Netfilter Developers <netfilter-devel@vger.kernel.org>,
	Harald Welte <laforge@netfilter.org>,
	"Paul C. Diem" <PCDiem@FoxValley.net>,
	Martin Josefsson <gandalf@netfilter.org>
Subject: Re: [PATCH 2/2] iptables/libiptc perf issue: Finding jump chains is	suboptimal
Date: Wed, 28 Nov 2007 09:36:41 +0100	[thread overview]
Message-ID: <474D2899.3090607@trash.net> (raw)
In-Reply-To: <1196085406.3866.59.camel@localhost.localdomain>

Jesper Dangaard Brouer wrote:
> Performance optimize scalability issue:
>    Finding jump chains is suboptimal O(Chain*Rules).
> 
> diff --git a/libiptc/libiptc.c b/libiptc/libiptc.c
> index e7ffb01..e611178 100644
> --- a/libiptc/libiptc.c
> +++ b/libiptc/libiptc.c
> @@ -307,13 +307,20 @@ static struct rule_head *iptcc_get_rule_num_reverse(struct chain_head *c,
>  static struct chain_head *
>  iptcc_find_chain_by_offset(TC_HANDLE_T handle, unsigned int offset)
>  {
> -	struct list_head *pos;
> -
>  	if (list_empty(&handle->chains))
>  		return NULL;
>  
> -	list_for_each(pos, &handle->chains) {
> -		struct chain_head *c = list_entry(pos, struct chain_head, list);
> +	/* Find the entry pointed to by offset */
> +	STRUCT_ENTRY * e = iptcb_offset2entry(handle, offset);
> +
> +	/* When parsing the blob (in cache_add_entry), the entry
> +	   field comefrom has been modified to contain a pointer
> +	   to the chain it belongs to.
> +	*/
> +	struct chain_head *c = (struct chain_head *)e->comefrom;


As you mentioned in your other mail, this unfortunately doesn't
work on 64 bit since comefrom is an unsigned int and thus can't
hold a pointer. What might work (though pretty ugly) is splitting
up the pointer between nfcache and comefrom. This might need some
changes to the deletion code to make sure nfcache is not compared
on deletion.

      reply	other threads:[~2007-11-28  8:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-26 13:56 [PATCH 2/2] iptables/libiptc perf issue: Finding jump chains is suboptimal Jesper Dangaard Brouer
2007-11-28  8:36 ` Patrick McHardy [this message]

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=474D2899.3090607@trash.net \
    --to=kaber@trash.net \
    --cc=PCDiem@FoxValley.net \
    --cc=gandalf@netfilter.org \
    --cc=jdb@comx.dk \
    --cc=laforge@netfilter.org \
    --cc=netfilter-devel@vger.kernel.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.