Skip to content

memory reduction in concatenation and maps

Pablo Neira Ayuso netfilter-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 of 3 patches 1 replyIn review

2 of 3 patches are in this archive. The cover letter announces 3.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
2/3expression: constant range is not a singletonsrc/expression.c+1 -10 replies
3/3src: use EXPR_RANGE_VALUE in interval mapssrc/evaluate.c src/netlink.c src/optimize.c+49 -90 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH nft 0/3] memory reduction in concatenation and maps

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(-)
Signature · 1 line
2.30.2