[dpdk-dev] [RFC] net/mlx5: memory optimization for flow

Suanming Mou suanmingm at mellanox.com
Mon Mar 16 03:54:53 CET 2020


Once there are millions of flows be created, the memory consumption of 
one flow will become more sensitive. A byte memory means Mbytes 
consumption with millions of flows. In this case, to take care of every 
bytes the flow costed becomes more important.

We are planning to save the memory consumption with flow creation step 
by step.

Step 1, currently, the mlx5 rte_flow is composed with the mlx5_flow 
subflows.  The data struct memory optimization will mainly focus on the 
two structs.

 1. Merge the struct members those can be as union.
 2. The members in the mlx5_flow subflows which are both same in the
    rte_flow will be moved to save only in rte_flow struct. It’s not
    needed to save the copies of the same actions in every mlx5_flow
    subflows.
 3. The members in the struct use limited bits will be stripped to the
    bits only they are needed.
 4. The structs aligned with holes will be reconstructed.
 5. Some global limited resources such as port_id actions may not be
    recorded in the flow data struct to save the pointer memory and only
    to released when port is closed.

Step 2, as flow creation will allocate several small memory blocks, such 
as the rte_flow memory, mlx5_flow memory, actions memory, the small 
memory blocks will be allocated from pools to avoid the overhead of 
every rte_malloc().

Step 3, data struct which stands for several mode may split for 
individual mode, such as currently the struct mlx5_flow_counter contains 
the members both batch and none-batch mode. The split of the members 
will save the bytes of counters in the pool with different mode.

Thanks

SuanmingMou



More information about the dev mailing list