acl-plugin: optimize hash memory usage + fix the startup config parsing for memory... 23/16123/1
authorAndrew Yourtchenko <ayourtch@gmail.com>
Wed, 21 Nov 2018 07:56:53 +0000 (08:56 +0100)
committerAndrew Yourtchenko <ayourtch@gmail.com>
Thu, 22 Nov 2018 19:10:47 +0000 (19:10 +0000)
commit9e182dcacab5d590a3a1f40ca17cf4a0853ebbb8
tree8685fdc649ed2aae81707cefa72ce4f91bf2f582
parent1d403abe1baa9d058a99e7113236d93d2bbb93d6
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 <ayourtch@gmail.com>
(cherry picked from commit 94f509615eb97cebc9192e7290c84cf166518039)
src/plugins/acl/acl.c
src/plugins/acl/acl.h
src/plugins/acl/hash_lookup.c