summaryrefslogtreecommitdiff
path: root/drivers/usb/input/git@git.tavy.me:linux.git
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2026-03-25 14:11:01 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2026-03-26 13:18:31 +0100
commitfafdd92b9e30fe057740c5bb5cd4f92ecea9bf26 (patch)
tree4ff969e0572149d842885022768dd6efe726410d /drivers/usb/input/git@git.tavy.me:linux.git
parent9d3f027327c2fa265f7f85ead41294792c3296ed (diff)
netfilter: nft_set_rbtree: revisit array resize logic
Chris Arges reports high memory consumption with thousands of containers, this patch revisits the array allocation logic. For anonymous sets, start by 16 slots (which takes 256 bytes on x86_64). Expand it by x2 until threshold of 512 slots is reached, over that threshold, expand it by x1.5. For non-anonymous set, start by 1024 slots in the array (which takes 16 Kbytes initially on x86_64). Expand it by x1.5. Use set->ndeact to subtract deactivated elements when calculating the number of the slots in the array, otherwise the array size array gets increased artifically. Add special case shrink logic to deal with flush set too. The shrink logic is skipped by anonymous sets. Use check_add_overflow() to calculate the new array size. Add a WARN_ON_ONCE check to make sure elements fit into the new array size. Reported-by: Chris Arges <carges@cloudflare.com> Fixes: 7e43e0a1141d ("netfilter: nft_set_rbtree: translate rbtree to array for binary search") Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'drivers/usb/input/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions