]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
netfilter: flowtable: dedicated slab for flow entry
authorQingfang Deng <dqfext@gmail.com>
Fri, 30 Jan 2026 07:22:07 +0000 (15:22 +0800)
committerFlorian Westphal <fw@strlen.de>
Fri, 6 Feb 2026 12:34:55 +0000 (13:34 +0100)
commit2a441a9aacaa79695e9d005af30fdd5186d773fb
tree88411f4d43e8b881d29a4c4853d2fa1d68882cc7
parent59ecffa3995e70a675beeb870f0b3a28470428de
netfilter: flowtable: dedicated slab for flow entry

The size of `struct flow_offload` has grown beyond 256 bytes on 64-bit
kernels (currently 280 bytes) because of the `flow_offload_tunnel`
member added recently. So kmalloc() allocates from the kmalloc-512 slab,
causing significant memory waste per entry.

Introduce a dedicated slab cache for flow entries to reduce memory
footprint. Results in a reduction from 512 bytes to 320 bytes per entry
on x86_64 kernels.

Signed-off-by: Qingfang Deng <dqfext@gmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
net/netfilter/nf_flow_table_core.c