From: Patrick McHardy <kaber@trash.net>
To: Thomas Jarosch <thomas.jarosch@intra2net.com>
Cc: netfilter-devel@lists.netfilter.org
Subject: Re: ipt_ACCOUNT accounting target released
Date: Wed, 28 Apr 2004 00:16:44 +0200 [thread overview]
Message-ID: <408EDBCC.8050502@trash.net> (raw)
In-Reply-To: <200404271012.29136.thomas.jarosch@intra2net.com>
Thomas Jarosch wrote:
> Thanks for your reply. I'll fix the coding style
> and will post a new patch soon.
Thanks.
> Premature optimization is the root of all evil ;-)
> Is see what I can do, but IMHO this will increase
> the complexity of the ipt_account_handle_get_data() function.
>
>>Why does it need a PAGE_SIZE >= 4096 ?
>
> The internal data layout for a 8 bit network (256 hosts/CLASS C) is
> designed to fit into a kernel zero page. As the code is designed for constant
> (meaning every second/every 10 seconds) readout of the data,
> kmalloc would be too expensive as snapshots of the data are created.
Are you sure kmalloc is too slow for once a second allocations ?
Or could this be a premature optimization ? ;) Anyway, PAGE_SIZE
is a constant so you can check at compile time:
#if (PAGE_SIZE < 4096)
#error "..."
#endif
One more thing:
if (copy_to_user(...))
{
printk("ACCOUNT: ...");
Just return -EFAULT.
if (handle.handle_nr >= ACCOUNT_MAX_HANDLES)
{
printk("ACCOUNT: ...);
-EINVAL.
Regards
Patrick
next prev parent reply other threads:[~2004-04-27 22:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-13 15:31 ipt_ACCOUNT accounting target released Thomas Jarosch
2004-04-26 11:36 ` Thomas Jarosch
2004-04-27 0:59 ` Patrick McHardy
2004-04-27 8:12 ` Thomas Jarosch
2004-04-27 22:16 ` Patrick McHardy [this message]
2004-05-14 16:26 ` Thomas Jarosch
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=408EDBCC.8050502@trash.net \
--to=kaber@trash.net \
--cc=netfilter-devel@lists.netfilter.org \
--cc=thomas.jarosch@intra2net.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.