All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: xiaosuo@gmail.com, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] netfilter: use idr instead of list to speed up packet lookup by id
Date: Wed, 07 Apr 2010 15:03:16 +0200	[thread overview]
Message-ID: <4BBC8294.50501@trash.net> (raw)
In-Reply-To: <1270643136.2091.1013.camel@edumazet-laptop>

Eric Dumazet wrote:
> Le mercredi 07 avril 2010 à 13:48 +0200, Patrick McHardy a écrit :
>> Changli Gao wrote:
>>> use idr instead of list to speed up packet lookup by id.
>>>
>>> The current implementations of nfnetlink_queue, ip_queue and ip6_queue
>>> are all use list to save the packets queued. If the verdicts aren't
>>> received in order, the lookup for the corresponding packets isn't
>>> efficient. As the ids is generated and maintained in kernel, we can use
>>> idr to speed up the lookup. The side effect of this patch is fixing the
>>> potential id overlap in nfnetlink_queue.
>> I'm interested in how this affects performance for the vast majority
>> of users, which process messages in order. A simple hash table looks
>> like a better choice here since we know the maximum number of entries
>> in advance and also could have the user specify the desired hash size.
> 
> Yes, a hash table would be good, but cost 8 bytes per slot.
> 
> Changli, did you tried RBL tree ? It might fit better both your needs
> and Patrick concerns...

RB-trees OTOH cost 8 bytes extra per element. If we'd use a hash,
I think the size should be configurable by userspace and default
to 1 (simple list as used currently). That way only those people
actually processing packets out of order have to pay the price.
But an RB-tree would be fine too I guess.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-04-07 13:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-07  3:38 [PATCH] netfilter: use idr instead of list to speed up packet lookup by id Changli Gao
2010-04-07 11:48 ` Patrick McHardy
2010-04-07 12:25   ` Eric Dumazet
2010-04-07 13:03     ` Patrick McHardy [this message]
2010-04-07 13:42     ` Changli Gao
2010-04-07 13:30   ` Changli Gao
2010-04-07 13:40     ` Patrick McHardy
2010-04-07 14:07       ` Changli Gao
2010-04-07 14:16         ` Patrick McHardy
2010-04-07 14:33           ` Changli Gao
2010-04-07 14:41             ` Patrick McHardy

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=4BBC8294.50501@trash.net \
    --to=kaber@trash.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=xiaosuo@gmail.com \
    /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.