From 94f509615eb97cebc9192e7290c84cf166518039 Mon Sep 17 00:00:00 2001 From: Andrew Yourtchenko Date: Wed, 21 Nov 2018 08:56:53 +0100 Subject: acl-plugin: optimize hash memory usage + fix the startup config parsing for memory sizes [VPP-1502] In a couple of places vec_add1()-style was repeatedly called in a loop for smallish vectors where the number of additions was known in advance. With a test with large number of ACEs these numbers contribute to heap fragmentation noticeably. Minimize the number of allocations by preallocating the known size and then resetting the length accordingly, and then calling vec_add1() Also unify the parsing of the memory-related startup config parameters. Change-Id: If8fba344eb1dee8f865ffe7b396ca3b6bd9dc1d0 Signed-off-by: Andrew Yourtchenko --- src/plugins/acl/acl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/acl/acl.h') diff --git a/src/plugins/acl/acl.h b/src/plugins/acl/acl.h index 1d1ee442304..ef2f25a8631 100644 --- a/src/plugins/acl/acl.h +++ b/src/plugins/acl/acl.h @@ -142,7 +142,7 @@ typedef struct { hash_acl_info_t *hash_acl_infos; /* corresponding hash matching housekeeping info */ clib_bihash_48_8_t acl_lookup_hash; /* ACL lookup hash table. */ u32 hash_lookup_hash_buckets; - u32 hash_lookup_hash_memory; + uword hash_lookup_hash_memory; /* mheap to hold all the miscellaneous allocations related to hash-based lookups */ void *hash_lookup_mheap; -- cgit 1.2.3-korg