mmu: map the underlying file directly from filesystem page cache

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
mmu: don't map huge pages when doing shared mappings

because they will be backed by ZFS buffers, let's simplify by supporting
only small pages.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
mmu: use proper barriers for tlb flushes

While testing the shared page cache code, I saw crashes that I eventually
tracked down to the flushing code. After some debugging, the problem looked
quite generic, and not related to my new code at all.

The problem would happen when two different threads would request a tlb flush,
one after another. It could be made more visible by always setting the flusher
thread to null after we were done: In that case, gdb would show the flusher
thread variable as a clearly valid pointer, but the wake() function would see
"this == 0x0".

It is obvious what to do from the above diagnosis: we need stronger barriers
around that variable to guarantee that everybody is in sync.

Before this patch, I would see crashes in that test in > 90 % of my runs. A
patched version survived 10 solid runs.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
mmu: handle multiple mappings to the same file

This case is not supposed to be utterly common, but we have to handle it
anyway.  This implementation is slightly naive, but it should be okay if the
number of mappings is small.  We should revisit it this number start growing
too much

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
tests: test for larger-than-memory mmaps.

It will create a file on-disk twice as large as memory, and then will map it entirely
in memory. The file is then read from using 3 different sequential patterns, and then
later on 2 threaded patterns.

This test does not handle writes.

It goes in misc because it takes a very long time to run (especially with a random pattern)

Example output:

Total Ram 586 Mb
Write done
Double Pass OK (13.6323 usec / page)
Recency OK (3.35954 usec / page)
Random Access OK (640.926 usec / page)
Threaded pass 1 address ended OK
Threaded pass many addresses ended OK
PASSED

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>