public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Li Wang <liwang@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3 2/3] hugemmap32: improvement test
Date: Mon,  6 Nov 2023 17:30:30 +0800	[thread overview]
Message-ID: <20231106093031.1844129-3-liwang@redhat.com> (raw)
In-Reply-To: <20231106093031.1844129-1-liwang@redhat.com>

Signed-off-by: Li Wang <liwang@redhat.com>
---
 .../kernel/mem/hugetlb/hugemmap/hugemmap32.c  | 59 +------------------
 1 file changed, 2 insertions(+), 57 deletions(-)

diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c
index d27e5b8b2..8f57a79ac 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c
@@ -18,67 +18,13 @@
 
 #define _GNU_SOURCE
 #include <dirent.h>
-
 #include <stdio.h>
 
 #include "hugetlb.h"
 
-#define PATH_HUGEPAGE "/sys/kernel/mm/hugepages"
-#define GIGANTIC_MIN_ORDER 10
-
-static int org_g_hpages;
-static char g_hpage_path[4096];
-
 static void run_test(void)
 {
-	if (FILE_PRINTF(g_hpage_path, "%d", 1))
-		tst_brk(TCONF, "Can't update the gigantic hugepages.");
-	SAFE_FILE_PRINTF(g_hpage_path, "%d", 0);
-
-	if (tst_taint_check())
-		tst_res(TFAIL, "Freeing Gigantic pages resulted in Bad Page State bug.");
-	else
-		tst_res(TPASS, "Successfully freed the gigantic hugepages");
-}
-
-static void setup(void)
-{
-	DIR *dir;
-	struct dirent *ent;
-	unsigned long hpage_size;
-
-	if (access(PATH_HUGEPAGE, F_OK))
-		tst_brk(TCONF, "hugetlbfs is not supported");
-
-	dir = SAFE_OPENDIR(PATH_HUGEPAGE);
-	while ((ent = SAFE_READDIR(dir))) {
-		if ((sscanf(ent->d_name, "hugepages-%lukB", &hpage_size) == 1) &&
-			is_hugetlb_gigantic(hpage_size * 1024)) {
-			sprintf(g_hpage_path, "%s/%s/%s", PATH_HUGEPAGE,
-					ent->d_name, "nr_hugepages");
-			break;
-		}
-	}
-	if (!g_hpage_path[0])
-		tst_brk(TCONF, "Gigantic hugepages not supported");
-
-	SAFE_CLOSEDIR(dir);
-
-	SAFE_FILE_PRINTF("/proc/sys/vm/drop_caches", "3");
-	SAFE_FILE_PRINTF("/proc/sys/vm/compact_memory", "1");
-
-	if (tst_available_mem() < (long long)hpage_size) {
-		g_hpage_path[0] = '\0';
-		tst_brk(TCONF, "No enough memory for gigantic hugepage reservation");
-	}
-
-	SAFE_FILE_LINES_SCANF(g_hpage_path, "%d", &org_g_hpages);
-}
-
-static void cleanup(void)
-{
-	if (g_hpage_path[0])
-		SAFE_FILE_PRINTF(g_hpage_path, "%d", org_g_hpages);
+	tst_res(TPASS, "If reserved & freed the gigantic page completely, then regard as pass");
 }
 
 static struct tst_test test = {
@@ -88,8 +34,7 @@ static struct tst_test test = {
 	    {}
 	},
 	.needs_root = 1,
-	.setup = setup,
-	.cleanup = cleanup,
+	.hugepages = {1, TST_NEEDS, TST_GIGANTIC},
 	.test_all = run_test,
 	.taint_check = TST_TAINT_B,
 };
-- 
2.40.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  parent reply	other threads:[~2023-11-06  9:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-06  9:30 [LTP] [PATCH v3 0/3] Introduce new field .hptype for reserving gigantic page Li Wang
2023-11-06  9:30 ` [LTP] [PATCH v3 1/3] lib: add support for kinds of hpsize reservation Li Wang
2024-02-16 11:22   ` Petr Vorel
2023-11-06  9:30 ` Li Wang [this message]
2024-02-16 12:09   ` [LTP] [PATCH v3 2/3] hugemmap32: improvement test Petr Vorel
2023-11-06  9:30 ` [LTP] [PATCH v3 3/3] hugemmap34: Test to detect bug with migrating gigantic pages Li Wang
2024-02-16 12:01   ` Petr Vorel
2024-02-16 12:12     ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231106093031.1844129-3-liwang@redhat.com \
    --to=liwang@redhat.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox