]> www.infradead.org Git - users/dwmw2/linux.git/commit
netfilter: nf_tables: do not store nft_ctx in transaction objects
authorFlorian Westphal <fw@strlen.de>
Mon, 13 May 2024 13:00:51 +0000 (15:00 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 25 Jun 2024 18:40:47 +0000 (20:40 +0200)
commite169285f8c56b8d5702475de0582dc83650c6cee
treef24fd990c4f6c68c02ca9928b37c77ccff4954b1
parent0be908750162ed08ef0dfdec68e1619c8f693f83
netfilter: nf_tables: do not store nft_ctx in transaction objects

nft_ctx is huge and most of the information stored within isn't used
at all.

Remove nft_ctx member from the base transaction structure and store
only what is needed.

After this change, relevant struct sizes are:

struct nft_trans_chain { /* size: 120 (-32), cachelines: 2, members: 10 */
struct nft_trans_elem { /* size: 72 (-40), cachelines: 2, members: 4 */
struct nft_trans_flowtable { /* size: 80 (-48), cachelines: 2, members: 5 */
struct nft_trans_obj { /* size: 72 (-40), cachelines: 2, members: 4 */
struct nft_trans_rule { /* size: 80 (-32), cachelines: 2, members: 6 */
struct nft_trans_set { /* size: 96 (-24), cachelines: 2, members: 8 */
struct nft_trans_table { /* size: 56 (-40), cachelines: 1, members: 2 */

struct nft_trans_elem can now be allocated from kmalloc-96 instead of
kmalloc-128 slab.
A further reduction by 8 bytes would even allow for kmalloc-64.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/net/netfilter/nf_tables.h
net/netfilter/nf_tables_api.c
net/netfilter/nf_tables_offload.c