Linux Netfilter development
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: jdb@comx.dk
Cc: Netfilter Developers <netfilter-devel@vger.kernel.org>
Subject: Re: [PATCH 2/2] Fix scalability performance issue during initial ruleset parsing.
Date: Thu, 03 Jul 2008 20:33:03 +0200	[thread overview]
Message-ID: <486D1B5F.1030900@trash.net> (raw)
In-Reply-To: <1215028647.9467.6.camel@localhost.localdomain>

Jesper Dangaard Brouer wrote:
>  Finding jump chains is slow O(Chain*Rules).
> 
> The problem:
>  is that the chain list is searched lineary for each rule with a jump
>  target. The problem lies in the "second pass" (of function
>  parse_table) where the userchain jump targets are found. For each
>  rule "R" with a IPTCC_R_JUMP target, function
>  iptcc_find_chain_by_offset() searches through the chains "C" in the
>  chain list (worst-case hitting the last one).
> 
> The solution:
>  in this patch is to speed up iptcc_find_chain_by_offset() by using
>  binary search. Reducing complexity from O(C) to O(log C).
> 
> Implementation:
>  Its possible to use the same bsearch algorithm and data structure
>  (chain_index), as used for chain name searching.
> 
> How is that possible:
>  One has to realize that the chains are both sorted by name and
>  offsets, this is because the chains are already sorted in the ruleset
>  from the kernel.

Nice work, and clever :) Applied, thanks.

      reply	other threads:[~2008-07-03 18:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-02 19:57 [PATCH 2/2] Fix scalability performance issue during initial ruleset parsing Jesper Dangaard Brouer
2008-07-03 18:33 ` 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=486D1B5F.1030900@trash.net \
    --to=kaber@trash.net \
    --cc=jdb@comx.dk \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox