netfilter: x_tables: remove XT_TABLE_INFO_SZ and a dereference.
authorEric Dumazet <edumazet@google.com>
Mon, 15 Jun 2015 16:57:30 +0000 (09:57 -0700)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 15 Jun 2015 18:19:20 +0000 (20:19 +0200)
After Florian patches, there is no need for XT_TABLE_INFO_SZ anymore :
Only one copy of table is kept, instead of one copy per cpu.

We also can avoid a dereference if we put table data right after
xt_table_info. It reduces register pressure and helps compiler.

Then, we attempt a kmalloc() if total size is under order-3 allocation,
to reduce TLB pressure, as in many cases, rules fit in 32 KB.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/linux/netfilter/x_tables.h
net/ipv4/netfilter/arp_tables.c
net/ipv4/netfilter/ip_tables.c
net/ipv6/netfilter/ip6_tables.c
net/netfilter/x_tables.c

index 9969d79..95693c4 100644 (file)
@@ -225,12 +225,9 @@ struct xt_table_info {
        unsigned int __percpu *stackptr;
        void ***jumpstack;
 
-       /* Note : this field MUST be the last one, see XT_TABLE_INFO_SZ */
-       void *entries;
+       unsigned char entries[0] __aligned(8);
 };
 
-#define XT_TABLE_INFO_SZ (offsetof(struct xt_table_info, entries) \
-                         + nr_cpu_ids * sizeof(char *))
 int xt_register_target(struct xt_target *target);
 void xt_unregister_target(struct xt_target *target);
 int xt_register_targets(struct xt_target *target, unsigned int n);
Simple merge
Simple merge
Simple merge
Simple merge