[Swan-commit] Changes to ref refs/heads/master
Andrew Cagney
cagney at vault.libreswan.fi
Sat Oct 12 15:07:28 UTC 2019
New commits:
commit d7eea0edd5cede40ec412fa34c5c2757c169b59c
Author: Andrew Cagney <cagney at gnu.org>
Date: Fri Oct 11 00:24:09 2019 -0400
address pool: reduce complexity from O(#LEASES) to O(1)
Leases were being stored as a linked list. In the case of reusable
(nee sharable) leases that list could grow until there was an entry
for every possible address. Think about 10.0.0.0/8.
This patch replaces the list with an array that grows on demand:
- the operation LEASE.ADDRESS->LEASE is O(1)
- the array grows simply doubling it size (0 1 2 4 ...): no
preallocation magic to test
- lists et.al. get implemented using offsets (array moves): there are
some pretty ugly macros dealing with this :-(
- the free list is double linked: single-use leases are prepended;
reusable leases are appended (so they get recovered in FIFO order);
only when the free list is totally exhausted will the lease array
grow
- the operation ID->LEASE uses an O(1) hash table implemented on top
of the leases array: when the array grows the hash table is rebuilt
- the reusable leases unique IDs are stored as strings
- the code that tried to mix in the xauth e-mail address isn't enabled
as, seamingly, it wasn't doing anything other than changing a log
More information about the Swan-commit
mailing list