lockfree: introduce unordered_queue_mpsc

It's like queue_mpsc with two improvements:

 * consumer and producer links are cache line aligned to avoid false
   sharing. I was tempted to apply this to queue_mpsc too but then
   discovered that this queue is embedded in a mutex, and doing so
   would greatly bloat mutex size, so I gave up on this idea.

 * The contract of pop() is relaxed to return items in no particular
   order so that we can avoid the cost of reversing the chain.
lockfree: introduce unordered_queue_spsc

It is meant to provide both the speed of a ring buffer and
non-blocking properties of linked queues by combining the two. Unlike
for ring_spsc, push() is always guaranteed to succeed.
tests: introduce latch.is_released()
tests: introduce latch.await_for()
tests: add test for free() throughput across CPUs

There is one allocating threads and two freeing threads. Each thread
is allocated on a different core. The test measures throughput of
objects freed by both threads.
mempool: remove contention inside free_different_cpu()

Fixes #308.

When the per-cpu-pair ring fills up, the freeing thread is blocked and
enters a synchronous object hand-off. That synchronous hand-off is
cause of contention. Instead of having a bounded ring we can use an
unordered_queue_mpsc which links the freed objects in a chain. In this
implementation push() always succeeds and we don't need to block.

Dead objects are collected by per-CPU worker thread (same as
before). The thread is woken up once every 256 frees. That threshold
was chosen so that the behavior would more or less correspond to what
was before.

In a test which allocates 1K blocks on once CPU and having two threads
freeing them on two other CPUs, there is a 34% improvement of free()
throughput, the rate is also smoother:

Before:

[tgrabiec@muninn osv]$ scripts/run.py -e "/tests/misc-free-perf.so" -m20g
OSv v0.08-204-gea7f730
eth0: 192.168.122.15
4965400.00 obj/s
5571296.00 obj/s
4423701.50 obj/s
4644924.00 obj/s
4895169.50 obj/s
3899036.75 obj/s
5366423.50 obj/s
3513653.50 obj/s
4771981.50 obj/s
4163249.25 obj/s
4446266.50 obj/s
4357642.00 obj/s
4175693.25 obj/s
4183677.50 obj/s
4040219.00 obj/s
4205483.50 obj/s
4058674.50 obj/s
4226758.50 obj/s
3970518.25 obj/s
4091574.75 obj/s
3802421.25 obj/s
3956429.25 obj/s
3695832.75 obj/s
3833415.00 obj/s
3611812.75 obj/s
3704160.50 obj/s
Time is up! Shutting off allocation.
3545059.25 obj/s
3597259.00 obj/s
4800736.00 obj/s
4822780.50 obj/s
Freed 66540782 in 7.82 s = 8504353.52 per second

After:

[tgrabiec@muninn osv]$ scripts/run.py -e "/tests/misc-free-perf.so" -m20g
OSv v0.08-200-g22c3646
eth0: 192.168.122.15
5611648.00 obj/s
5612938.00 obj/s
5631902.50 obj/s
5631428.50 obj/s
5661394.00 obj/s
5661349.00 obj/s
5661812.50 obj/s
5661728.50 obj/s
5789980.00 obj/s
5791102.00 obj/s
5882732.50 obj/s
5882923.50 obj/s
5871615.50 obj/s
5871219.00 obj/s
5841799.50 obj/s
5841718.50 obj/s
5857147.50 obj/s
5856793.00 obj/s
5899528.00 obj/s
5899912.50 obj/s
5631646.00 obj/s
5630567.50 obj/s
5509876.00 obj/s
5510405.00 obj/s
5556116.00 obj/s
5556107.00 obj/s
Time is up! Shutting off allocation.
5550851.00 obj/s
5547903.50 obj/s
Freed 79965910 in 7.00 s = 11421914.23 per second
sched: turn _migration_lock_counter into __thread local variable

This way migration-lock can be used unconditionally in memory
allocator which is called very early, before the first thread is
created.
mempool: prevent across-CPU page stealing

This addresses the race which is mentioned in the comment. If the
thread doing add_page() is migrated before the preempt_lock is taken
it may feed the pool with a page coming from different CPU's page
buffer.

The fix is to embrace the body with migration-lock.
mempool: do not take preempt_lock when freeing from different cpu
mempool: remove contention inside unfill_page_buffer()

This change reduces page buffer pressure caused by virtio-net
allocations, showign up as contention inside unfill_page_buffer() and
refill_page_buffer(). The virtio-net subsystem allocates pages on one
CPU which are then scattered across all other CPUs and freed to their
per-CPU buffers. To mitigate that, this change enables caching of
pages used by virtio-net.