cmap: Shrink cmap when load factor is below 20%.
authorAlex Wang <alexw@nicira.com>
Thu, 20 Nov 2014 18:41:52 +0000 (10:41 -0800)
committerAlex Wang <alexw@nicira.com>
Fri, 21 Nov 2014 16:52:27 +0000 (08:52 -0800)
commit8f9392dc70a5816074edf1656ca2ea9d77cee254
tree1f9b1ebcc563d9ae2e8908a911750ad523f5fdad
parent67ad54cbc8a8cbe367e5f8d857ff2174d8bca9f9
cmap: Shrink cmap when load factor is below 20%.

This commit adds check in cmap_remove() and shrinks the cmap by half
if the load factor is below 20%.  This is to reduce the memory
utilization of cmap and to avoid the allocated cmap memory occupying
the top of heap memory, preventing the trim of heap.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lib/cmap.c