All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ULOG] Use better value for 'nlbufsiz'
  2006-01-18 15:34 [ULOG] Use better value for nlbufsiz Holger Eitzenberger
@ 2006-01-18 15:34 ` Holger Eitzenberger
  2006-01-18 16:51   ` Patrick McHardy
  0 siblings, 1 reply; 6+ messages in thread
From: Holger Eitzenberger @ 2006-01-18 15:34 UTC (permalink / raw)
  To: netfilter-devel

Performance tests showed that ULOG may fail on heavy loaded systems
because of failed order-N allocations (N >= 1).

The default value of 4096 is not optimal in the sense that it actually
allocates _two_ contigous physical pages.  Reasoning: ULOG uses
alloc_skb(), which adds another ~300 bytes for skb_shared_info.

This patch sets the default value to 3700 and adds some documentation
at the top.

Signed-off-by: Holger Eitzenberger <heitzenberger@astaro.com>

---

 net/ipv4/netfilter/ipt_ULOG.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

4109f782faca0719825e39633d71b5e8b5dc74df
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
index 641dbc4..7a6adaf 100644
--- a/net/ipv4/netfilter/ipt_ULOG.c
+++ b/net/ipv4/netfilter/ipt_ULOG.c
@@ -35,6 +35,11 @@
  * each nlgroup you are using, so the total kernel memory usage increases
  * by that factor.
  *
+ * Actually you should use nlbufsiz a bit smaller than PAGE_SIZE, since
+ * nlbufsiz is used with alloc_skb, which adds another
+ * sizeof(struct skb_shared_info).  This is ~300 bytes on i386, so use a
+ * value of ~3700 instead.
+ *
  * flushtimeout:
  *   Specify, after how many hundredths of a second the queue should be
  *   flushed even if it is not full yet.
@@ -76,7 +81,7 @@ MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NE
 
 #define PRINTR(format, args...) do { if (net_ratelimit()) printk(format , ## args); } while (0)
 
-static unsigned int nlbufsiz = 4096;
+static unsigned int nlbufsiz = 3700;
 module_param(nlbufsiz, uint, 0400);
 MODULE_PARM_DESC(nlbufsiz, "netlink buffer size");
 
-- 
1.0.GIT

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] ULOG] Use better value for 'nlbufsiz'
  2006-01-18 15:34 ` [PATCH] ULOG] Use better value for 'nlbufsiz' Holger Eitzenberger
@ 2006-01-18 16:51   ` Patrick McHardy
  2006-01-18 17:07     ` Holger Eitzenberger
  0 siblings, 1 reply; 6+ messages in thread
From: Patrick McHardy @ 2006-01-18 16:51 UTC (permalink / raw)
  To: Holger Eitzenberger; +Cc: netfilter-devel

Holger Eitzenberger wrote:
> Performance tests showed that ULOG may fail on heavy loaded systems
> because of failed order-N allocations (N >= 1).
> 
> The default value of 4096 is not optimal in the sense that it actually
> allocates _two_ contigous physical pages.  Reasoning: ULOG uses
> alloc_skb(), which adds another ~300 bytes for skb_shared_info.
> 
> This patch sets the default value to 3700 and adds some documentation
> at the top.

I think we should just use NLMSG_GOODSIZE, which will use the maximum
amount to fit one page on any architecture.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ULOG] Use better value for 'nlbufsiz'
  2006-01-18 16:51   ` Patrick McHardy
@ 2006-01-18 17:07     ` Holger Eitzenberger
  0 siblings, 0 replies; 6+ messages in thread
From: Holger Eitzenberger @ 2006-01-18 17:07 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: netfilter-devel

On Wed, Jan 18, 2006 at 05:51:06PM +0100, Patrick McHardy wrote:

> > This patch sets the default value to 3700 and adds some documentation
> > at the top.
> 
> I think we should just use NLMSG_GOODSIZE, which will use the maximum
> amount to fit one page on any architecture.

This sounds reasonable.  I will resend.

/holger

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ULOG] Fix memory allocation bug - take two
@ 2006-01-18 17:27 Holger Eitzenberger
  2006-01-18 17:27 ` [PATCH] [ULOG] Use better value for 'nlbufsiz' Holger Eitzenberger
  0 siblings, 1 reply; 6+ messages in thread
From: Holger Eitzenberger @ 2006-01-18 17:27 UTC (permalink / raw)
  To: netfilter-devel

Hi,

this is resend of my previous patch which fixes a bug in the way 
ULOG does allocate memory.  It uses NLMSG_GOODSIZE to portably
determine the size of 'nlbufsiz'.  Thanks Patrick!

Please apply.

Thanks.  /holger

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] [ULOG] Use better value for 'nlbufsiz'
  2006-01-18 17:27 [ULOG] Fix memory allocation bug - take two Holger Eitzenberger
@ 2006-01-18 17:27 ` Holger Eitzenberger
  2006-01-18 17:33   ` Patrick McHardy
  0 siblings, 1 reply; 6+ messages in thread
From: Holger Eitzenberger @ 2006-01-18 17:27 UTC (permalink / raw)
  To: netfilter-devel

Performance tests showed that ULOG may fail on heavy loaded systems
because of failed order-N allocations (N >= 1).

The default value of 4096 is not optimal in the sense that it actually
allocates _two_ contigous physical pages.  Reasoning: ULOG uses
alloc_skb(), which adds another ~300 bytes for skb_shared_info.

This patch sets the default value to NLMSG_GOODSIZE and adds some
documentation at the top.

Signed-off-by: Holger Eitzenberger <heitzenberger@astaro.com>

---

 net/ipv4/netfilter/ipt_ULOG.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

d07d41421fb31a3759f66e41ebaea204c5d4146c
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
index 641dbc4..2fe6413 100644
--- a/net/ipv4/netfilter/ipt_ULOG.c
+++ b/net/ipv4/netfilter/ipt_ULOG.c
@@ -35,6 +35,10 @@
  * each nlgroup you are using, so the total kernel memory usage increases
  * by that factor.
  *
+ * Actually you should use nlbufsiz a bit smaller than PAGE_SIZE, since
+ * nlbufsiz is used with alloc_skb, which adds another
+ * sizeof(struct skb_shared_info).  Use NLMSG_GOODSIZE instead.
+ *
  * flushtimeout:
  *   Specify, after how many hundredths of a second the queue should be
  *   flushed even if it is not full yet.
@@ -76,7 +80,7 @@ MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NE
 
 #define PRINTR(format, args...) do { if (net_ratelimit()) printk(format , ## args); } while (0)
 
-static unsigned int nlbufsiz = 4096;
+static unsigned int nlbufsiz = NLMSG_GOODSIZE;
 module_param(nlbufsiz, uint, 0400);
 MODULE_PARM_DESC(nlbufsiz, "netlink buffer size");
 
-- 
1.0.GIT

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] [ULOG] Use better value for 'nlbufsiz'
  2006-01-18 17:27 ` [PATCH] [ULOG] Use better value for 'nlbufsiz' Holger Eitzenberger
@ 2006-01-18 17:33   ` Patrick McHardy
  0 siblings, 0 replies; 6+ messages in thread
From: Patrick McHardy @ 2006-01-18 17:33 UTC (permalink / raw)
  To: Holger Eitzenberger; +Cc: netfilter-devel

Holger Eitzenberger wrote:
> Performance tests showed that ULOG may fail on heavy loaded systems
> because of failed order-N allocations (N >= 1).
> 
> The default value of 4096 is not optimal in the sense that it actually
> allocates _two_ contigous physical pages.  Reasoning: ULOG uses
> alloc_skb(), which adds another ~300 bytes for skb_shared_info.
> 
> This patch sets the default value to NLMSG_GOODSIZE and adds some
> documentation at the top.

Applied, thanks Holger.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-01-18 17:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-18 17:27 [ULOG] Fix memory allocation bug - take two Holger Eitzenberger
2006-01-18 17:27 ` [PATCH] [ULOG] Use better value for 'nlbufsiz' Holger Eitzenberger
2006-01-18 17:33   ` Patrick McHardy
  -- strict thread matches above, loose matches on Subject: below --
2006-01-18 15:34 [ULOG] Use better value for nlbufsiz Holger Eitzenberger
2006-01-18 15:34 ` [PATCH] ULOG] Use better value for 'nlbufsiz' Holger Eitzenberger
2006-01-18 16:51   ` Patrick McHardy
2006-01-18 17:07     ` Holger Eitzenberger

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.