page scanner changes too sharp

I am currently running redis, and top.py shows the page scanner eating up 4 %
of my CPU. For the record, I don't see that on EC2 at all. In there, it barely
touches 0.5 %. Maybe my local CPU is just slower ?

Back to the patch, redis does not use mmap at all. The only mappings we have,
are the initial mappings that happen when we load the ELF libraries, during
initialization. When tracing the access pattern, I could see that in two interwined
runs, one of them would have _cpu set to 0.1 % - the minimum, while the other would
have it set to 20 % - the maximum.

The sharp changes would definitely explain the 4 % figures. What this patch
tries to do, is to use _cpu instead of _max_cpu as a correction factor for the
next _cpu calculation.  This way, even if we have a burst of scans, we will
increase it slowly, rather than drastically. If the scan rate persists being high,
we will then increasing it until the maximum.

With this patch, the trace output looks a lot smoother:

0x0000000000df63f0 page-access-sca  0        25.381661111 access_scanner       scanned=1, cleared=0, %cpu=0.1
0x0000000000df63f0 page-access-sca  0        25.382729839 access_scanner       scanned=25, cleared=23, %cpu=0.46
0x0000000000df63f0 page-access-sca  0        25.383742419 access_scanner       scanned=35, cleared=11, %cpu=0.722857
0x0000000000df63f0 page-access-sca  0        25.384820323 access_scanner       scanned=61, cleared=10, %cpu=0.592506
0x0000000000df63f0 page-access-sca  0        25.385900359 access_scanner       scanned=99, cleared=8, %cpu=0.239396

And cpu usage, as shown by top.py, is usually averaging around 0.8 %.

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