From: Patrick McHardy <kaber@trash.net>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 7/8] [PATCH] dynamic calculation of event message size for ctnetlink
Date: Tue, 18 Nov 2008 12:01:12 +0100 [thread overview]
Message-ID: <4922A078.5090603@trash.net> (raw)
In-Reply-To: <49223799.70505@netfilter.org>
Pablo Neira Ayuso wrote:
> Patrick McHardy wrote:
>> Pablo Neira Ayuso wrote:
>>> This patch adds dynamic message size calculation for ctnetlink. This
>>> reduces CPU consumption since the overhead in the message trimming
>>> is removed.
>>>
>>> static int ctnetlink_conntrack_event(struct notifier_block *this,
>>> unsigned long events, void *ptr)
>>> {
>>> @@ -437,7 +538,7 @@ static int ctnetlink_conntrack_event(struct
>>> notifier_block *this,
>>> if (!nfnetlink_has_listeners(group))
>>> return NOTIFY_DONE;
>>>
>>> - skb = alloc_skb(NLMSG_GOODSIZE, GFP_ATOMIC);
>>> + skb = alloc_skb(ctnetlink_calculate_room_size(ct, events),
>>> GFP_ATOMIC);
>>> if (!skb)
>>> return NOTIFY_DONE;
>> These calculations look somewhat expensive to perform for every message.
>> Do you have any numbers for this new patch that shows the difference
>> in CPU usage compared to the resizing done by af_netlink.c?
>
> Fabian Hugelshofer reported some reduction (~5%) on an embedded
> environment but he was using top to measure the difference. I'll collect
> some more trustable data and get back to you.
Thanks.
>> Since many of these are static in size an alternative would be to
>> update those sizes during protocol/helper/whatever (un)registration.
>> But if this patch already improves things, we can put it in and work
>> on perfecting it later :)
>
> We can same save some branches doing so, but still ctnetlink has a lot
> of attributes that are dependent of the message type.
Indeed. But f.i. all the ->size(void) functions could obviously be
constants.
> What if we reduce the size of the skb allocated for netlink to more
> reasonable size instead of the accurate calculation? I'll check this
> possibility.
I don't think we need to be 100% accurate, just find a good middle
ground between grossly overallocating and the resulting unnecessary
copy, potentially expensive size calculations and socket memory waste.
> BTW, probably you already know, but in case that you try to use oprofile
> with your current tree, since it is based on 2.6.28-rc2, oprofile was
> broken here, I had to pull the fixes from somewhere else.
I'll probably merge what I have to Dave soon so I can resync with
his tree.
next prev parent reply other threads:[~2008-11-18 11:01 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-17 8:39 [PATCH 1/8] [PATCH] use nf_conntrack_get instead of atomic_inc Pablo Neira Ayuso
2008-11-17 8:39 ` [PATCH 2/8] [PATCH] use EOPNOTSUPP instead of EINVAL if the conntrack has no helper Pablo Neira Ayuso
2008-11-17 14:56 ` Patrick McHardy
2008-11-17 8:40 ` [PATCH 3/8] [PATCH] get rid of module refcounting in ctnetlink Pablo Neira Ayuso
2008-11-17 15:01 ` Patrick McHardy
2008-11-17 8:40 ` [PATCH 4/8] [PATCH] connection tracking helper name persistent aliases Pablo Neira Ayuso
2008-11-17 15:02 ` Patrick McHardy
2008-11-17 8:40 ` [PATCH 5/8] [PATCH] Helper modules load-on-demand support for ctnetlink Pablo Neira Ayuso
2008-11-17 8:55 ` Alexey Dobriyan
2008-11-17 15:24 ` Patrick McHardy
2008-11-17 8:41 ` [PATCH 6/8] [PATCH] deliver events for conntracks created via ctnetlink Pablo Neira Ayuso
2008-11-17 8:41 ` [PATCH 7/8] [PATCH] dynamic calculation of event message size for ctnetlink Pablo Neira Ayuso
2008-11-17 8:44 ` David Miller
2008-11-17 15:32 ` Patrick McHardy
2008-11-18 3:33 ` Pablo Neira Ayuso
2008-11-18 10:21 ` Pablo Neira Ayuso
2008-11-18 11:03 ` Patrick McHardy
2008-11-19 0:03 ` Pablo Neira Ayuso
2008-11-19 12:05 ` Patrick McHardy
2008-11-18 11:01 ` Patrick McHardy [this message]
2008-11-17 8:42 ` [PATCH 8/8] [PATCH] bump the expectation helper name Pablo Neira Ayuso
2008-11-17 14:55 ` [PATCH 1/8] [PATCH] use nf_conntrack_get instead of atomic_inc Patrick McHardy
-- strict thread matches above, loose matches on Subject: below --
2008-10-09 8:33 [PATCH 1/8] [PATCH] get rid of module refcounting in ctnetlink Pablo Neira Ayuso
2008-10-09 8:35 ` [PATCH 7/8] [PATCH] dynamic calculation of event message size for ctnetlink Pablo Neira Ayuso
2008-10-09 16:45 ` Pablo Neira Ayuso
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=4922A078.5090603@trash.net \
--to=kaber@trash.net \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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;
as well as URLs for NNTP newsgroup(s).