Add atomic operations tests and fix latent bugs.
Fix the cactive statistic.

Fix the cactive statistic to decrease (rather than increase) when active
memory decreases.  This regression was introduced by
aa5113b1fdafd1129c22512837c6c3d66c295fc8 (Refactor overly large/complex
functions) and first released in 3.5.0.