locking: Try to avoid Algorithmic Complexity Attacks by using Quarks.

Denial of service via hash collisions - https://lwn.net/Articles/474912/
Also fix error in pool initialization.