Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
northd: Fix incorrect memory allocation for router group datapaths.
We need to allocate memory for 'n_router_dps' pointers, but the current code allocates space for 'n_router_dps' datapaths, which is 762 byte structure. Having 5000 routers in the OpenStack setup, we allocate 762 * 5000 * 5000 ~= 17 GB of memory instead of 190 MB: 98.17% (19,962,746,247B) (heap allocation functions) ->90.67% (18,436,818,400B) xcalloc__ (util.c:124) ->90.67% (18,436,818,400B) xcalloc (util.c:161) ->90.67% (18,436,818,400B) build_lrouter_groups (northd.c:8707) ->90.67% (18,436,818,400B) ovnnb_db_run (northd.c:17611) ->90.67% (18,436,818,400B) en_northd_run (en-northd.c:137) ->90.67% (18,436,818,400B) engine_recompute (inc-proc-eng.c:415) ->90.67% (18,436,818,400B) engine_run_node (inc-proc-eng.c:477) ->90.67% (18,436,818,400B) engine_run (inc-proc-eng.c:528) ->90.67% (18,436,818,400B) inc_proc_northd_run (inc-proc-northd.c:316) ->90.67% (18,436,818,400B) main (ovn-northd.c:937) Also, even though this doesn't affect the allocation size, the order of arguments is incorrect. Fix that by using correct pointers and order. That saves a huge amount of memory as well as time on allocating and zeroing it out. In my testing northd node saved 10 seconds on these allocations. Fixes: b82d351 ("ovn: Add generic HA chassis group") Signed-off-by: Ilya Maximets <[email protected]> Acked-by: Mark Michelson <[email protected]> Signed-off-by: Mark Michelson <[email protected]>
- Loading branch information