All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nft 0/3] memory reduction in concatenation and maps
@ 2025-06-16 21:57 Pablo Neira Ayuso
  2025-06-16 21:57 ` [PATCH nft 1/3,v2] src: use constant range expression for interval+concatenation sets Pablo Neira Ayuso
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Pablo Neira Ayuso @ 2025-06-16 21:57 UTC (permalink / raw)
  To: netfilter-devel

Hi,

This series uses EXPR_RANGE_VALUE in maps to reduce memory usage:

Patch #1 reduces memory footprint in concatenation of intervals,
with the following 100k example set:

 table inet x {
        set y {
                typeof ip saddr . tcp dport
                flags interval
                elements = {
                        0.1.2.0-0.1.2.240 . 0-1,
                        ...				# 100k-1 entries more
                }
        }
 }

Before: 123.80 Mbytes
After:   80.19 Mbytes (-35.23%)

Patch #2 remove EXPR_F_SINGLETON in EXPR_RANGE_VALUE that is required
by next patch.

Patch #3 reduces memory footprint in maps.

With 100k map with concatenations:

  table inet x {
         map y {
                    typeof ip saddr . tcp dport :  ip saddr
                    flags interval
                    elements = {
                        1.0.2.0-1.0.2.240 . 0-2 : 1.0.2.10,
                        ...
         }
  }

Before: 153.6 Mbytes
After: 108.9 Mbytes (-29.11%)

With 100k map without concatenations:

  table inet x {
         map y {
                    typeof ip saddr :  ip saddr
                    flags interval
                    elements = {
                        1.0.2.0-1.0.2.240 : 1.0.2.10,
                        ...
         }
  }

Before: 74.36 Mbytes
After: 62.39 Mbytes (-16.10%)

This is passing tests/shell.

Pablo Neira Ayuso (3):
  src: use constant range expression for interval+concatenation sets
  expression: constant range is not a singleton
  src: use EXPR_RANGE_VALUE in interval maps

 src/evaluate.c   |  8 ++++---
 src/expression.c |  2 +-
 src/netlink.c    | 61 ++++++++++++++++++++++++++++++++++++++++++------
 src/optimize.c   |  3 +++
 4 files changed, 63 insertions(+), 11 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-06-23 17:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-16 21:57 [PATCH nft 0/3] memory reduction in concatenation and maps Pablo Neira Ayuso
2025-06-16 21:57 ` [PATCH nft 1/3,v2] src: use constant range expression for interval+concatenation sets Pablo Neira Ayuso
2025-06-16 21:57 ` [PATCH nft 2/3] expression: constant range is not a singleton Pablo Neira Ayuso
2025-06-16 21:57 ` [PATCH nft 3/3] src: use EXPR_RANGE_VALUE in interval maps Pablo Neira Ayuso
2025-06-23 17:08 ` [PATCH nft 0/3] memory reduction in concatenation and maps Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.