Commit c2db2924 authored by Holger Eitzenberger's avatar Holger Eitzenberger Committed by David S. Miller

[NETFILTER]: ULOG/nfnetlink_log: Use better default value for 'nlbufsiz'

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: default avatarHolger Eitzenberger <heitzenberger@astaro.com>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ddc8d029
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
#define PRINTR(format, args...) do { if (net_ratelimit()) \ #define PRINTR(format, args...) do { if (net_ratelimit()) \
printk(format , ## args); } while (0) printk(format , ## args); } while (0)
static unsigned int nlbufsiz = 4096; static unsigned int nlbufsiz = NLMSG_GOODSIZE;
module_param(nlbufsiz, uint, 0600); module_param(nlbufsiz, uint, 0600);
MODULE_PARM_DESC(nlbufsiz, "netlink buffer size (number of bytes) " MODULE_PARM_DESC(nlbufsiz, "netlink buffer size (number of bytes) "
"(defaults to 4096)"); "(defaults to 4096)");
......
...@@ -35,6 +35,10 @@ ...@@ -35,6 +35,10 @@
* each nlgroup you are using, so the total kernel memory usage increases * each nlgroup you are using, so the total kernel memory usage increases
* by that factor. * 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: * flushtimeout:
* Specify, after how many hundredths of a second the queue should be * Specify, after how many hundredths of a second the queue should be
* flushed even if it is not full yet. * flushed even if it is not full yet.
...@@ -76,7 +80,7 @@ MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_NFLOG); ...@@ -76,7 +80,7 @@ MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_NFLOG);
#define PRINTR(format, args...) do { if (net_ratelimit()) printk(format , ## args); } while (0) #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_param(nlbufsiz, uint, 0400);
MODULE_PARM_DESC(nlbufsiz, "netlink buffer size"); MODULE_PARM_DESC(nlbufsiz, "netlink buffer size");
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include "../bridge/br_private.h" #include "../bridge/br_private.h"
#endif #endif
#define NFULNL_NLBUFSIZ_DEFAULT 4096 #define NFULNL_NLBUFSIZ_DEFAULT NLMSG_GOODSIZE
#define NFULNL_TIMEOUT_DEFAULT 100 /* every second */ #define NFULNL_TIMEOUT_DEFAULT 100 /* every second */
#define NFULNL_QTHRESH_DEFAULT 100 /* 100 packets */ #define NFULNL_QTHRESH_DEFAULT 100 /* 100 packets */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment