madvise06: make bug detection more reliable

1. set up memory cgroup
This allows us to get swapped memory faster, and also
eliminates problems with running testcase on big systems.

2. check for expected effects in a loop
madvise_willneed() reads memory asynchronously, so we check
multiple times with delay in-between. Because we can't
distinguish between bad kernel and slow I/O, bad kernel
will make test check for 5 seconds before giving up.
As last resort we check presence of first page.

Tested-by: Chunyu Hu <chuhu@redhat.com>
Signed-off-by: Jan Stancek <jstancek@redhat.com>
1 file changed