lib: add .request_hugepages to reserve hugepage

Many of the ltp tests need to use hugepage in their testing, this allows
the test can reserve hpages from system only via .request_hugepages = xx.

If set non-zero number of request_hugepages, test will try to reserve the
expected number of hugepage for testing in setup phase. If system does not
have enough hpage for using, it will try the best to reserve 80% available
number of hpages. For a system without hugetlb supporting, variable
'tst_hugepage' will be set to 0.

Reviewed-by: Petr Vorel <pvorel@suse.cz>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Li Wang <liwang@redhat.com>
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 8d7dee2..9a24cff 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -890,6 +890,9 @@
 	if (tst_test->all_filesystems)
 		tst_test->needs_device = 1;
 
+	if (tst_test->request_hugepages)
+		tst_request_hugepages(tst_test->request_hugepages);
+
 	setup_ipc();
 
 	if (tst_test->bufs)
@@ -1006,8 +1009,7 @@
 		tst_rmdir();
 	}
 
-	if (tst_test->save_restore)
-		tst_sys_conf_restore(0);
+	tst_sys_conf_restore(0);
 
 	if (tst_test->restore_wallclock)
 		tst_wallclock_restore();