From: Patrick McHardy <kaber@trash.net>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org, holger@eitzenberger.org
Subject: Re: [PATCH] [PATCH] dynamic calculation of event message size for ctnetlink
Date: Tue, 17 Mar 2009 13:03:52 +0100 [thread overview]
Message-ID: <49BF91A8.2070900@trash.net> (raw)
In-Reply-To: <20090317094909.6434.27331.stgit@Decadence>
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 inline size_t
> +ctnetlink_calculate_room_size(const struct nf_conn *ct, unsigned long events)
> +{
> + size_t size = NLMSG_SPACE(sizeof(struct nfgenmsg));
> +
> + size += calculate_tuple_room_size(ct) * 2 + /* original and reply */
> + nla_total_size(sizeof(u_int32_t)) + /* status */
> + nla_total_size(sizeof(u_int32_t)); /* id */
> +
> +#ifdef CONFIG_NF_CONNTRACK_MARK
> + if (events & IPCT_MARK || ct->mark)
> + size += nla_total_size(sizeof(u_int32_t));
> +#endif
> +
> + if (events & IPCT_DESTROY) {
> + const struct nf_conn_counter *acct;
> +
> + acct = nf_conn_acct_find(ct);
> + if (acct) {
> + size += nla_total_size(0) * 2 +
> + nla_total_size(sizeof(u_int64_t)) * 2 * 2;
> + }
> + return size;
> + }
> +...
Holger's patch pre-calculates things where possible, which reduces
run-time overhead.
> I'm not sure about this. Instead, I noticed with oprofile that we spend
> more cycles to calculate the message size. I think it's more like a
> trade-off, reducing the message size to what we need reduces the chances
> to hit ENOBUFS.
"More cycles" is to be expected for calculation (which is not done
so far), but summed up, I always suspected a measurement error and
I'd be surprised if this is correct.
So we so far have your numbers, which showed a regression, and no
numbers from Holger, which is slightly better :)
OK seriously, we need *some* numbers showing an improvement since I
have basically zero base to decide between your patches, besides the
fact that its to be expected that Holger's will be slightly faster.
next prev parent reply other threads:[~2009-03-17 12:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-17 9:49 [PATCH] [PATCH] dynamic calculation of event message size for ctnetlink Pablo Neira Ayuso
2009-03-17 12:03 ` Patrick McHardy [this message]
2009-03-17 12:09 ` Pablo Neira Ayuso
2009-03-17 12:14 ` Holger Eitzenberger
2009-03-17 12:16 ` Patrick McHardy
2009-03-17 22:38 ` Pablo Neira Ayuso
2009-03-18 4:41 ` Patrick McHardy
2009-03-18 8:38 ` Holger Eitzenberger
2009-03-25 17:22 ` 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=49BF91A8.2070900@trash.net \
--to=kaber@trash.net \
--cc=holger@eitzenberger.org \
--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 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.